changeset 91108:6da57551efb7

(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
author Kenichi Handa <handa@m17n.org>
date Mon, 19 Nov 2007 05:02:49 +0000
parents 55753e191b46
children 5ed0717083a1
files src/ftfont.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ftfont.c	Sun Nov 18 14:52:50 2007 +0000
+++ b/src/ftfont.c	Mon Nov 19 05:02:49 2007 +0000
@@ -913,6 +913,15 @@
 
   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;