aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/ThemeEngine.cpp21
-rw-r--r--gui/ThemeEngine.h1
2 files changed, 19 insertions, 3 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index b491b12065..3a50b2c69c 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1451,6 +1451,20 @@ const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &fil
if (_themeArchive)
stream = _themeArchive->createReadStreamForMember(filename);
if (stream) {
+ font = Graphics::NewFont::loadFont(*stream);
+ delete stream;
+ }
+
+ return font;
+}
+
+const Graphics::Font *ThemeEngine::loadCachedFontFromArchive(const Common::String &filename) {
+ Common::SeekableReadStream *stream = 0;
+ const Graphics::Font *font = 0;
+
+ if (_themeArchive)
+ stream = _themeArchive->createReadStreamForMember(filename);
+ if (stream) {
font = Graphics::NewFont::loadFromCache(*stream);
delete stream;
}
@@ -1464,13 +1478,14 @@ const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) {
Common::File fontFile;
if (!cacheFilename.empty()) {
- if (fontFile.open(cacheFilename))
+ if (fontFile.open(cacheFilename)) {
font = Graphics::NewFont::loadFromCache(fontFile);
+ }
if (font)
return font;
- if ((font = loadFontFromArchive(cacheFilename)))
+ if ((font = loadCachedFontFromArchive(cacheFilename)))
return font;
}
@@ -1485,7 +1500,7 @@ const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) {
if (font) {
if (!cacheFilename.empty()) {
- if (!Graphics::NewFont::cacheFontData(*(const Graphics::NewFont*)font, cacheFilename)) {
+ if (!Graphics::NewFont::cacheFontData(*(const Graphics::NewFont *)font, cacheFilename)) {
warning("Couldn't create cache file for font '%s'", filename.c_str());
}
}
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index f736559def..73181b74a6 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -540,6 +540,7 @@ protected:
const Graphics::Font *loadFont(const Common::String &filename);
const Graphics::Font *loadFontFromArchive(const Common::String &filename);
+ const Graphics::Font *loadCachedFontFromArchive(const Common::String &filename);
Common::String genCacheFilename(const char *filename);
Common::String genLocalizedFontFilename(const char *filename);