diff -r e6ddd1674102 src/fontcache.cpp --- a/src/fontcache.cpp Mon Nov 22 18:45:27 2010 +0000 +++ b/src/fontcache.cpp Mon Nov 22 21:21:11 2010 +0100 @@ -1071,6 +1071,16 @@ return glyph->width; } +bool MissingCharacter(FontSize size, WChar key){ + FT_Face face = GetFontFace(size); + + /* return false if no face loaded, or for our special characters */ + if (face == NULL || (key >= SCC_SPRITE_START && key <= SCC_SPRITE_END)) { + return false; + } + /* FT_Get_Char_Index return 0 when fails */ + return FT_Get_Char_Index(face,key) == 0; +} #endif /* WITH_FREETYPE */ diff -r e6ddd1674102 src/fontcache.h --- a/src/fontcache.h Mon Nov 22 18:45:27 2010 +0000 +++ b/src/fontcache.h Mon Nov 22 21:21:11 2010 +0100 @@ -45,6 +45,7 @@ void UninitFreeType(); const Sprite *GetGlyph(FontSize size, uint32 key); uint GetGlyphWidth(FontSize size, uint32 key); +bool MissingCharacter(FontSize size, uint32 key); /** * We would like to have a fallback font as the current one @@ -81,6 +82,17 @@ return SpriteExists(sprite) ? GetSprite(sprite, ST_FONT)->width + (size != FS_NORMAL) : 0; } +/** + * Check if the caracter is in the character given is in the charmap. + * @param size the font size we are checking. + * @param key the character. + * @return true if the character is missing, false otherwise. + */ +static inline bool MissingCharacter(FontSize size, uint32 key) +{ + return false; +} + #endif /* WITH_FREETYPE */ #endif /* FONTCACHE_H */ diff -r e6ddd1674102 src/strings.cpp --- a/src/strings.cpp Mon Nov 22 18:45:27 2010 +0000 +++ b/src/strings.cpp Mon Nov 22 21:21:11 2010 +0100 @@ -1586,7 +1586,7 @@ text++; } else if (c == SCC_SETXY) { text += 2; - } else if (IsPrintable(c) && !IsTextDirectionChar(c) && c != '?' && GetGlyph(FS_NORMAL, c) == question_mark) { + } else if (IsPrintable(c) && !IsTextDirectionChar(c) && c != '?' && (GetGlyph(FS_NORMAL, c) == question_mark || MissingCharacter(FS_NORMAL, c))) { /* The character is printable, but not in the normal font. This is the case we were testing for. */ return true; }