diff --git a/engines/director/tests.cpp b/engines/director/tests.cpp index de6cc37cb06..36dfbc1552a 100644 --- a/engines/director/tests.cpp +++ b/engines/director/tests.cpp @@ -154,7 +154,7 @@ void Window::testFonts() { debug("Font: %s", name.c_str()); - Graphics::MacFontFamily font; + Graphics::MacFontFamily font(name); font.load(*stream); } } diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 7183b144385..e728009454e 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -1551,7 +1551,7 @@ CharsetRendererMac::CharsetRendererMac(ScummEngine *vm, const Common::String &fo if (!fond) return; - Graphics::MacFontFamily fontFamily; + Graphics::MacFontFamily fontFamily(fontFamilyName); if (!fontFamily.load(*fond)) { delete fond; return; diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp index 92b9a6d48db..61b930279bf 100644 --- a/graphics/fonts/macfont.cpp +++ b/graphics/fonts/macfont.cpp @@ -64,7 +64,9 @@ static int getDepth(uint16 _fontType) { return 1 << ((_fontType >> 2) & 3); } -MacFontFamily::MacFontFamily() { +MacFontFamily::MacFontFamily(const Common::String &name) { + _name = name; + _ffFlags = 0; _ffFamID = 0; _ffFirstChar = 0; diff --git a/graphics/fonts/macfont.h b/graphics/fonts/macfont.h index f54312aa9d9..f04b33b5f3d 100644 --- a/graphics/fonts/macfont.h +++ b/graphics/fonts/macfont.h @@ -33,7 +33,7 @@ namespace Graphics { class MacFontFamily { public: - MacFontFamily(); + MacFontFamily(const Common::String &name); ~MacFontFamily(); bool load(Common::SeekableReadStream &stream); @@ -46,9 +46,13 @@ public: uint16 _fontID; }; + const Common::String &getName() { return _name; } + uint16 getFontFamilyId() { return _ffFamID; } Common::Array *getAssocTable() { return &_ffAssocEntries; } private: + Common::String _name; + // FOND uint16 _ffFlags; uint16 _ffFamID; diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp index 667b9a8a633..324fa1caf6a 100644 --- a/graphics/macgui/macfontmanager.cpp +++ b/graphics/macgui/macfontmanager.cpp @@ -367,7 +367,7 @@ void MacFontManager::loadFonts(Common::MacResManager *fontFile) { familyName = cleanFontName(familyName); } - Graphics::MacFontFamily *fontFamily = new MacFontFamily(); + Graphics::MacFontFamily *fontFamily = new MacFontFamily(familyName); fontFamily->load(*fond); Common::Array *assoc = fontFamily->getAssocTable(); diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h index f7ff03a2877..06c6fa8f86e 100644 --- a/graphics/macgui/macfontmanager.h +++ b/graphics/macgui/macfontmanager.h @@ -170,6 +170,8 @@ public: void forceBuiltinFonts() { _builtInFonts = true; } int parseSlantFromName(const Common::String &name); + const Common::Array &getFontFamilies() { return _fontFamilies; } + private: void loadFontsBDF(); void loadFonts();