commit ea3987db9ae910923a93c4001af8ca7c2589338c Author: Carl Worth Date: Wed Jun 14 04:32:25 2006 -0700 Bug 6617: Special case size-zero bitmap glyphs to avoid setting an error diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index c5fb728..340d9c1 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -705,7 +705,7 @@ _native_byte_order_lsb (void) return *((char *) &x) == 1; } -/* Fills in val->image with an image surface created from @bitmap +/* Creates an image surface from @bitmap */ static cairo_status_t _get_bitmap_surface (FT_Bitmap *bitmap, @@ -721,6 +721,15 @@ _get_bitmap_surface (FT_Bitmap *bi width = bitmap->width; height = bitmap->rows; + /* For a size-zero bitmap we still want to have a valid pointer to + * an image surface, but presumably we don't care what format we + * use for that. */ + if (width == 0 || height == 0) { + *surface = (cairo_image_surface_t *) + cairo_image_surface_create (CAIRO_FORMAT_A1, 0, 0); + return (*surface)->base.status; + } + switch (bitmap->pixel_mode) { case FT_PIXEL_MODE_MONO: stride = (((width + 31) & ~31) >> 3);