< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m

Print this page

        

*** 191,200 **** --- 191,238 ---- GetFamilyNameForFontName(NSString* fontname) { return [sFontFamilyTable objectForKey:fontname]; } + static void addFont(CTFontUIFontType uiType, + NSMutableArray *allFonts, + NSMutableDictionary* fontFamilyTable) { + + CTFontRef font = CTFontCreateUIFontForLanguage(uiType, 0.0, NULL); + if (font == NULL) { + return; + } + CTFontDescriptorRef desc = CTFontCopyFontDescriptor(font); + if (desc == NULL) { + CFRelease(font); + return; + } + CFStringRef family = CTFontDescriptorCopyAttribute(desc, kCTFontFamilyNameAttribute); + if (family == NULL) { + CFRelease(font); + CFRelease(desc); + return; + } + CFStringRef name = CTFontDescriptorCopyAttribute(desc, kCTFontNameAttribute); + if (name == NULL) { + CFRelease(family); + CFRelease(font); + CFRelease(desc); + return; + } + [allFonts addObject:name]; + [fontFamilyTable setObject:family forKey:name]; + #ifdef DEBUG + NSLog(@"name is : %@", (NSString*)name); + NSLog(@"family is : %@", (NSString*)family); + #endif + CFRelease(family); + CFRelease(name); + CFRelease(desc); + CFRelease(font); + } + static NSArray* GetFilteredFonts() { if (sFilteredFonts == nil) { NSFontManager *fontManager = [NSFontManager sharedFontManager];
*** 225,234 **** --- 263,282 ---- [fontFamilyTable setObject:family forKey:face]; } } } + /* + * JavaFX registers these fonts and so JDK needs to do so as well. + * If this isn't done we will have mis-matched rendering, since + * although these may include fonts that are enumerated normally + * they also demonstrably includes fonts that are not. + */ + addFont(kCTFontUIFontSystem, allFonts, fontFamilyTable); + addFont(kCTFontUIFontEmphasizedSystem, allFonts, fontFamilyTable); + addFont(kCTFontUIFontUserFixedPitch, allFonts, fontFamilyTable); + sFilteredFonts = allFonts; sFontFamilyTable = fontFamilyTable; } return sFilteredFonts;
< prev index next >