]> git.eshelyaron.com Git - emacs.git/commitdiff
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
authorKenichi Handa <handa@m17n.org>
Mon, 19 Nov 2007 05:02:49 +0000 (05:02 +0000)
committerKenichi Handa <handa@m17n.org>
Mon, 19 Nov 2007 05:02:49 +0000 (05:02 +0000)
src/ftfont.c

index 7edf7f142b6c53434e6442c8d146433c4b267b0a..e8ef6a4871f6f83a4ea2a28a6b7f166c17109ddc 100644 (file)
@@ -913,6 +913,15 @@ ftfont_get_bitmap (font, code, bitmap, bits_per_pixel)
 
   if (FT_Load_Glyph (ft_face, code, load_flags) != 0)
     return -1;
+  bitmap->bits_per_pixel
+    = (ft_face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO ? 1
+       : ft_face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY ? 8
+       : ft_face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_LCD ? 8
+       : ft_face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_LCD_V ? 8
+       : -1);
+  if (bitmap->bits_per_pixel < 0)
+    /* We don't suport that kind of pixel mode.  */
+    return -1;
   bitmap->rows = ft_face->glyph->bitmap.rows;
   bitmap->width = ft_face->glyph->bitmap.width;
   bitmap->pitch = ft_face->glyph->bitmap.pitch;