[cairo] Problem with cairo_scaled_font_glyph_extents() on Win32

Elmar Braun Elmar.Braun at sh-p.de
Mon Feb 9 06:17:47 PST 2009


Hi,

I have encountered a problem moving from Cairo 1.6.4 to 1.8.6. The
reason appears to be that cairo_scaled_font_glyph_extents() has changed
it's behaviour between 1.6 to 1.8 (at least when used with Win32 fonts).

My glyphs come from a framework which, for whatever reason, occasionally
requests glyph extents for invalid glyphs (i.e. glyphs that don't exist
in my font, e.g. '0xffff' in 'Times New Roman'). Cairo 1.6 returns all
glyph extents as 0 in this case. So does Cairo 1.8, but 1.8 also
permanently sets the status of the cairo_scaled_font_t to
CAIRO_STATUS_NO_MEMORY. This causes all subsequent calls to return zero
extents as well, even if made with an existing glyph with positive
extents. Cairo 1.6 always return the correct glyph extents, even if
cairo_scaled_font_glyph_extents() was called earlier with an invalid
glyph.

Can I expect that the old behaviour will be restored in a future release
of 1.8? Or should I work around the new behaviour, by checking whether a
glyph is valid before calling cairo_scaled_font_glyph_extents? (If so:
any suggestions how the latter can be done with Cairo, without resorting
to Win32-specific code? Throwing away and immediately re-creating the
messed up scaled fonts seems kinda wasteful.)

Best regards,
Elmar


More information about the cairo mailing list