From e738079302a968b7b1fb9101cd4d92a8887bedce Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 5 Jul 2013 15:22:18 -0600 Subject: [PATCH] [ft] Fix wrong assumptions If subpixel rendering is enabled, but FT returns a 8bit gray bitmap (perhaps because the font has 8bit embedded bitmaps) we were hitting the assertions because the assumptions made were wrong. Fix up. --- src/cairo-ft-font.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 3bba59e47..3d2ff2700 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -1182,7 +1182,9 @@ _get_bitmap_surface (FT_Bitmap *bitmap, case FT_PIXEL_MODE_LCD: case FT_PIXEL_MODE_LCD_V: case FT_PIXEL_MODE_GRAY: - if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) { + if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL || + bitmap->pixel_mode == FT_PIXEL_MODE_GRAY) + { stride = bitmap->pitch; if (own_buffer) { data = bitmap->buffer; @@ -1196,12 +1198,6 @@ _get_bitmap_surface (FT_Bitmap *bitmap, format = CAIRO_FORMAT_A8; } else { - /* if we get there, the data from the source bitmap - * really comes from _fill_xrender_bitmap, and is - * made of 32-bit ARGB or ABGR values */ - assert (own_buffer != 0); - assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY); - data = bitmap->buffer; stride = bitmap->pitch; format = CAIRO_FORMAT_ARGB32;