aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorJohannes Schickel2012-01-07 01:00:31 +0100
committerJohannes Schickel2012-01-07 01:03:07 +0100
commit050b8e33604bb50d48a9a43f61c85baccb17ab1d (patch)
treec4bea936ebe8425f91ecc80cdcd9fc34b103f712 /gui
parent0d3e79cf77af364063944b5884c34c9da7c0466d (diff)
downloadscummvm-rg350-050b8e33604bb50d48a9a43f61c85baccb17ab1d.tar.gz
scummvm-rg350-050b8e33604bb50d48a9a43f61c85baccb17ab1d.tar.bz2
scummvm-rg350-050b8e33604bb50d48a9a43f61c85baccb17ab1d.zip
GUI: Rework how the default localized font is managed.
Now we set the default localized font to the "text_default" font of the currently active theme and default to the big GUI font in case none is specified properly.
Diffstat (limited to 'gui')
-rw-r--r--gui/ThemeEngine.cpp14
-rw-r--r--gui/ThemeEngine.h2
2 files changed, 11 insertions, 5 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index ae93154419..461e9cff2a 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -571,14 +571,15 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file) {
} else {
Common::String localized = FontMan.genLocalizedFontFilename(file);
// Try localized fonts
- _texts[textId]->_fontPtr = loadFont(localized);
+ _texts[textId]->_fontPtr = loadFont(localized, textId == kTextDataDefault);
if (!_texts[textId]->_fontPtr) {
// Try standard fonts
- _texts[textId]->_fontPtr = loadFont(file);
+ _texts[textId]->_fontPtr = loadFont(file, textId == kTextDataDefault);
if (!_texts[textId]->_fontPtr)
error("Couldn't load font '%s'", file.c_str());
+
#ifdef USE_TRANSLATION
TransMan.setLanguage("C");
#endif
@@ -1385,7 +1386,7 @@ DrawData ThemeEngine::parseDrawDataId(const Common::String &name) const {
* External data loading
*********************************************************/
-const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) {
+const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename, const bool makeLocalizedFont) {
// Try already loaded fonts.
const Graphics::Font *font = FontMan.getFontByName(filename);
if (font)
@@ -1417,8 +1418,13 @@ const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) {
}
// If the font is successfully loaded store it in the font manager.
- if (font)
+ if (font) {
FontMan.assignFontToName(filename, font);
+ // If this font should be the new default localized font, we set it up
+ // for that.
+ if (makeLocalizedFont)
+ FontMan.setLocalizedFont(filename);
+ }
return font;
}
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index def64ec025..2377098957 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -536,7 +536,7 @@ protected:
*/
void unloadTheme();
- const Graphics::Font *loadFont(const Common::String &filename);
+ const Graphics::Font *loadFont(const Common::String &filename, const bool makeLocalizedFont);
Common::String genCacheFilename(const Common::String &filename) const;
/**