[Scummvm-cvs-logs] scummvm master -> eceaf7f8cbccb984ad3878d94549d92ccc10a492

somaen einarjohants at gmail.com
Fri Nov 15 15:28:35 CET 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
eceaf7f8cb WINTERMUTE: Add bold-font support for FreeSans.ttf (and only FreeSans for now).


Commit: eceaf7f8cbccb984ad3878d94549d92ccc10a492
    https://github.com/scummvm/scummvm/commit/eceaf7f8cbccb984ad3878d94549d92ccc10a492
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-11-15T06:27:50-08:00

Commit Message:
WINTERMUTE: Add bold-font support for FreeSans.ttf (and only FreeSans for now).

This is mostly a quick fix to solve the rather common case of wanting
to use bold Arial. This will not handle the user adding the actual Arial.ttf
file to the folder yet, but atleast it solves the common case of having
to fallback to FreeSans.

Changed paths:
    engines/wintermute/base/font/base_font_truetype.cpp
    engines/wintermute/base/font/base_font_truetype.h



diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index 55481c7..d6f0914 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -568,13 +568,22 @@ bool BaseFontTT::initFont() {
 		return STATUS_FAILED;
 	}
 #ifdef USE_FREETYPE2
+	Common::String fallbackFilename;
+	// Handle Bold atleast for the fallback-case.
+	// TODO: Handle italic. (Needs a test-case)
+	if (_isBold) {
+		fallbackFilename = "FreeSansBold.ttf";
+	} else {
+		fallbackFilename = "FreeSans.ttf";
+	}
+
 	Common::SeekableReadStream *file = BaseFileManager::getEngineInstance()->openFile(_fontFile);
 	if (!file) {
 		if (Common::String(_fontFile) != "arial.ttf") {
 			warning("%s has no replacement font yet, using FreeSans for now (if available)", _fontFile);
 		}
 		// Fallback1: Try to find FreeSans.ttf
-		file = SearchMan.createReadStreamForMember("FreeSans.ttf");
+		file = SearchMan.createReadStreamForMember(fallbackFilename);
 	}
 
 	if (file) {
@@ -601,9 +610,9 @@ bool BaseFontTT::initFont() {
 		}
 		if (themeFile) {
 			Common::Archive *themeArchive = Common::makeZipArchive(themeFile);
-			if (themeArchive->hasFile("FreeSans.ttf")) {
+			if (themeArchive->hasFile(fallbackFilename)) {
 				file = nullptr;
-				file = themeArchive->createReadStreamForMember("FreeSans.ttf");
+				file = themeArchive->createReadStreamForMember(fallbackFilename);
 				_deletableFont = Graphics::loadTTFFont(*file, 96, _fontHeight); // Use the same dpi as WME (96 vs 72).
 				_font = _deletableFont;
 			}
@@ -618,7 +627,7 @@ bool BaseFontTT::initFont() {
 	// Fallback3: Try to ask FontMan for the FreeSans.ttf ScummModern.zip uses:
 	if (!_font) {
 		// Really not desireable, as we will get a font with dpi-72 then
-		Common::String fontName = Common::String::format("%s-%s@%d", "FreeSans.ttf", "ASCII", _fontHeight);
+		Common::String fontName = Common::String::format("%s-%s@%d", fallbackFilename.c_str(), "ASCII", _fontHeight);
 		warning("Looking for %s", fontName.c_str());
 		_font = FontMan.getFontByName(fontName);
 	}
diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h
index 2d7ebba..7a96cdf 100644
--- a/engines/wintermute/base/font/base_font_truetype.h
+++ b/engines/wintermute/base/font/base_font_truetype.h
@@ -135,7 +135,7 @@ private:
 	size_t _maxCharWidth;
 	size_t _maxCharHeight;
 
-public:
+private:
 	bool _isBold;
 	bool _isItalic;
 	bool _isUnderline;






More information about the Scummvm-git-logs mailing list