[cairo] PATCH #4 - text extents (now in CVS!)

Carl Worth cworth at east.isi.edu
Tue Dec 16 07:32:37 PST 2003

On Dec 9, John Ellson wrote:
 > This one works right - no more small errors in the right-bearing of the 
 > bounding rectangle.

Hi John,

I've *finally* committed this patch (with some modifications). It
wasn't doing the right thing when the user called cairo_glyph_extents,
(as opposed to cairo_text_extents).

The cairo-demo/png/text.c program demonstrates the new functionality
in a variety of situations, (rotated CTM, rotated font matrix, etc.).

Things still aren't perfect. There is a bug (or two) when the font has
a non-identity transform. If you run the demo, you'll see that the 3rd
"hello, world" string, which is rendered with a rotated font matrix,
extends out of the rectangle drawn with the extents information.

Worse, if the gstate or font has a reflected transformation, the
rectangles drawn end up the reflected compared to the text. See the
#define in text.c to try this out.

I'm not sure whether the reflection bug is in the implementation or
the usage of the extents, but I thought I would commit it even with
the bug, so that others can help look at it.


More information about the cairo mailing list