diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-01-14 11:08:56 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-01-14 14:46:15 -0800 |
commit | 15caf0fd6362c525adc0502696226801c6622b1c (patch) | |
tree | be3b2d269084f02285c48e711733f230d5814642 /platform/darwin | |
parent | bc0c8043d2f27df1c6be04f49a3563b9879bce15 (diff) | |
download | qtlocation-mapboxgl-15caf0fd6362c525adc0502696226801c6622b1c.tar.gz |
[ios, macos] Default to system font for attribution titles
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/src/MGLAttributionInfo.mm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLAttributionInfo.mm b/platform/darwin/src/MGLAttributionInfo.mm index cf7b3cb22f..2546808b34 100644 --- a/platform/darwin/src/MGLAttributionInfo.mm +++ b/platform/darwin/src/MGLAttributionInfo.mm @@ -26,9 +26,20 @@ // Apply a bogus, easily detectable style rule to any feedback link, since // NSAttributedString doesn’t preserve the class attribute. NSMutableString *css = [NSMutableString stringWithString: + @"html { font-family: -apple-system, -apple-system-font, sans-serif; }" @".mapbox-improve-map { -webkit-text-stroke-width: 1000px; }"]; if (fontSize) { - [css appendFormat:@"html { font-size: %.1fpx; }", fontSize]; + NSString *sizeRule = [NSString stringWithFormat:@"font-size: %.1fpx;", fontSize]; +#if !TARGET_OS_IPHONE + if (fontSize == [NSFont systemFontSizeForControlSize:NSMiniControlSize]) { + sizeRule = @"font: -webkit-mini-control"; + } else if (fontSize == [NSFont systemFontSizeForControlSize:NSSmallControlSize]) { + sizeRule = @"font: -webkit-small-control"; + } else if (fontSize == [NSFont systemFontSizeForControlSize:NSRegularControlSize]) { + sizeRule = @"font: -webkit-control"; + } +#endif + [css appendFormat:@"html { %@ }", sizeRule]; } if (linkColor) { CGFloat red; |