summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2019-11-04 15:29:24 (GMT)
committerculler <culler>2019-11-04 15:29:24 (GMT)
commit5ad049760c08cb41250b778342c54c5a897cdcde (patch)
tree8edfd96547963800342c94fd2038403d7668faab /macosx
parent19e72587e7d675d197daecdb202e28b64e428992 (diff)
parent09fe4a9aaf45f55440dcd7af939040cc492c8acc (diff)
downloadtk-5ad049760c08cb41250b778342c54c5a897cdcde.zip
tk-5ad049760c08cb41250b778342c54c5a897cdcde.tar.gz
tk-5ad049760c08cb41250b778342c54c5a897cdcde.tar.bz2
Fix [855049e799]: Apple's system fixed font has an invalid familyName in macOS 10.15.1
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXFont.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index e68b09f..23a3cb8 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -128,11 +128,11 @@ GetTkFontAttributesForNSFont(
{
NSFontTraitMask traits = [[NSFontManager sharedFontManager]
traitsOfFont:nsFont];
-
faPtr->family = Tk_GetUid([[nsFont familyName] UTF8String]);
faPtr->size = [nsFont pointSize];
faPtr->weight = (traits & NSBoldFontMask ? TK_FW_BOLD : TK_FW_NORMAL);
faPtr->slant = (traits & NSItalicFontMask ? TK_FS_ITALIC : TK_FS_ROMAN);
+
}
/*
@@ -394,7 +394,17 @@ TkpFontPkgInit(
systemFont++;
}
TkInitFontAttributes(&fa);
+#if 0
+ /*
+ * In macOS 10.15.1 a bug was introduced which caused the call below to
+ * return a font with the invalid familyName ".SF NS Mono" instead of the
+ * valid familyName "NS Mono". Calling [NSFont userFixedPitchFontOfSize:11]
+ * returns a font in the "Menlo" family which has a valid familyName.
+ */
nsFont = (NSFont*) CTFontCreateUIFontForLanguage(fixedPitch, 11, NULL);
+#else
+ nsFont = [NSFont userFixedPitchFontOfSize:11];
+#endif
if (nsFont) {
GetTkFontAttributesForNSFont(nsFont, &fa);
CFRelease(nsFont);