From 1a7ed927f043cc14efc535a6960b2cffb834a392 Mon Sep 17 00:00:00 2001 From: Giemsa Date: Fri, 29 Jun 2018 04:31:04 +0900 Subject: [PATCH] Fix: failed to select some fonts on high sierra --- src/MacVim/MMCoreTextView.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/MacVim/MMCoreTextView.m b/src/MacVim/MMCoreTextView.m index fa4156574b..0e4a19bfce 100644 --- a/src/MacVim/MMCoreTextView.m +++ b/src/MacVim/MMCoreTextView.m @@ -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];