From a6f464592a1a158301436f57e82dad08bb0fb28c Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 2 May 2013 08:51:26 +0000 Subject: [PATCH] 6659: Justified paragraph layout does not work Actually: it works always, but pango does not justify partial lines... svn: r22139 --- gramps/plugins/lib/libcairodoc.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gramps/plugins/lib/libcairodoc.py b/gramps/plugins/lib/libcairodoc.py index c949cfeee..5022a6ab2 100644 --- a/gramps/plugins/lib/libcairodoc.py +++ b/gramps/plugins/lib/libcairodoc.py @@ -547,12 +547,20 @@ class GtkDocParagraph(GtkDocBaseElement): # align = self._style.get_alignment_text() if align == 'left': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.LEFT) elif align == 'right': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.RIGHT) elif align == 'center': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.CENTER) elif align == 'justify': + #We have a problem, in pango, justify works only on full lines, + # and we need an alignment for the partial lines. We don't know + # for justify what alignment the user wants however. We assume + # here LEFT ... + layout.set_alignment(Pango.Alignment.LEFT) layout.set_justify(True) else: raise ValueError @@ -728,12 +736,20 @@ class GtkDocParagraph(GtkDocBaseElement): # align = self._style.get_alignment_text() if align == 'left': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.LEFT) elif align == 'right': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.RIGHT) elif align == 'center': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.CENTER) elif align == 'justify': + #We have a problem, in pango, justify works only on full lines, + # and we need an alignment for the partial lines. We don't know + # for justify what alignment the user wants however. We assume + # here LEFT ... + layout.set_alignment(Pango.Alignment.LEFT) layout.set_justify(True) # font_style = self._style.get_font() @@ -1289,12 +1305,20 @@ class GtkDocText(GtkDocBaseElement): # set paragraph properties align = self._style.get_alignment_text() if align == 'left': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.LEFT) elif align == 'right': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.RIGHT) elif align == 'center': + layout.set_justify(False) layout.set_alignment(Pango.Alignment.CENTER) elif align == 'justify': + #We have a problem, in pango, justify works only on full lines, + # and we need an alignment for the partial lines. We don't know + # for justify what alignment the user wants however. We assume + # here CENTER ... + layout.set_alignment(Pango.Alignment.CENTER) layout.set_justify(True) else: raise ValueError