diff options
author | peter1138 <peter1138@openttd.org> | 2008-01-25 13:48:39 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-01-25 13:48:39 +0000 |
commit | e37b88ebfc83546c1cd6e1871f3160e810fdbe68 (patch) | |
tree | feb41fd20ff60b8a57be1da466861b76a6303eda /src/fontcache.cpp | |
parent | c9d751a1811582c0b4165405d2593190a68dc406 (diff) | |
download | openttd-e37b88ebfc83546c1cd6e1871f3160e810fdbe68.tar.xz |
(svn r11981) -Fix [FS#1698]: Use unicode glyph mapping to fix up missing/shuffled sprites in original data files instead of shuffling or skipping
sprites directly. Some required glyphs were not loaded.
-Fix: Large capital U with grave (Ù) along with some other glyphs are broken in the original data files, so do no display them.
Diffstat (limited to 'src/fontcache.cpp')
-rw-r--r-- | src/fontcache.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 7a5813c75..14c735c02 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -518,34 +518,38 @@ void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite) void InitializeUnicodeGlyphMap() { - FontSize size; - SpriteID base; - SpriteID sprite; - uint i; - - for (size = FS_NORMAL; size != FS_END; size++) { + for (FontSize size = FS_NORMAL; size != FS_END; size++) { /* Clear out existing glyph map if it exists */ if (_unicode_glyph_map[size] != NULL) { - for (i = 0; i < 256; i++) { + for (uint i = 0; i < 256; i++) { if (_unicode_glyph_map[size][i] != NULL) free(_unicode_glyph_map[size][i]); } free(_unicode_glyph_map[size]); _unicode_glyph_map[size] = NULL; } - base = GetFontBase(size); - for (i = ASCII_LETTERSTART; i < 256; i++) { - sprite = base + i - ASCII_LETTERSTART; + SpriteID base = GetFontBase(size); + + for (uint i = ASCII_LETTERSTART; i < 256; i++) { + SpriteID sprite = base + i - ASCII_LETTERSTART; if (!SpriteExists(sprite)) continue; SetUnicodeGlyph(size, i, sprite); SetUnicodeGlyph(size, i + SCC_SPRITE_START, sprite); } - for (i = 0; i < lengthof(_default_unicode_map); i++) { - sprite = base + _default_unicode_map[i].key - ASCII_LETTERSTART; - SetUnicodeGlyph(size, _default_unicode_map[i].code, sprite); + + for (uint i = 0; i < lengthof(_default_unicode_map); i++) { + byte key = _default_unicode_map[i].key; + if (key == CLRA || key == CLRL) { + /* Clear the glyph. This happens if the glyph at this code point + * is non-standard and should be accessed by an SCC_xxx enum + * entry only. */ + if (key == CLRA || size == FS_LARGE) { + SetUnicodeGlyph(size, _default_unicode_map[i].code, 0); + } + } else { + SpriteID sprite = base + key - ASCII_LETTERSTART; + SetUnicodeGlyph(size, _default_unicode_map[i].code, sprite); + } } } } - - - |