6659: Justified paragraph layout does not work

Actually: it works always, but pango does not justify partial lines...


svn: r22139
This commit is contained in:
Benny Malengier 2013-05-02 08:51:26 +00:00
parent 45849a93a6
commit a6f464592a

View File

@ -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