pango_layout_set_justify_last_line()
Submitted by Behdad Esfahbod
Link to original bug (#435413)
Description
Currently PangoLayout has an align attr of left/center/right, and a justify attr of true/false. One missing combination is to make pango justify all lines, even the last line of paragraphs that is. It is quite useful in rendering Persian poetry for example where all verses are stretched to the same width (see http://rira.ir/rira/php/?page=view&mod=classicpoems&obj=poem&id=1 for example).
So, there are three ways to implement this that I see:
-
Add a new setting: pango_layout_set_justify_fill() or something. It will only make sense if justify is true, and then align is ignored.
-
Add a new align setting: PANGO_ALIGN_FILL. It makes a lot of sense cause alignment doesn't make sense otherwise. If justify is off or a line cannot be justified, it acts like align center. The major problem with this is adding a new value to an enum that most people don't expect to see extended.
-
Change semantics of ALIGN_CENTER justify=true to fill. This is taking one combination and putting another, hopefully more useful, one. The main problem with this one is that it more often than not will surprise people.
Another option would be to add a new attribute which is a forced line break that unlike a LINE SEPARATOR, will justify the previous line. Needs support in markup too.
Owen? Others?
Version: 1.16.x