[Scummvm-git-logs] scummvm master -> 92ea5a7d76ffc19cf4921788211dd0d633b3eafe

djsrv dservilla at gmail.com
Mon Jul 12 05:34:47 UTC 2021


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

Summary:
9fe78bc54d GRAPHICS: MACGUI: Fix unregistered font segfault
92ea5a7d76 DIRECTOR: Use String::format instead of U32String::format


Commit: 9fe78bc54df313da5c46ca9521297cc3af46f995
    https://github.com/scummvm/scummvm/commit/9fe78bc54df313da5c46ca9521297cc3af46f995
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-12T01:33:16-04:00

Commit Message:
GRAPHICS: MACGUI: Fix unregistered font segfault

Changed paths:
    graphics/macgui/macfontmanager.cpp
    graphics/macgui/macfontmanager.h


diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 44c35340d9..e403b2b7c8 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -508,7 +508,7 @@ void MacFont::setName(const char *name) {
 }
 
 const Common::String MacFontManager::getFontName(uint16 id, int size, int slant, bool tryGen) {
-	Common::String rawName = _fontInfo[id]->name;
+	Common::String rawName = getFontName(id);
 	Common::String n = cleanFontName(rawName);
 	int extraSlant = parseFontSlant(rawName);
 	// let's try parse slant from name
@@ -558,6 +558,14 @@ int MacFontManager::getFontFallbackId(uint16 id) {
 	return _fontInfo[id]->fallbackId;
 }
 
+Common::String MacFontManager::getFontName(uint16 id) {
+	if (!_fontInfo.contains(id)) {
+		warning("MacFontManager::getFontFallbackId: No _fontInfo entry for font %d", id);
+		return "";
+	}
+	return _fontInfo[id]->name;
+}
+
 void MacFontManager::generateFontSubstitute(MacFont &macFont) {
 	Common::String name;
 
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index a9002d9993..577a1f56c1 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -146,6 +146,7 @@ public:
 	Common::Language getFontLanguage(uint16 id);
 	Common::CodePage getFontEncoding(uint16 id);
 	int getFontFallbackId(uint16 id);
+	Common::String getFontName(uint16 id);
 
 	void loadFonts(Common::SeekableReadStream *stream);
 	void loadFonts(const Common::String &fileName);


Commit: 92ea5a7d76ffc19cf4921788211dd0d633b3eafe
    https://github.com/scummvm/scummvm/commit/92ea5a7d76ffc19cf4921788211dd0d633b3eafe
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-12T01:33:52-04:00

Commit Message:
DIRECTOR: Use String::format instead of U32String::format

U32String::format doesn't support all the formatting types
Common::String does. So just use String::format then cast to U32String.

Changed paths:
    engines/director/castmember.cpp


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index 58539ff811..9b559e037e 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -778,7 +778,7 @@ void TextCastMember::setText(const Common::U32String &text) {
 		return;
 
 	// If text has changed, use the cached formatting from first STXT in this castmember.
-	Common::U32String formatting = Common::U32String::format("\001\016%04x%02x%04x%04x%04x%04x", _fontId, _textSlant, _fontSize, _fgpalinfo1, _fgpalinfo2, _fgpalinfo3);
+	Common::U32String formatting = Common::String::format("\001\016%04x%02x%04x%04x%04x%04x", _fontId, _textSlant, _fontSize, _fgpalinfo1, _fgpalinfo2, _fgpalinfo3);
 	_ptext = text;
 	_ftext = formatting + text;
 




More information about the Scummvm-git-logs mailing list