Skip to content

Commit 98bc41a

Browse files
committed
SDL: update font handling on osx
1 parent 2368d87 commit 98bc41a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/platform/sdl/main.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,26 @@ bool getFontFiles(const char *familyName, String &fontFile, String &fontFileBold
106106
}
107107
return true;
108108
}
109+
#elif defined(__MACH__)
110+
bool getFontFiles(const char *familyName, String &fontFile, String &fontFileBold) {
111+
fontFile = "Envy Code R.ttf";
112+
fontFileBold = "Envy Code R Bold.ttf";
113+
if (access(fontFile.c_str(), 0) != 0) {
114+
fontFile = "SourceCodePro-Regular.ttf";
115+
fontFileBold = "SourceCodePro-Bold.ttf";
116+
}
117+
if ((familyName != NULL && strcasecmp(familyName, "andale") == 0)
118+
|| access(fontFile.c_str(), 0) != 0) {
119+
fontFile = "/Library/Fonts/Andale Mono.ttf";
120+
fontFileBold = "/Library/Fonts/Andale Mono.ttf";
121+
}
122+
if ((familyName != NULL && strcasecmp(familyName, "courier") == 0)
123+
|| access(fontFile.c_str(), 0) != 0) {
124+
fontFile = "/Library/Fonts/Courier New.ttf";
125+
fontFileBold = "/Library/Fonts/Courier New Bold.ttf";
126+
}
127+
return true;
128+
}
109129
#else
110130
bool getFont(FcFontSet *fs, const char *familyName, int fontWeight, String &name) {
111131
bool result = false;

0 commit comments

Comments
 (0)