[Scummvm-git-logs] scummvm master -> f599c8ab50b464e95f10ea209f2f8d7354c8a50e
sev-
sev at scummvm.org
Wed Jan 18 19:12:04 CET 2017
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:
0b3d7d3e4f GRAPHICS: Further work on MacFont loading
f599c8ab50 GRAPHICS: Fix font name generation for MacFonts
Commit: 0b3d7d3e4f1c776575d295d6fef9ff971aa3790e
https://github.com/scummvm/scummvm/commit/0b3d7d3e4f1c776575d295d6fef9ff971aa3790e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-18T18:59:52+01:00
Commit Message:
GRAPHICS: Further work on MacFont loading
Changed paths:
graphics/macgui/macfontmanager.cpp
graphics/macgui/macfontmanager.h
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index ee91ae4..dfb46d1 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -129,7 +129,7 @@ void MacFontManager::loadFontsBDF() {
}
FontMan.assignFontToName(fontName, font);
- macfont->setBdfFont(font);
+ macfont->setFont(font);
_fontRegistry.setVal(fontName, macfont);
debug(2, " %s", fontName.c_str());
@@ -177,26 +177,30 @@ void MacFontManager::loadFonts() {
debug("size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle,
(*assoc)[i]._fontID);
- Common::SeekableReadStream *fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID);
+ Common::SeekableReadStream *fontstream;
MacFont *macfont;
Graphics::MacFONTFont *font;
Common::String fontName;
- if (fontstream) {
- font = new Graphics::MacFONTFont;
- font->loadFont(*fontstream);
-
- delete fontstream;
-
+ if ((fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID))) {
fontName = fontFile->getResName(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID);
+ } else if ((fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID))) {
+ fontName = fontFile->getResName(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
} else {
- fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
+ warning("Unknown FontId: %d", (*assoc)[i]._fontID);
+
+ continue;
}
+ font = new Graphics::MacFONTFont;
+ font->loadFont(*fontstream);
+
+ delete fontstream;
+
macfont = new MacFont(_fontNames.getVal(fontName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
FontMan.assignFontToName(fontName, font);
- //macfont->setBdfFont(font);
+ macfont->setFont(font);
_fontRegistry.setVal(fontName, macfont);
debug(2, " %s", fontName.c_str());
@@ -347,14 +351,14 @@ void MacFontManager::generateFont(MacFont &toFont, MacFont &fromFont) {
debugN("Found font substitute for font '%s' ", getFontName(toFont));
debug("as '%s'", getFontName(fromFont));
- Graphics::BdfFont *font = Graphics::BdfFont::scaleFont(fromFont.getBdfFont(), toFont.getSize());
+ Graphics::BdfFont *font = NULL; // = Graphics::BdfFont::scaleFont(fromFont.getFont(), toFont.getSize());
if (!font) {
warning("Failed to generate font '%s'", getFontName(toFont));
}
toFont.setGenerated(true);
- toFont.setBdfFont(font);
+ toFont.setFont(font);
FontMan.assignFontToName(getFontName(toFont), font);
_fontRegistry.setVal(getFontName(toFont), new MacFont(toFont));
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index 117e884..bfec6b7 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -57,7 +57,7 @@ enum {
kMacFontExtend = 64
};
-class BdfFont;
+class Font;
class MacFont {
public:
@@ -67,7 +67,7 @@ public:
_slant = slant;
_fallback = fallback;
_generated = false;
- _bdfFont = NULL;
+ _font = NULL;
}
int getId() { return _id; };
@@ -79,8 +79,8 @@ public:
FontManager::FontUsage getFallback() { return _fallback; }
bool isGenerated() { return _generated; }
void setGenerated(bool gen) { _generated = gen; }
- BdfFont *getBdfFont() { return _bdfFont; }
- void setBdfFont(BdfFont *bdfFont) { _bdfFont = bdfFont; }
+ Font *getFont() { return _font; }
+ void setFont(Font *font) { _font = font; }
private:
int _id;
@@ -90,7 +90,7 @@ private:
FontManager::FontUsage _fallback;
bool _generated;
- BdfFont *_bdfFont;
+ Font *_font;
};
class MacFontManager {
Commit: f599c8ab50b464e95f10ea209f2f8d7354c8a50e
https://github.com/scummvm/scummvm/commit/f599c8ab50b464e95f10ea209f2f8d7354c8a50e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-18T19:13:01+01:00
Commit Message:
GRAPHICS: Fix font name generation for MacFonts
Changed paths:
graphics/macgui/macfontmanager.cpp
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index dfb46d1..73f3d2b 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -168,6 +168,8 @@ void MacFontManager::loadFonts() {
for (Common::Array<uint16>::iterator iterator = fonds.begin(); iterator != fonds.end(); ++iterator) {
Common::SeekableReadStream *fond = fontFile->getResource(MKTAG('F', 'O', 'N', 'D'), *iterator);
+ Common::String familyName = fontFile->getResName(MKTAG('F', 'O', 'N', 'D'), *iterator);
+
Graphics::MacFontFamily fontFamily;
fontFamily.load(*fond);
@@ -180,13 +182,13 @@ void MacFontManager::loadFonts() {
Common::SeekableReadStream *fontstream;
MacFont *macfont;
Graphics::MacFONTFont *font;
- Common::String fontName;
- if ((fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID))) {
- fontName = fontFile->getResName(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID);
- } else if ((fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID))) {
- fontName = fontFile->getResName(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
- } else {
+ fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID);
+
+ if (!fontstream)
+ fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
+
+ if (!fontstream) {
warning("Unknown FontId: %d", (*assoc)[i]._fontID);
continue;
@@ -197,6 +199,8 @@ void MacFontManager::loadFonts() {
delete fontstream;
+ Common::String fontName = Common::String::format("%s-%d", familyName.c_str(), (*assoc)[i]._fontSize);
+
macfont = new MacFont(_fontNames.getVal(fontName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle);
FontMan.assignFontToName(fontName, font);
@@ -351,7 +355,7 @@ void MacFontManager::generateFont(MacFont &toFont, MacFont &fromFont) {
debugN("Found font substitute for font '%s' ", getFontName(toFont));
debug("as '%s'", getFontName(fromFont));
- Graphics::BdfFont *font = NULL; // = Graphics::BdfFont::scaleFont(fromFont.getFont(), toFont.getSize());
+ Font *font = fromFont.getFont(); // = Graphics::BdfFont::scaleFont(fromFont.getFont(), toFont.getSize());
if (!font) {
warning("Failed to generate font '%s'", getFontName(toFont));
More information about the Scummvm-git-logs
mailing list