summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2020-04-23 17:00:47 -0700
committerMinh Nguyễn <mxn@1ec5.org>2020-04-24 13:46:40 -0700
commit13de47db269daee156c00f7d2d954e780a9e842a (patch)
tree0e48f0d1bf15cc6250f9085dce8fdb929f1ab2ff
parent95483659046532ac2912f26babcf20fd3e32e4fa (diff)
downloadqtlocation-mapboxgl-13de47db269daee156c00f7d2d954e780a9e842a.tar.gz
[ios, macos] Match only one font name attribute at a time
-rw-r--r--platform/darwin/src/local_glyph_rasterizer.mm12
1 files 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,
};