summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2020-03-18 16:00:06 -0700
committerMinh Nguyễn <mxn@1ec5.org>2020-04-24 13:46:40 -0700
commit9b78a156de79beb89dd86b484c326c68682dc79f (patch)
tree83ada59f9bb7f4367bba726ce6e595773c6804f3
parentf97ca0ccf9c875c5a5e0d26864e381c8de47ddcb (diff)
downloadqtlocation-mapboxgl-9b78a156de79beb89dd86b484c326c68682dc79f.tar.gz
[ios, macos] Take font family names from user defaults
Take font family names from user defaults before falling back to font family names in Info.plist.
-rw-r--r--platform/darwin/src/local_glyph_rasterizer.mm13
1 files changed, 8 insertions, 5 deletions
diff --git a/platform/darwin/src/local_glyph_rasterizer.mm b/platform/darwin/src/local_glyph_rasterizer.mm
index 78f7d74428..bbbb482969 100644
--- a/platform/darwin/src/local_glyph_rasterizer.mm
+++ b/platform/darwin/src/local_glyph_rasterizer.mm
@@ -65,12 +65,15 @@ public:
}
CTFontRef getFont() {
- if (!fontFamily) {
- return NULL;
- }
-
if (!fontHandle) {
- NSArray<NSString *> *fontFamilyNames = [@(fontFamily->c_str()) componentsSeparatedByString:@"\n"];
+ NSArray<NSString *> *fontFamilyNames = [[NSUserDefaults standardUserDefaults] stringArrayForKey:@"MGLIdeographicFontFamilyName"] ?: @[];
+ if (fontFamily) {
+ fontFamilyNames = [fontFamilyNames arrayByAddingObjectsFromArray:[@(fontFamily->c_str()) componentsSeparatedByString:@"\n"]];
+ }
+ if (!fontFamilyNames.count) {
+ return NULL;
+ }
+
CFMutableArrayRefHandle fontDescriptors(CFArrayCreateMutable(kCFAllocatorDefault, fontFamilyNames.count, &kCFTypeArrayCallBacks));
for (NSString *name in fontFamilyNames) {
NSDictionary *fontAttributes = @{