[cairo] Possible bug in font hinting metrics?

George Wright george.wright at collabora.co.uk
Fri Sep 7 09:03:36 PDT 2007


Hello,

Can someone explain to me how font hinting is supposed to work?

We are rendering text on a cairo context which can be scaled by the user. If 
the scale factor of the context is 1.0 then the text renders fine. However, 
if hinting is enabled and the context is scaled, then the text has awkward 
gaps between the letters. We are getting the glyph extents through 
cairo_scaled_font_glyph_extents and rendering a buffer of glyphs using 
calculations based on those reported glyph extents.

From the cairo API documentation at 
http://www.cairographics.org/manual/cairo-Scaled-Fonts.html#cairo-text-extents-t 
it says:

"If you call cairo_scale(cr, 2.0, 2.0), text will be drawn twice as big, but 
the reported text extents will not be doubled. They will change slightly due 
to hinting (so you can't assume that metrics are independent of the 
transformation matrix), but otherwise will remain unchanged."

We are obviously not getting the hinted extents.

To see what I mean I've made a screenshot at 
http://vm.gwright.org.uk/cairo_text.png - in particular, I mean things like 
the unnaturally large gap between 'w' and 'e' in "the web".

Is there a way of getting the true (hinted) extents or is this a bug in cairo?

Regards,

George

-- 
George Wright, http://www.gwright.org.uk
Collabora Ltd - http://www.collabora.co.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20070907/f468647f/attachment.pgp 


More information about the cairo mailing list