From b1f63deba3afe176646dbf9aae5c22cfab453785 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sat, 25 Sep 2010 22:47:00 +0000 Subject: GUI: Partial fix to bug #3075649 Fonts not found with buit-in theme When the locale font are not found when loading the theme, it now fallbacks to default language (i.e. English) and default font. For this to work I had to move the TranslationManager initialization before the Theme is loaded. Therefore it is now initialized when the GuiManager is constructed. svn-id: r52896 --- gui/GuiManager.cpp | 3 +++ gui/ThemeEngine.cpp | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/GuiManager.cpp b/gui/GuiManager.cpp index bbd7718d71..44c6530d7e 100644 --- a/gui/GuiManager.cpp +++ b/gui/GuiManager.cpp @@ -62,6 +62,9 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _tooltipCheck(false), // Clear the cursor memset(_cursor, 0xFF, sizeof(_cursor)); + + // Enable translation + TransMan.setLanguage(ConfMan.get("gui_language").c_str()); ConfMan.registerDefault("gui_theme", "scummmodern"); Common::String themefile(ConfMan.get("gui_theme")); diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 0d0fe8aecd..92ecf0346f 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -579,7 +579,7 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file) { if (_texts[textId]->_fontPtr) FontMan.assignFontToName(file, _texts[textId]->_fontPtr); - // Fallback to non-localized font + // Fallback to non-localized font and default translation else { // Try built-in fonts _texts[textId]->_fontPtr = FontMan.getFontByName(file); @@ -593,7 +593,8 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file) { FontMan.assignFontToName(file, _texts[textId]->_fontPtr); } - warning("Failed to load localized font '%s'. Using non-localized font instead", file.c_str()); + TransMan.setLanguage("C"); + warning("Failed to load localized font '%s'. Using non-localized font and default GUI language instead", file.c_str()); } } } -- cgit v1.2.3