From d8f700c105b9b85d543d6fb6d7133a00235c1b3b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 5 Oct 2016 23:31:04 +0200 Subject: GRAPHICS: Use Face Name for Mac fonts if they're specified. Allows to avoid situations with files named "NewYork" with "New York" font inside. --- graphics/macgui/macwindowmanager.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'graphics/macgui/macwindowmanager.cpp') diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp index 9e40c368dc..f0f821d313 100644 --- a/graphics/macgui/macwindowmanager.cpp +++ b/graphics/macgui/macwindowmanager.cpp @@ -347,15 +347,20 @@ void MacWindowManager::loadFonts() { delete stream; - Common::String fontName = (*it)->getName(); - - // Trim the .bdf extension - for (int i = fontName.size() - 1; i >= 0; --i) { - if (fontName[i] == '.') { - while ((uint)i < fontName.size()) { - fontName.deleteLastChar(); + Common::String fontName; + if (font->getFaceName() && *font->getFaceName()) { + fontName = font->getFaceName(); + } else { // Get it from the file name + fontName = (*it)->getName(); + + // Trim the .bdf extension + for (int i = fontName.size() - 1; i >= 0; --i) { + if (fontName[i] == '.') { + while ((uint)i < fontName.size()) { + fontName.deleteLastChar(); + } + break; } - break; } } -- cgit v1.2.3