aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-10-07 10:37:40 +0200
committerEugene Sandulenko2016-10-07 10:49:17 +0200
commitdb05a9448bafe4d5eaacb9d2b5a7e6e936997211 (patch)
tree44e79e08fc62f25017586a66ea0211f325f0d44c
parentee476e9cf0ee1dec3161ef3bed87be12ca9786f1 (diff)
downloadscummvm-rg350-db05a9448bafe4d5eaacb9d2b5a7e6e936997211.tar.gz
scummvm-rg350-db05a9448bafe4d5eaacb9d2b5a7e6e936997211.tar.bz2
scummvm-rg350-db05a9448bafe4d5eaacb9d2b5a7e6e936997211.zip
GRAPHICS: Differentiate Mac fonts by slant
-rw-r--r--graphics/macgui/macfontmanager.cpp20
-rw-r--r--graphics/macgui/macfontmanager.h8
2 files changed, 24 insertions, 4 deletions
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 7bdb8a937e..03fcb41f91 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -56,7 +56,7 @@ void MacFontManager::loadFonts() {
Common::String fontName;
if (font->getFamilyName() && *font->getFamilyName()) {
- fontName = Common::String::format("%s-%d", font->getFamilyName(), font->getFontSize());
+ fontName = Common::String::format("%s-%s-%d", font->getFamilyName(), font->getFontSlant(), font->getFontSize());
} else { // Get it from the file name
fontName = (*it)->getName();
@@ -147,13 +147,27 @@ static const char *const fontNames[] = {
"New Century Schoolbook"
};
-const char *MacFontManager::getFontName(int id, int size) {
+const char *MacFontManager::getFontName(int id, int size, int slant) {
static char name[128];
+ const char *sslant;
+
+ switch (slant) {
+ case kMacFontItalic:
+ sslant = "I";
+ break;
+ case kMacFontBold:
+ sslant = "B";
+ break;
+ case kMacFontRegular:
+ default:
+ sslant = "R";
+ break;
+ }
if (id > ARRAYSIZE(fontNames))
return NULL;
- snprintf(name, 128, "%s-%d", fontNames[id], size);
+ snprintf(name, 128, "%s-%s-%d", fontNames[id], sslant, size);
return name;
}
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index fab4ce9ea1..568c1530c0 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -31,6 +31,12 @@ enum {
kMacFontChicago = 0
};
+enum {
+ kMacFontRegular,
+ kMacFontBold,
+ kMacFontItalic
+};
+
class MacFont {
public:
MacFont(int id = kMacFontChicago, int size = 12, FontManager::FontUsage fallback = Graphics::FontManager::kBigGUIFont) {
@@ -79,7 +85,7 @@ private:
* @param size size of the font
* @return the font name or NULL if ID goes beyond the mapping
*/
- const char *getFontName(int id, int size);
+ const char *getFontName(int id, int size, int slant = kMacFontRegular);
private:
bool _builtInFonts;