[Scummvm-cvs-logs] SF.net SVN: scummvm:[51585] scummvm/trunk/gui

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Aug 1 21:31:18 CEST 2010


Revision: 51585
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51585&view=rev
Author:   lordhoto
Date:     2010-08-01 19:31:18 +0000 (Sun, 01 Aug 2010)

Log Message:
-----------
GUI: Fix loading BDF fonts from theme archives.

Modified Paths:
--------------
    scummvm/trunk/gui/ThemeEngine.cpp
    scummvm/trunk/gui/ThemeEngine.h

Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp	2010-08-01 17:59:14 UTC (rev 51584)
+++ scummvm/trunk/gui/ThemeEngine.cpp	2010-08-01 19:31:18 UTC (rev 51585)
@@ -1451,6 +1451,20 @@
 	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 @@
 	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 @@
 
 	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());
 			}
 		}

Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h	2010-08-01 17:59:14 UTC (rev 51584)
+++ scummvm/trunk/gui/ThemeEngine.h	2010-08-01 19:31:18 UTC (rev 51585)
@@ -540,6 +540,7 @@
 
 	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);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list