From 0e7ccb896dafb69664fb313c63bdb8fbe0ea82d1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 28 Jun 2010 15:17:10 +0000 Subject: 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 --- graphics/fontman.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'graphics/fontman.cpp') 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; -- cgit v1.2.3