From 13de47db269daee156c00f7d2d954e780a9e842a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Thu, 23 Apr 2020 17:00:47 -0700 Subject: [ios, macos] Match only one font name attribute at a time --- platform/darwin/src/local_glyph_rasterizer.mm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/platform/darwin/src/local_glyph_rasterizer.mm b/platform/darwin/src/local_glyph_rasterizer.mm index 974f75b7b4..c9e0b960a2 100644 --- a/platform/darwin/src/local_glyph_rasterizer.mm +++ b/platform/darwin/src/local_glyph_rasterizer.mm @@ -129,12 +129,10 @@ public: for (NSString *name in [fontNames subarrayWithRange:NSMakeRange(1, fontNames.count - 1)]) { NSDictionary *fontAttributes = @{ (NSString *)kCTFontSizeAttribute: @(util::ONE_EM), - // The name could be any of these three attributes of the font. - // It’s OK if it doesn’t match all three; Core Text will pick - // the font that matches the most attributes. + // This attribute is technically supposed to be a font’s + // PostScript name, but Core Text will fall back to matching + // font display names and font family names. (NSString *)kCTFontNameAttribute: name, - (NSString *)kCTFontDisplayNameAttribute: name, - (NSString *)kCTFontFamilyNameAttribute: name, }; CTFontDescriptorRefHandle descriptor(CTFontDescriptorCreateWithAttributes((CFDictionaryRef)fontAttributes)); @@ -143,12 +141,12 @@ public: CFStringRef keys[] = { kCTFontSizeAttribute, - kCTFontNameAttribute, kCTFontDisplayNameAttribute, kCTFontFamilyNameAttribute, + kCTFontNameAttribute, kCTFontCascadeListAttribute, }; CFTypeRef values[] = { (__bridge CFNumberRef)@(util::ONE_EM), - mainFontName, mainFontName, mainFontName, + mainFontName, *fallbackDescriptors, }; -- cgit v1.2.1