aboutsummaryrefslogtreecommitdiff
path: root/gui/ThemeEngine.cpp
diff options
context:
space:
mode:
authorThanasis Antoniou2019-03-12 00:39:02 +0200
committerThanasis Antoniou2019-03-12 00:42:58 +0200
commit672d216d113abcc11d3be1b0c76d2c251cfd8357 (patch)
tree671657edc596d451e969b5e9ecfb6e69ccb15cfb /gui/ThemeEngine.cpp
parent1e6720b8be6c80cfb9177fdcdca7c032be0e869c (diff)
downloadscummvm-rg350-672d216d113abcc11d3be1b0c76d2c251cfd8357.tar.gz
scummvm-rg350-672d216d113abcc11d3be1b0c76d2c251cfd8357.tar.bz2
scummvm-rg350-672d216d113abcc11d3be1b0c76d2c251cfd8357.zip
GUI: Fix loading new (not already cached) localized fonts
Diffstat (limited to 'gui/ThemeEngine.cpp')
-rw-r--r--gui/ThemeEngine.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index e57a1ef687..e1438cda35 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -526,17 +526,25 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file, const Com
_texts[textId]->_fontPtr = loadFont(localized, scalableFile, charset, pointsize, textId == kTextDataDefault);
if (!_texts[textId]->_fontPtr) {
+ warning("Failed to load localized font '%s'", localized.c_str());
// Try standard fonts
_texts[textId]->_fontPtr = loadFont(file, scalableFile, Common::String(), pointsize, textId == kTextDataDefault);
- if (!_texts[textId]->_fontPtr)
+ if (!_texts[textId]->_fontPtr) {
error("Couldn't load font '%s'/'%s'", file.c_str(), scalableFile.c_str());
-
+#ifdef USE_TRANSLATION
+ TransMan.setLanguage("C");
+#endif
+ return false; // fall-back attempt failed
+ }
+ // Success in fall-back attempt to standard (non-localized) font.
+ // However, still returns false here, probably to avoid ugly / garbage glyphs side-effects
+ // FIXME If we return false anyway why would we attempt the fall-back in the first place?
#ifdef USE_TRANSLATION
TransMan.setLanguage("C");
#endif
- warning("Failed to load localized font '%s'.", localized.c_str());
-
+ // Returning true here, would allow falling back to standard fonts for the missing ones,
+ // but that leads to "garbage" glyphs being displayed on screen for non-Latin languages
return false;
}
}