[cairo] Exact placement of a multiline pango layout

Stefan Salewski mail at ssalewski.de
Fri Oct 22 11:51:57 PDT 2010


Hello,

I am drawing a multiline pango layout to a cairo surface, and I want do
draw a rectangle around that text, giving something
---------------
|Line 1       |
|Line two     |
|A longer Line|
---------------

Propose is something like drawing labels in a graphical layout tool. So
I need exact control over layout, the frame in the example should exact
enclose the logical(or ink) layout.

Indeed, I have already a few working solutions, but I think they work
only by fortune, and may fail with other types of text.

I was not able to find a good exapmle like this one for cairo's toy
text:

http://cairographics.org/samples/text_align_center/

I have found this thread from a mailing list, a similar problem,

http://lists.freedesktop.org/archives/cairo/2007-February/009472.html

but I am still not convinced that I understand the correct solution. I
think there should exists really some more simple examples for pango.

Best regards

Stefan Salewski




More information about the cairo mailing list