Tk Source Code

Check-in [8373c21f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Work around a bug in [NSFont familyName] which Apple introduced in macOS 10.15.1
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-855049e799
Files: files | file ages | folders
SHA3-256: 8373c21f6d01a3fcdf03f3a5aaf13088c0c3049ac7056b77b2fdcd86a6785115
User & Date: marc_culler 2019-11-01 18:44:14.520
Context
2019-11-03
23:02
Use [NSFont userFixedPitchFontOfSize:11] instead of CTFontCreateUIFontForLanguage(fixedPitch, 11, NULL) to get a valid fixed pitch font. Closed-Leaf check-in: c7ede02a user: marc_culler tags: bug-855049e799
2019-11-01
18:44
Work around a bug in [NSFont familyName] which Apple introduced in macOS 10.15.1 check-in: 8373c21f user: marc_culler tags: bug-855049e799
2019-10-14
13:04
3 minor doc fixes. check-in: a7e6bbfb user: jan.nijtmans tags: core-8-6-branch
Changes
Unified Diff Ignore Whitespace Patch
Changes to macosx/tkMacOSXFont.c.
124
125
126
127
128
129
130

131










132

133
134
135

136
137
138
139
140
141
142
static void
GetTkFontAttributesForNSFont(
    NSFont *nsFont,
    TkFontAttributes *faPtr)
{
    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);

}

/*
 *---------------------------------------------------------------------------
 *
 * FindNSFont --
 *







>
|
>
>
>
>
>
>
>
>
>
>
|
>



>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
static void
GetTkFontAttributesForNSFont(
    NSFont *nsFont,
    TkFontAttributes *faPtr)
{
    NSFontTraitMask traits = [[NSFontManager sharedFontManager]
	    traitsOfFont:nsFont];
    char *family = [[nsFont familyName] UTF8String];
    
    /* 
     * Workaround for a bug in Catalina 15.1.  The familyName method can prefix
     * the font name with ".SF " and the font manager will refuse to accept
     * that name when searching for the font.  As a workaround, if the name
     * starts with ".SF " we remove that prefix.
     */

    if (strncmp(family, ".SF ", 4) == 0) {
	faPtr->family = Tk_GetUid(family + 4);
    } else {
	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);

}

/*
 *---------------------------------------------------------------------------
 *
 * FindNSFont --
 *