diff --git a/RPSyntaxHighlighter/RPSyntaxTheme.m b/RPSyntaxHighlighter/RPSyntaxTheme.m index f635e91..509c7b1 100644 --- a/RPSyntaxHighlighter/RPSyntaxTheme.m +++ b/RPSyntaxHighlighter/RPSyntaxTheme.m @@ -39,7 +39,8 @@ - (NSDictionary *)attributesForScope:(NSString *)scope UIColor *foregroundColor = [UIColor colorWithHexString:self.styles[scope][@"color"]]; UIColor *backgroundColor = [UIColor colorWithHexString:self.styles[scope][@"background"]]; - UIFont *font = [UIFont fontWithName:self.styles[scope][@"font"] size:[self.styles[scope][@"fontSize"] floatValue]]; + NSString *fontName = self.styles[scope][@"font"]; + CGFloat fontSize = [self.styles[scope][@"fontSize"] floatValue]; if (foregroundColor) { attributes[NSForegroundColorAttributeName] = foregroundColor; @@ -49,8 +50,8 @@ - (NSDictionary *)attributesForScope:(NSString *)scope attributes[NSBackgroundColorAttributeName] = backgroundColor; } - if (font) { - attributes[NSFontAttributeName] = font; + if (fontName) { + attributes[NSFontAttributeName] = [UIFont fontWithName:fontName size:fontSize]; } return attributes;