From 4ddf55428d06dddadfc8cd14baabdc4d17318ee2 Mon Sep 17 00:00:00 2001 From: Jose Pereda Date: Thu, 5 Dec 2019 20:13:53 +0000 Subject: [PATCH] 8234916: [macos 10.15] Garbled text running with native-image Reviewed-by: prr --- .../graphics/src/main/native-font/coretext.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/graphics/src/main/native-font/coretext.c b/modules/graphics/src/main/native-font/coretext.c index d84ba0fc1d..f02c626532 100644 --- a/modules/graphics/src/main/native-font/coretext.c +++ b/modules/graphics/src/main/native-font/coretext.c @@ -388,7 +388,15 @@ JNIEXPORT jlong JNICALL OS_NATIVE(CTFontCreateWithName) CGAffineTransform _arg2, *lparg2=NULL; jlong rc = 0; if (arg2) if ((lparg2 = getCGAffineTransformFields(env, arg2, &_arg2)) == NULL) goto fail; - rc = (jlong)CTFontCreateWithName((CFStringRef)arg0, (CGFloat)arg1, (CGAffineTransform*)lparg2); + CFStringRef fontName = (CFStringRef)arg0; + if (CFStringGetCharacterAtIndex(fontName, 0) == '.') { + bool bold = CFStringFind(fontName, CFSTR("bold"), kCFCompareCaseInsensitive).location != kCFNotFound; + CTFontRef font = CTFontCreateUIFontForLanguage(bold ? kCTFontUIFontEmphasizedSystem : kCTFontUIFontSystem, 0.0, NULL); + rc = (jlong) CTFontCreateCopyWithAttributes(font, (CGFloat)arg1, (CGAffineTransform*)lparg2, NULL); + CFRelease(font); + } else { + rc = (jlong) CTFontCreateWithName(fontName, (CGFloat)arg1, (CGAffineTransform*)lparg2); + } fail: /* In only */ // if (arg2 && lparg2) setCGAffineTransformFields(env, arg2, lparg2); -- 2.30.1 (Apple Git-130)