summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-07-26 10:21:26 +0000
committerpeter1138 <peter1138@openttd.org>2008-07-26 10:21:26 +0000
commit6466e810ebde631818b08a2974ca2bd3d29e9e10 (patch)
tree9defd0ecd9c33e34271f31be5deb8412b04c5351
parent65d1fb3a9095bd8210e0faae46e6d5c4207930e8 (diff)
downloadopenttd-6466e810ebde631818b08a2974ca2bd3d29e9e10.tar.xz
(svn r13832) -Fix [FS#2152]: FreeType may return a bitmap glyph even if a grey-scale glyph was requested.
-rw-r--r--src/fontcache.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 0135c2567..ab7c9c5d1 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -415,6 +415,9 @@ const Sprite *GetGlyph(FontSize size, WChar key)
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));