summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLAttributedExpression.m
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLAttributedExpression.m')
-rw-r--r--platform/darwin/src/MGLAttributedExpression.m23
1 files changed, 16 insertions, 7 deletions
diff --git a/platform/darwin/src/MGLAttributedExpression.m b/platform/darwin/src/MGLAttributedExpression.m
index 715f74e42f..a34480a957 100644
--- a/platform/darwin/src/MGLAttributedExpression.m
+++ b/platform/darwin/src/MGLAttributedExpression.m
@@ -2,33 +2,42 @@
#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
- (instancetype)initWithExpression:(NSExpression *)expression {
- self = [self initWithExpression:expression attributes:nil];
+ self = [self initWithExpression:expression attributes:@{}];
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)initWithExpression:(NSExpression *)expression attributes:(NSDictionary<MGLAttributedExpressionKey,id> *)attrs {
++ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary<MGLAttributedExpressionKey, NSExpression *> *)attrs {
+ MGLAttributedExpression *attributedExpression;
+
+ attributedExpression = [[self alloc] initWithExpression:expression attributes:attrs];
+
+ return attributedExpression;
+}
+
+- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary<MGLAttributedExpressionKey, NSExpression *> *)attrs {
if (self = [super init])
{
MGLLogInfo(@"Starting %@ initialization.", NSStringFromClass([self class]));