[cairo] Error handling in cairo_type1_font_subset_get_glyph_names_and_widths

Adrian Johnson ajohnson at redneon.com
Sun Nov 2 03:27:15 PST 2008


Peter Weilbacher wrote:
>> - Use _cairo_scaled_glyph_lookup() to get the glyph advance instead of
>> using FreeType directly. And only get the widths for the glyphs that are
>> actually used.

> OK, all this sounds nice. But for the first item I'm wondering how you are
> going to get the advance for that glyph if you cannot load it. Is there
> some other code in cairo that magically derives the metrics without asking
> FreeType?

The second sentence "only get the widths for the glyphs that are 
actually used" is what will fix your bug. The first sentence has more to 
do with eliminating the FreeType dependency in type1-subset. If 
_cairo_scaled_glyph_lookup() fails or returns the wrong metrics your 
font will not display correctly on the screen at which point you would 
want to replace the font.

I've pushed out the simple fix - falling back to type1-fallback if it fails:

http://gitweb.freedesktop.org/?p=cairo;a=commit;h=6434cddb899d750b815d71f8f51ae3e4568dd3c0



More information about the cairo mailing list