[cairo] cairo-win32 falls over when asked for the path of a glyph from a bitmap font

Carl Worth cworth at cworth.org
Wed Apr 4 16:26:58 PDT 2007

It was just pointed out to me that the following function:


returns CAIRO_STATUS_NO_MEMORY if it is asked to provide a path for
the glyph of a bitmap font. The failure comes from a call to
GetGlyphOutlineW which happens inside of:


And _cairo_win32_print_gdi_error stupidly turns any GDI failure into a
return value of CAIRO_STATUS_NO_MEMORY.

What should happen instead is that in this case
_cairo_win32_scaled_font_glyph_init should simply return
CAIRO_INT_STATUS_UNSUPPORTED, and then the code we already have for
tracing out a path from the bitmap glyph image would come into play,
and everything would be happy.

Any win32 hackers have the knowledge to fix this? It's really just a
matter of taking the existing code:

    if ((info & CAIRO_SCALED_GLYPH_INFO_PATH) != 0) {
        status = _cairo_win32_scaled_font_init_glyph_path (scaled_font, scaled_glyph);
        if (status)
            return status;

and augmenting it with:

    if ((info & CAIRO_SCALED_GLYPH_INFO_PATH) != 0) {

+	if (_cairo_win32_scaled_font_is_bitmap (scaled_font))

        status = _cairo_win32_scaled_font_init_glyph_path (scaled_font, scaled_glyph);
        if (status)
            return status;

But I don't know how to detect the "is_bitmap" part. Another approach
would be to just properly handle the current error from
GetGlyphOutlineW and making _cairo_win32_scaled_font_init_glyph_path
return CAIRO_INT_STATUS_UNSUPPORTED, (though again, I don't know if
that function could fail for other reasons nor if it properly
advertises the reason for failure).

Presumably there's someone out there that knows more about this than
me and can fix this properly.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070404/236182c1/attachment.pgp

More information about the cairo mailing list