(svn r13832) -Fix [FS#2152]: FreeType may return a bitmap glyph even if a grey-scale glyph was requested.
authorpeter1138
Sat, 26 Jul 2008 10:21:26 +0000
changeset 9716 d58d69584eae
parent 9715 b3dbb8b51870
child 9717 b7806a165a75
(svn r13832) -Fix [FS#2152]: FreeType may return a bitmap glyph even if a grey-scale glyph was requested.
src/fontcache.cpp
--- a/src/fontcache.cpp	Sat Jul 26 07:43:20 2008 +0000
+++ b/src/fontcache.cpp	Sat Jul 26 10:21:26 2008 +0000
@@ -415,6 +415,9 @@
 	FT_Load_Char(face, key, FT_LOAD_DEFAULT);
 	FT_Render_Glyph(face->glyph, aa ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO);
 
+	/* Despite requesting a normal glyph, FreeType may have returned a bitmap */
+	aa = (slot->bitmap.palette_mode == FT_PIXEL_MODE_GRAY);
+
 	/* Add 1 pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel */
 	width  = max(1, slot->bitmap.width + (size == FS_NORMAL));
 	height = max(1, slot->bitmap.rows  + (size == FS_NORMAL));