diff options
author | Eugene Sandulenko | 2017-01-18 19:13:01 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-01-18 19:13:01 +0100 |
commit | f599c8ab50b464e95f10ea209f2f8d7354c8a50e (patch) | |
tree | d815fc1ec8145a8cad50bc09700488da7ca4abc3 /graphics/macgui | |
parent | 0b3d7d3e4f1c776575d295d6fef9ff971aa3790e (diff) | |
download | scummvm-rg350-f599c8ab50b464e95f10ea209f2f8d7354c8a50e.tar.gz scummvm-rg350-f599c8ab50b464e95f10ea209f2f8d7354c8a50e.tar.bz2 scummvm-rg350-f599c8ab50b464e95f10ea209f2f8d7354c8a50e.zip |
GRAPHICS: Fix font name generation for MacFonts
Diffstat (limited to 'graphics/macgui')
-rw-r--r-- | graphics/macgui/macfontmanager.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp index dfb46d1240..73f3d2b81e 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)); |