(svn r25663) -Fix [FS#4857]: [OSX] Monospace font detection.

This commit is contained in:
michi_cc
2013-08-05 20:36:06 +00:00
parent 313cdb579e
commit 3569a4fe5a
3 changed files with 21 additions and 0 deletions

View File

@@ -36,4 +36,6 @@ static inline bool MacOSVersionIsAtLeast(long major, long minor, long bugfix)
return true;
}
bool IsMonospaceFont(CFStringRef name);
#endif /* MACOS_H */

View File

@@ -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;
}