diff options
author | m-stephen <truestyle2005@163.com> | 2019-09-05 02:29:05 +0800 |
---|---|---|
committer | Jason Wray <friedbunny@users.noreply.github.com> | 2019-09-04 11:29:05 -0700 |
commit | b07217bbdd435b378e8a492c5f535d3e892fa82e (patch) | |
tree | 2566269afe4502790ab1996f3294402b913353a3 /platform/ios | |
parent | 71ea9495fddf2d2daf62d65b1e0948fdb3ff58cd (diff) | |
download | qtlocation-mapboxgl-b07217bbdd435b378e8a492c5f535d3e892fa82e.tar.gz |
[ios] Fix compass font weight being too light on iOS 13
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/CHANGELOG.md | 3 | ||||
-rw-r--r-- | platform/ios/src/MGLCompassButton.mm | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 53afaccfe5..b8c33716f9 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -8,7 +8,8 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed a bug with annotation view positions after camera transitions. ([#15122](https://github.com/mapbox/mapbox-gl-native/pull/15122/)) * Fixed a rendering issue of `collisionBox` when `text-translate` or `icon-translate` is enabled. ([#15467](https://github.com/mapbox/mapbox-gl-native/pull/15467)) * Fixed an issue where the scale bar text would become illegible if iOS 13 dark mode was enabled. ([#15524](https://github.com/mapbox/mapbox-gl-native/pull/15524)) - * Enable using of `text-offset` option together with `text-variable-anchor` (if `text-radial-offset` option is not provided). If used with `text-variable-anchor`, input values will be taken as absolute values. Offsets along the x- and y-axis will be applied automatically based on the anchor position. ([#15542](https://github.com/mapbox/mapbox-gl-native/pull/15542)) +* Enable using of `text-offset` option together with `text-variable-anchor` (if `text-radial-offset` option is not provided). If used with `text-variable-anchor`, input values will be taken as absolute values. Offsets along the x- and y-axis will be applied automatically based on the anchor position. ([#15542](https://github.com/mapbox/mapbox-gl-native/pull/15542)) +* Fixed an issue with the appearance of the compass text in iOS 13. ([#15547](https://github.com/mapbox/mapbox-gl-native/pull/15547)) ### Performance improvements diff --git a/platform/ios/src/MGLCompassButton.mm b/platform/ios/src/MGLCompassButton.mm index 94a6820a74..acb25a560c 100644 --- a/platform/ios/src/MGLCompassButton.mm +++ b/platform/ios/src/MGLCompassButton.mm @@ -63,9 +63,16 @@ UIImage *scaleImage = [UIImage mgl_resourceImageNamed:@"Compass"]; UIGraphicsBeginImageContextWithOptions(scaleImage.size, NO, UIScreen.mainScreen.scale); [scaleImage drawInRect:{CGPointZero, scaleImage.size}]; + + UIFont *northFont; + if (@available(iOS 13.0, *)) { + northFont = [UIFont systemFontOfSize:11 weight:UIFontWeightLight]; + } else { + northFont = [UIFont systemFontOfSize:11 weight:UIFontWeightUltraLight]; + } NSAttributedString *north = [[NSAttributedString alloc] initWithString:NSLocalizedStringWithDefaultValue(@"COMPASS_NORTH", nil, nil, @"N", @"Compass abbreviation for north") attributes:@{ - NSFontAttributeName: [UIFont systemFontOfSize:11 weight:UIFontWeightUltraLight], + NSFontAttributeName: northFont, NSForegroundColorAttributeName: [UIColor whiteColor], }]; CGRect stringRect = CGRectMake((scaleImage.size.width - north.size.width) / 2, |