pycairo: justify text-align
<p>I use python bindings to Cairo to render text.</p>

<p>My question is: Is it possible to render a string using something like <code>text-align: justify</code>? Suppose I have fixed width and I want to print a paragraph.</p>

<p>Solved [using pangocairo]:</p>

<pre><code>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)
</code></pre>

python text alignment cairo justify