Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] fix compass font thinner than previous version on iOS 13 #15547

Merged
merged 5 commits into from
Sep 4, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion platform/ios/src/MGLCompassButton.mm
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,17 @@ - (UIImage *)compassImage {
UIImage *scaleImage = [UIImage mgl_resourceImageNamed:@"Compass"];
UIGraphicsBeginImageContextWithOptions(scaleImage.size, NO, UIScreen.mainScreen.scale);
[scaleImage drawInRect:{CGPointZero, scaleImage.size}];

UIFont *northFont;
if(@available(iOS 13, *)){
friedbunny marked this conversation as resolved.
Show resolved Hide resolved
northFont = [UIFont systemFontOfSize:11 weight:UIFontWeightLight];
}
friedbunny marked this conversation as resolved.
Show resolved Hide resolved
else{
friedbunny marked this conversation as resolved.
Show resolved Hide resolved
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,
Expand Down