[Scummvm-git-logs] scummvm master -> 988daefade11f9e94579a29e53092cee00102384
sev-
sev at scummvm.org
Sun Feb 16 13:58:57 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0f3b188205 GRAPHICS: MACGUI: Fix double Geneva font ids
8df4d8a339 GRAPHICS: MACGUI: Proper processing of font slant names
988daefade GRAPHICS: MACGUI: Parse slant in extra fonts too
Commit: 0f3b188205fd9b68602c1a7dc70611f284295363
https://github.com/scummvm/scummvm/commit/0f3b188205fd9b68602c1a7dc70611f284295363
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-16T15:53:19+02:00
Commit Message:
GRAPHICS: MACGUI: Fix double Geneva font ids
Changed paths:
graphics/macgui/macfontmanager.h
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index f894de4..e33441b 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -69,7 +69,7 @@ class Font;
class MacFont {
public:
MacFont(int id = kMacFontChicago, int size = 12, int slant = kMacFontRegular, FontManager::FontUsage fallback = Graphics::FontManager::kBigGUIFont) {
- _id = id;
+ _id = id == 3 ? 1 : id; // Substitude duplicate "Geneva"
_size = size ? size : 12;
_slant = slant;
_fallback = fallback;
Commit: 8df4d8a339cecab831b2b606341f8843ae4a5ce8
https://github.com/scummvm/scummvm/commit/8df4d8a339cecab831b2b606341f8843ae4a5ce8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-16T15:53:19+02:00
Commit Message:
GRAPHICS: MACGUI: Proper processing of font slant names
Changed paths:
graphics/macgui/macfontmanager.cpp
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 46a32ed..f74d747 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -87,6 +87,28 @@ static const char *const fontStyleSuffixes[] = {
"Extend"
};
+int parseSlant(const Common::String fontname) {
+ int res = 0;
+
+ for (int i = 1; i < 7; i++)
+ if (fontname.contains(fontStyleSuffixes[i]))
+ res |= (1 << (i - 1));
+
+ return res;
+}
+
+Common::String cleanFontName(const Common::String fontname) {
+ const char *pos;
+ Common::String f = fontname;
+ for (int i = 1; i < 7; i++) {
+ if ((pos = strstr(f.c_str(), fontStyleSuffixes[i])))
+ f = Common::String(f.c_str(), pos);
+ }
+ f.trim();
+
+ return f;
+}
+
MacFontManager::MacFontManager(uint32 mode) : _mode(mode) {
for (uint i = 0; i < ARRAYSIZE(fontNames); i++)
if (fontNames[i])
@@ -213,6 +235,11 @@ void MacFontManager::loadFonts(Common::MacResManager *fontFile) {
Common::SeekableReadStream *fond = fontFile->getResource(MKTAG('F', 'O', 'N', 'D'), *iterator);
Common::String familyName = fontFile->getResName(MKTAG('F', 'O', 'N', 'D'), *iterator);
+ int familySlant = parseSlant(familyName);
+
+ if (familySlant) {
+ familyName = cleanFontName(familyName);
+ }
Graphics::MacFontFamily *fontFamily = new MacFontFamily();
fontFamily->load(*fond);
@@ -220,7 +247,7 @@ void MacFontManager::loadFonts(Common::MacResManager *fontFile) {
Common::Array<Graphics::MacFontFamily::AsscEntry> *assoc = fontFamily->getAssocTable();
for (uint i = 0; i < assoc->size(); i++) {
- debug(8, "size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle,
+ debug(8, "size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant,
(*assoc)[i]._fontID);
Common::SeekableReadStream *fontstream;
@@ -239,13 +266,13 @@ void MacFontManager::loadFonts(Common::MacResManager *fontFile) {
}
font = new Graphics::MacFONTFont;
- font->loadFont(*fontstream, fontFamily, (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
+ font->loadFont(*fontstream, fontFamily, (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant);
delete fontstream;
- Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle, (*assoc)[i]._fontSize);
+ Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle | familySlant, (*assoc)[i]._fontSize);
- macfont = new MacFont(_fontIds.getVal(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
+ macfont = new MacFont(_fontIds.getVal(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant);
FontMan.assignFontToName(fontName, font);
macfont->setFont(font);
@@ -359,17 +386,6 @@ const Common::String MacFontManager::getFontName(int id, int size, int slant, bo
n = fontNames[1]; // Fallback to Geneva
}
- if (tryGen && slant != kMacFontRegular) {
- for (int i = 0; i < 7; i++) {
- if (slant & (1 << i)) {
- n += ' ';
- n += fontStyleSuffixes[i + 1];
- }
- }
-
- slant = 0;
- }
-
return Common::String::format("%s-%d-%d", n.c_str(), slant, size);
}
Commit: 988daefade11f9e94579a29e53092cee00102384
https://github.com/scummvm/scummvm/commit/988daefade11f9e94579a29e53092cee00102384
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-16T15:53:19+02:00
Commit Message:
GRAPHICS: MACGUI: Parse slant in extra fonts too
Changed paths:
graphics/macgui/macfontmanager.cpp
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index f74d747..9a6b336 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -374,8 +374,11 @@ const Common::String MacFontManager::getFontName(int id, int size, int slant, bo
if (id == 3) // This is Geneva
id = 1;
+ int extraSlant = 0;
+
if (_extraFontNames.contains(id)) {
- n = _extraFontNames[id];
+ n = cleanFontName(_extraFontNames[id]);
+ extraSlant = parseFontSlant(_extraFontNames[id]);
} else if (id < ARRAYSIZE(fontNames)) {
if (fontNames[id])
n = fontNames[id];
@@ -386,7 +389,7 @@ const Common::String MacFontManager::getFontName(int id, int size, int slant, bo
n = fontNames[1]; // Fallback to Geneva
}
- return Common::String::format("%s-%d-%d", n.c_str(), slant, size);
+ return Common::String::format("%s-%d-%d", n.c_str(), slant | extraSlant, size);
}
const Common::String MacFontManager::getFontName(MacFont &font) {
@@ -433,7 +436,7 @@ void MacFontManager::generateFontSubstitute(MacFont &macFont) {
if (sizes.empty()) {
if (macFont.getSlant() == kMacFontRegular) {
- debug(1, "No viable substitute found for font %s", getFontName(macFont).c_str());
+ debug(1, "No viable substitute found (1) for font %s", getFontName(macFont).c_str());
return;
}
@@ -444,7 +447,7 @@ void MacFontManager::generateFontSubstitute(MacFont &macFont) {
}
if (sizes.empty()) {
- debug(1, "No viable substitute found for font %s", getFontName(macFont).c_str());
+ debug(1, "No viable substitute found (2) for font %s", getFontName(macFont).c_str());
return;
}
}
More information about the Scummvm-git-logs
mailing list