Fix for error 5851 in trunk and 3.4.
'&' and '<' give Pango warnings and does not display properly in (most) Graphical reports. svn: r19865
This commit is contained in:
parent
1e0946784c
commit
19a19adaa9
@ -339,7 +339,8 @@ class FanChart(Report):
|
||||
if self.map[index]:
|
||||
if (generation == 0) and self.circle == FULL_CIRCLE:
|
||||
yc = y
|
||||
self.doc.rotate_text(text_style, self.text[index],
|
||||
txt = '\n'.join(self.text[index])
|
||||
self.doc.rotate_text(text_style, txt,
|
||||
xc, yc, text_angle)
|
||||
text_angle += delta
|
||||
|
||||
@ -368,11 +369,12 @@ class FanChart(Report):
|
||||
start_angle, end_angle, rad1)
|
||||
text_angle += delta
|
||||
if self.map[index]:
|
||||
txt = '\n'.join(self.text[index])
|
||||
if self.radial == RADIAL_UPRIGHT and (start_angle >= 90) and (start_angle < 270):
|
||||
self.doc.rotate_text(text_style, self.text[index],
|
||||
self.doc.rotate_text(text_style, txt,
|
||||
xc, yc, text_angle + 180)
|
||||
else:
|
||||
self.doc.rotate_text(text_style, self.text[index],
|
||||
self.doc.rotate_text(text_style, txt,
|
||||
xc, yc, text_angle)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
@ -7,6 +7,7 @@
|
||||
# Copyright (C) 2010 Peter Landgren
|
||||
# Copyright (C) 2010 Jakim Friant
|
||||
# Copyright (C) 2011 Paul Franklin
|
||||
# Copyright (C) 2012 Craig Anderson
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -1432,6 +1433,14 @@ class CairoDoc(BaseDoc, TextDoc, DrawDoc):
|
||||
self.__write_text('\n'.join(newlines), markup=True, links=links)
|
||||
self.end_paragraph()
|
||||
|
||||
def __markup(self, text, markup=None):
|
||||
if not markup:
|
||||
# We need to escape the text here for later pango.Layout.set_markup
|
||||
# calls. This way we save the markup created by the report
|
||||
# The markup in the note editor is not in the text so is not
|
||||
# considered. It must be added by pango too
|
||||
return self._backend.ESCAPE_FUNC()(text)
|
||||
|
||||
def __write_text(self, text, mark=None, markup=False, links=False):
|
||||
"""
|
||||
@param text: text to write.
|
||||
@ -1457,12 +1466,7 @@ links (like ODF) and write PDF from that format.
|
||||
""" % cairo.version
|
||||
self._links_error = True
|
||||
|
||||
if not markup:
|
||||
# We need to escape the text here for later pango.Layout.set_markup
|
||||
# calls. This way we save the markup created by the report
|
||||
# The markup in the note editor is not in the text so is not
|
||||
# considered. It must be added by pango too
|
||||
text = self._backend.ESCAPE_FUNC()(text)
|
||||
text = self.__markup(text, markup)
|
||||
|
||||
if mark:
|
||||
self._active_element.add_mark(mark)
|
||||
@ -1572,9 +1576,9 @@ links (like ODF) and write PDF from that format.
|
||||
if style.get_shadow():
|
||||
x_offset = style.get_shadow_space()
|
||||
else:
|
||||
x_offset = 0.2
|
||||
|
||||
new_text = GtkDocText(paragraph_style, 'center', text,
|
||||
new_text = GtkDocText(paragraph_style, 'center',
|
||||
self.__markup(text),
|
||||
x + x_offset , y + h / 2, angle=0)
|
||||
self._active_element.add_child(new_text)
|
||||
|
||||
@ -1585,7 +1589,8 @@ links (like ODF) and write PDF from that format.
|
||||
paragraph_style = style_sheet.get_paragraph_style(paragraph_style_name)
|
||||
paragraph_style.set_alignment(PARA_ALIGN_LEFT)
|
||||
|
||||
new_text = GtkDocText(paragraph_style, 'top', text, x, y, angle=0)
|
||||
new_text = GtkDocText(paragraph_style, 'top',
|
||||
self.__markup(text), x, y, angle=0)
|
||||
self._active_element.add_child(new_text)
|
||||
|
||||
def center_text(self, style_name, text, x, y):
|
||||
@ -1595,7 +1600,8 @@ links (like ODF) and write PDF from that format.
|
||||
paragraph_style = style_sheet.get_paragraph_style(paragraph_style_name)
|
||||
paragraph_style.set_alignment(PARA_ALIGN_CENTER)
|
||||
|
||||
new_text = GtkDocText(paragraph_style, 'top', text, x, y, angle=0)
|
||||
new_text = GtkDocText(paragraph_style, 'top',
|
||||
self.__markup(text), x, y, angle=0)
|
||||
self._active_element.add_child(new_text)
|
||||
|
||||
def rotate_text(self, style_name, text, x, y, angle):
|
||||
@ -1605,8 +1611,8 @@ links (like ODF) and write PDF from that format.
|
||||
paragraph_style = style_sheet.get_paragraph_style(paragraph_style_name)
|
||||
paragraph_style.set_alignment(PARA_ALIGN_CENTER)
|
||||
|
||||
new_text = GtkDocText(paragraph_style, 'center', '\n'.join(text),
|
||||
x, y, angle)
|
||||
new_text = GtkDocText(paragraph_style, 'center',
|
||||
self.__markup([text]), x, y, angle)
|
||||
self._active_element.add_child(new_text)
|
||||
|
||||
# paginating and drawing interface
|
||||
@ -1678,3 +1684,4 @@ links (like ODF) and write PDF from that format.
|
||||
cr.stroke()
|
||||
|
||||
self._pages[page_nr].draw(cr, layout, width, dpi_x, dpi_y)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user