summaryrefslogtreecommitdiff
path: root/src/os
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/os
parent313cdb579ea3271a7d32f9413b83807df68f0971 (diff)
downloadopenttd-3569a4fe5a30397add710f90b2eee5ecd953cbab.tar.xz
(svn r25663) -Fix [FS#4857]: [OSX] Monospace font detection.
Diffstat (limited to 'src/os')
-rw-r--r--src/os/macosx/macos.h2
-rw-r--r--src/os/macosx/macos.mm12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/os/macosx/macos.h b/src/os/macosx/macos.h
index 16f34a3dc..1e6729f12 100644
--- a/src/os/macosx/macos.h
+++ b/src/os/macosx/macos.h
@@ -36,4 +36,6 @@ static inline bool MacOSVersionIsAtLeast(long major, long minor, long bugfix)
return true;
}
+bool IsMonospaceFont(CFStringRef name);
+
#endif /* MACOS_H */
diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm
index 38ddae8ee..1b1a1d5a7 100644
--- a/src/os/macosx/macos.mm
+++ b/src/os/macosx/macos.mm
@@ -193,3 +193,15 @@ uint GetCPUCoreCount()
return count;
}
+
+/**
+ * Check if a font is a monospace font.
+ * @param name Name of the font.
+ * @return True if the font is a monospace font.
+ */
+bool IsMonospaceFont(CFStringRef name)
+{
+ NSFont *font = [ NSFont fontWithName:(NSString *)name size:0.0f ];
+
+ return font != NULL ? [ font isFixedPitch ] : false;
+}