summaryrefslogtreecommitdiff
path: root/src/fontdetection.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-05 20:36:06 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-05 20:36:06 +0000
commit3569a4fe5a30397add710f90b2eee5ecd953cbab (patch)
treed9218f2a7e4820807a61e021003646752de78f2a /src/fontdetection.cpp
parent313cdb579ea3271a7d32f9413b83807df68f0971 (diff)
downloadopenttd-3569a4fe5a30397add710f90b2eee5ecd953cbab.tar.xz
(svn r25663) -Fix [FS#4857]: [OSX] Monospace font detection.
Diffstat (limited to 'src/fontdetection.cpp')
-rw-r--r--src/fontdetection.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/fontdetection.cpp b/src/fontdetection.cpp
index 51add9418..2a847933f 100644
--- a/src/fontdetection.cpp
+++ b/src/fontdetection.cpp
@@ -496,6 +496,8 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
if ((symbolic_traits & kCTFontClassMaskTrait) == (CTFontStylisticClass)kCTFontSymbolicClass || (symbolic_traits & kCTFontVerticalTrait)) continue;
/* Skip bold fonts (especially Arial Bold, which looks worse than regular Arial). */
if (symbolic_traits & kCTFontBoldTrait) continue;
+ /* Select monospaced fonts if asked for. */
+ if (((symbolic_traits & kCTFontMonoSpaceTrait) == kCTFontMonoSpaceTrait) != callback->Monospace()) continue;
/* Get font name. */
char name[128];
@@ -530,8 +532,13 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
CFStringRef font_name;
ATSFontGetName(font, kATSOptionFlagsDefault, &font_name);
CFStringGetCString(font_name, name, lengthof(name), kCFStringEncodingUTF8);
+
+ bool monospace = IsMonospaceFont(font_name);
CFRelease(font_name);
+ /* Select monospaced fonts if asked for. */
+ if (monospace != callback->Monospace()) continue;
+
/* We only want the base font and not bold or italic variants. */
if (strstr(name, "Italic") != NULL || strstr(name, "Bold")) continue;