aboutsummaryrefslogtreecommitdiff
path: root/graphics/fontman.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2010-06-28 15:17:10 +0000
committerEugene Sandulenko2010-06-28 15:17:10 +0000
commit0e7ccb896dafb69664fb313c63bdb8fbe0ea82d1 (patch)
treed0672018e44e371b64f49901e2dea18000260cd4 /graphics/fontman.cpp
parent8410dbab539a8c278b29e9047bd5c192a3048e32 (diff)
downloadscummvm-rg350-0e7ccb896dafb69664fb313c63bdb8fbe0ea82d1.tar.gz
scummvm-rg350-0e7ccb896dafb69664fb313c63bdb8fbe0ea82d1.tar.bz2
scummvm-rg350-0e7ccb896dafb69664fb313c63bdb8fbe0ea82d1.zip
i18n: Add support for locale-dependent fonts
Currently it ws not decided where to put fonts, but if you put BDF files into themepath, they will get picked up. The font name has to contain same codepage specification as in the .po file, i.e. fixed5x8-iso-8859-5.bdf for Cyrillic codepage. In case the font does not exist, default will be used. All built in fonts get proper names. TODO: Currently there is a bug with our font cacher. Font clR6x12-iso-8859-5 is empty after loading from FCC file. Reason is unknown. svn-id: r50448
Diffstat (limited to 'graphics/fontman.cpp')
-rw-r--r--graphics/fontman.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index 808dbafa1a..c6972cfaab 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -57,18 +57,28 @@ FontManager::~FontManager() {
g_consolefont = 0;
}
-const char *builtinFontNames[] = {
- "builtinOSD",
- "builtinConsole",
- "builtinGUI",
- "builtinBigGUI",
- 0
+const struct {
+ const char *name;
+ FontManager::FontUsage id;
+} builtinFontNames[] = {
+ { "builtinOSD", FontManager::kOSDFont },
+ { "builtinConsole", FontManager::kConsoleFont },
+ { "fixed5x8.bdf", FontManager::kConsoleFont },
+ { "fixed5x8-iso-8859-1.bdf", FontManager::kConsoleFont },
+ { "fixed5x8-ascii.bdf", FontManager::kConsoleFont },
+ { "clR6x12.bdf", FontManager::kGUIFont },
+ { "clR6x12-iso-8859-1.bdf", FontManager::kGUIFont },
+ { "clR6x12-ascii.bdf", FontManager::kGUIFont },
+ { "helvB12.bdf", FontManager::kBigGUIFont },
+ { "helvB12-iso-8859-1.bdf", FontManager::kBigGUIFont },
+ { "helvB12-ascii.bdf", FontManager::kBigGUIFont },
+ { 0, FontManager::kOSDFont }
};
const Font *FontManager::getFontByName(const Common::String &name) const {
- for (int i = 0; builtinFontNames[i]; i++)
- if (!strcmp(name.c_str(), builtinFontNames[i]))
- return getFontByUsage((FontUsage)i);
+ for (int i = 0; builtinFontNames[i].name; i++)
+ if (!scumm_stricmp(name.c_str(), builtinFontNames[i].name))
+ return getFontByUsage(builtinFontNames[i].id);
if (!_fontMap.contains(name))
return 0;