summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-17 21:13:05 +0000
committerrubidium <rubidium@openttd.org>2011-11-17 21:13:05 +0000
commit4390f6f449226a756b10e42d012574a9d85aace2 (patch)
treea2c0d4c16ebcb7bdd63a19a6d4a6f72430f12bff
parent881d6d25fddd6a3fabe6656cd5e3ec9029ef120a (diff)
downloadopenttd-4390f6f449226a756b10e42d012574a9d85aace2.tar.xz
(svn r23243) -Codechange: give a clearer error when the sprite font failed to provide a sprite or fall back to the freetype font if that's loaded
-rw-r--r--src/fontcache.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 820287caf..fdc662659 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -1001,7 +1001,15 @@ const Sprite *GetGlyph(FontSize size, WChar key)
if (face == NULL || (key >= SCC_SPRITE_START && key <= SCC_SPRITE_END)) {
SpriteID sprite = GetUnicodeGlyph(size, key);
if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
- return GetSprite(sprite, ST_FONT);
+
+ /* Load the sprite if it's known. */
+ if (sprite != 0) return GetSprite(sprite, ST_FONT);
+
+ /* For the 'rare' case there is no font available at all. */
+ if (face == NULL) error("No sprite font and no real font either... bailing!");
+
+ /* Use the '?' from the freetype font. */
+ key = '?';
}
/* Check for the glyph in our cache */