Reputation: 111
I use python bindings to Cairo to render text.
My question is: Is it possible to render a string using something like text-align: justify
? Suppose I have fixed width and I want to print a paragraph.
Upvotes: 2
Views: 684
Reputation: 111
Solved [using pangocairo]:
import pygtk
import cairo
import pango
import pangocairo
...
layout = pangocairo_context.create_layout()
...
layout.set_width(...)
layout.set_wrap(pango.WRAP_WORD)
layout.set_justify(True)
layout.set_text(text)
Upvotes: 2