[cairo-commit] src/cairo-ft-font.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Sep 7 05:10:00 PDT 2007


 src/cairo-ft-font.c |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
diff-tree d62f8861689d8b9a9a837043fb78813f0407abd4 (from d635e0103346f22e578d17c59153d292820e00d2)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Sep 5 08:07:41 2007 +0100

    [cairo-ft-font] Early detection of a zero sized bitmap.
    
    Under rare circumstances we may need to extract a surface that
    represents a bitmap with width==0 and rows==0. Detect this case at the
    start and simply return a zero-sized surface.
    
    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=12284.

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 201d1ad..8136502 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -735,6 +735,12 @@ _get_bitmap_surface (FT_Bitmap		     *bi
     width = bitmap->width;
     height = bitmap->rows;
 
+    if (width == 0 || height == 0) {
+	*surface = (cairo_image_surface_t *)
+	    cairo_image_surface_create_for_data (NULL, format, 0, 0, 0);
+	return (*surface)->base.status;
+    }
+
     switch (bitmap->pixel_mode) {
     case FT_PIXEL_MODE_MONO:
 	stride = (((width + 31) & ~31) >> 3);


More information about the cairo-commit mailing list