summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLAttributedExpression.m
diff options
context:
space:
mode:
authorFabian Guerra Soto <fabian.guerra@mapbox.com>2019-03-22 13:45:39 -0700
committerFabian Guerra Soto <fabian.guerra@mapbox.com>2019-03-22 15:08:58 -0700
commit79582487aa69569933e38cadc0faf5ea04711303 (patch)
tree7f44ae7c6654171fd58faaafd6bfd3ab7e9306aa /platform/darwin/src/MGLAttributedExpression.m
parentbe46a707f992ce48e65163353924e0d7be25c722 (diff)
downloadqtlocation-mapboxgl-79582487aa69569933e38cadc0faf5ea04711303.tar.gz
[ios, macos] Support expressions in formatting parameters. (#14198)
Modified MGLAttributedExpression object to support NSExpressions as formatting attributes only. This aligns with GL and Android implementation and specification. Modified the documentation accordingly, and changed MGLFontSizeAttribute to MGLFontScaleAttribute to clarify the true function of the formatting parameter.
Diffstat (limited to 'platform/darwin/src/MGLAttributedExpression.m')
-rw-r--r--platform/darwin/src/MGLAttributedExpression.m14
1 files changed, 7 insertions, 7 deletions
diff --git a/platform/darwin/src/MGLAttributedExpression.m b/platform/darwin/src/MGLAttributedExpression.m
index 000701f7cf..a34480a957 100644
--- a/platform/darwin/src/MGLAttributedExpression.m
+++ b/platform/darwin/src/MGLAttributedExpression.m
@@ -2,7 +2,7 @@
#import "MGLLoggingConfiguration_Private.h"
const MGLAttributedExpressionKey MGLFontNamesAttribute = @"text-font";
-const MGLAttributedExpressionKey MGLFontSizeAttribute = @"font-scale";
+const MGLAttributedExpressionKey MGLFontScaleAttribute = @"font-scale";
const MGLAttributedExpressionKey MGLFontColorAttribute = @"text-color";
@implementation MGLAttributedExpression
@@ -12,24 +12,24 @@ const MGLAttributedExpressionKey MGLFontColorAttribute = @"text-color";
return self;
}
-+ (instancetype)attributedExpression:(NSExpression *)expression fontNames:(nullable NSArray<NSString *> *)fontNames fontSize:(nullable NSNumber *)fontSize {
++ (instancetype)attributedExpression:(NSExpression *)expression fontNames:(nullable NSArray<NSString *> *)fontNames fontScale:(nullable NSNumber *)fontScale {
MGLAttributedExpression *attributedExpression;
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
if (fontNames && fontNames.count > 0) {
- attrs[MGLFontNamesAttribute] = fontNames;
+ attrs[MGLFontNamesAttribute] = [NSExpression expressionForConstantValue:fontNames];
}
- if (fontSize) {
- attrs[MGLFontSizeAttribute] = fontSize;
+ if (fontScale) {
+ attrs[MGLFontScaleAttribute] = [NSExpression expressionForConstantValue:fontScale];
}
attributedExpression = [[self alloc] initWithExpression:expression attributes:attrs];
return attributedExpression;
}
-+ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary<MGLAttributedExpressionKey,id> *)attrs {
++ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary<MGLAttributedExpressionKey, NSExpression *> *)attrs {
MGLAttributedExpression *attributedExpression;
attributedExpression = [[self alloc] initWithExpression:expression attributes:attrs];
@@ -37,7 +37,7 @@ const MGLAttributedExpressionKey MGLFontColorAttribute = @"text-color";
return attributedExpression;
}
-- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary<MGLAttributedExpressionKey,id> *)attrs {
+- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary<MGLAttributedExpressionKey, NSExpression *> *)attrs {
if (self = [super init])
{
MGLLogInfo(@"Starting %@ initialization.", NSStringFromClass([self class]));