--- old/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m 2020-05-21 13:54:19.000000000 -0700 +++ new/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m 2020-05-21 13:54:18.000000000 -0700 @@ -66,11 +66,32 @@ [super finalize]; } +static NSString* uiName = nil; +static NSString* uiBoldName = nil; + + (AWTFont *) awtFontForName:(NSString *)name style:(int)style { // create font with family & size - NSFont *nsFont = [NSFont fontWithName:name size:1.0]; + NSFont *nsFont = nil; + + if ((uiName != nil && [name isEqualTo:uiName]) || + (uiBoldName != nil && [name isEqualTo:uiBoldName])) { + if (style & java_awt_Font_BOLD) { + nsFont = [NSFont boldSystemFontOfSize:1.0]; + } else { + nsFont = [NSFont systemFontOfSize:1.0]; + } +#ifdef DEBUG + NSLog(@"nsFont-name is : %@", nsFont.familyName); + NSLog(@"nsFont-family is : %@", nsFont.fontName); + NSLog(@"nsFont-desc-name is : %@", nsFont.fontDescriptor.postscriptName); +#endif + + + } else { + nsFont = [NSFont fontWithName:name size:1.0]; + } if (nsFont == nil) { // if can't get font of that name, substitute system default font @@ -188,6 +209,12 @@ CFRelease(font); return; } + if (uiType == kCTFontUIFontSystem) { + uiName = (NSString*)name; + } + if (uiType == kCTFontUIFontEmphasizedSystem) { + uiBoldName = (NSString*)name; + } [allFonts addObject:name]; [fontFamilyTable setObject:family forKey:name]; #ifdef DEBUG @@ -242,7 +269,6 @@ */ addFont(kCTFontUIFontSystem, allFonts, fontFamilyTable); addFont(kCTFontUIFontEmphasizedSystem, allFonts, fontFamilyTable); - addFont(kCTFontUIFontUserFixedPitch, allFonts, fontFamilyTable); sFilteredFonts = allFonts; sFontFamilyTable = fontFamilyTable;