Fix: failed to select some fonts on high sierra

This commit is contained in:
Giemsa
2018-06-29 04:31:04 +09:00
parent ea32277f0e
commit 1a7ed927f0
+2 -6
View File
@@ -294,11 +294,7 @@ defaultAdvanceForFont(NSFont *font)
double em = round(defaultAdvanceForFont(newFont));
double pt = round([newFont pointSize]);
NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys:
[newFont displayName], (NSString*)kCTFontNameAttribute,
[NSNumber numberWithFloat:pt], (NSString*)kCTFontSizeAttribute, nil];
CTFontDescriptorRef desc = CTFontDescriptorCreateWithAttributes(
(CFDictionaryRef)attr);
CTFontDescriptorRef desc = CTFontDescriptorCreateWithNameAndSize((CFStringRef)[newFont fontName], pt);
CTFontRef fontRef = CTFontCreateWithFontDescriptor(desc, pt, NULL);
CFRelease(desc);
@@ -787,7 +783,7 @@ defaultAdvanceForFont(NSFont *font)
NSFont *newFont = [sender convertFont:font];
if (newFont) {
NSString *name = [newFont displayName];
NSString *name = [newFont fontName];
unsigned len = [name lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (len > 0) {
NSMutableData *data = [NSMutableData data];