8244621: [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11
Reviewed-by: kcr, psadhukhan
This commit is contained in:
parent
5aea3f0250
commit
2048bcb648
@ -66,11 +66,32 @@
|
|||||||
[super finalize];
|
[super finalize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NSString* uiName = nil;
|
||||||
|
static NSString* uiBoldName = nil;
|
||||||
|
|
||||||
+ (AWTFont *) awtFontForName:(NSString *)name
|
+ (AWTFont *) awtFontForName:(NSString *)name
|
||||||
style:(int)style
|
style:(int)style
|
||||||
{
|
{
|
||||||
// create font with family & size
|
// 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 (nsFont == nil) {
|
||||||
// if can't get font of that name, substitute system default font
|
// if can't get font of that name, substitute system default font
|
||||||
@ -188,6 +209,12 @@ static void addFont(CTFontUIFontType uiType,
|
|||||||
CFRelease(font);
|
CFRelease(font);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (uiType == kCTFontUIFontSystem) {
|
||||||
|
uiName = (NSString*)name;
|
||||||
|
}
|
||||||
|
if (uiType == kCTFontUIFontEmphasizedSystem) {
|
||||||
|
uiBoldName = (NSString*)name;
|
||||||
|
}
|
||||||
[allFonts addObject:name];
|
[allFonts addObject:name];
|
||||||
[fontFamilyTable setObject:family forKey:name];
|
[fontFamilyTable setObject:family forKey:name];
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -242,7 +269,6 @@ GetFilteredFonts()
|
|||||||
*/
|
*/
|
||||||
addFont(kCTFontUIFontSystem, allFonts, fontFamilyTable);
|
addFont(kCTFontUIFontSystem, allFonts, fontFamilyTable);
|
||||||
addFont(kCTFontUIFontEmphasizedSystem, allFonts, fontFamilyTable);
|
addFont(kCTFontUIFontEmphasizedSystem, allFonts, fontFamilyTable);
|
||||||
addFont(kCTFontUIFontUserFixedPitch, allFonts, fontFamilyTable);
|
|
||||||
|
|
||||||
sFilteredFonts = allFonts;
|
sFilteredFonts = allFonts;
|
||||||
sFontFamilyTable = fontFamilyTable;
|
sFontFamilyTable = fontFamilyTable;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user