[cairo] Rendering line fonts

Adrian Johnson ajohnson at redneon.com
Sat Nov 22 02:08:03 PST 2008

Ian Britten wrote:
> [ NB - This is probably a whole different discussion, but I noticed
> that when I select my text in Acroread, the highlight boxes don't
> match where the glyphs are drawn (Only with these custom fonts - TT
> seems ok).  Looks like a font origin/baseline issue.  I haven't
> looked into this yet, but if anyone is interested or concerned,
> speak up and I'll try to collect up more details when I get a
> minute... ]

Text selection highlight uses the FontBBox in the PDF. For Type 1 
fallback the FontBBox is the combined extents of each glyph in the 
subset. I would suggest checking that cairo_glyph_extents() is returning 
the correct extents for the glyphs in your custom font. An easy way to 
do this is to use the extents to draw rectangles around your glyphs. 
Something like this:

for each glyph:
     cairo_glyph_extents (cr, &glyph, 1, &extents);
     cairo_rectangle (cr,
                      glyph.x + extents.x_bearing,
                      glyph.y + extents.y_bearing,

More information about the cairo mailing list