summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-10-06 20:08:11 +0000
committerfrosch <frosch@openttd.org>2013-10-06 20:08:11 +0000
commitb4609fd923a610f12971f06e9e7be76ad0549e57 (patch)
tree568def6d018293bcbf98cee4217131fd67e15f65 /src
parent1e0dd39075a211e3104262264e00025cac9f242a (diff)
downloadopenttd-b4609fd923a610f12971f06e9e7be76ad0549e57.tar.xz
(svn r25822) -Fix [FS#5704]: Searching for a suitable font failed, if one of the fonts had no '?' glyph, and no baseset is installed.
Diffstat (limited to 'src')
-rw-r--r--src/fontcache.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 9e0fd1e16..cf4aa0765 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -458,9 +458,34 @@ const Sprite *FreeTypeFontCache::GetGlyph(GlyphID key)
if (key == 0) {
GlyphID question_glyph = this->MapCharToGlyph('?');
if (question_glyph == 0) {
- /* The font misses the '?' character. Use sprite font. */
- SpriteID sprite = this->GetUnicodeGlyph(key);
- Sprite *spr = (Sprite*)GetRawSprite(sprite, ST_FONT, AllocateFont);
+ /* The font misses the '?' character. Use built-in sprite.
+ * Note: We cannot use the baseset as this also has to work in the bootstrap GUI. */
+#define CPSET { 0, 0, 0, 0, 1 }
+#define CP___ { 0, 0, 0, 0, 0 }
+ static SpriteLoader::CommonPixel builtin_questionmark_data[10 * 8] = {
+ CP___, CP___, CPSET, CPSET, CPSET, CPSET, CP___, CP___,
+ CP___, CPSET, CPSET, CP___, CP___, CPSET, CPSET, CP___,
+ CP___, CP___, CP___, CP___, CP___, CPSET, CPSET, CP___,
+ CP___, CP___, CP___, CP___, CPSET, CPSET, CP___, CP___,
+ CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
+ CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
+ CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
+ CP___, CP___, CP___, CP___, CP___, CP___, CP___, CP___,
+ CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
+ CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
+ };
+#undef CPSET
+#undef CP___
+ static const SpriteLoader::Sprite builtin_questionmark = {
+ 10, // height
+ 8, // width
+ 0, // x_offs
+ 0, // y_offs
+ ST_FONT,
+ builtin_questionmark_data
+ };
+
+ Sprite *spr = BlitterFactoryBase::GetCurrentBlitter()->Encode(&builtin_questionmark, AllocateFont);
assert(spr != NULL);
new_glyph.sprite = spr;
new_glyph.width = spr->width + (this->fs != FS_NORMAL);