Navigation Menu

Skip to content

Commit

Permalink
Clean up font use in CurvedTextLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
bryceco committed May 18, 2018
1 parent 30c18cf commit 20276cd
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions OpenStreetMap/Shared/CurvedTextLayer.m
Expand Up @@ -374,18 +374,12 @@ -(id)getCachedLayerForString:(NSString *)string whiteOnBlack:(BOOL)whiteOnBlack

-(NSArray *)layersWithString:(NSString *)string alongPath:(CGPathRef)path offset:(CGFloat)offset whiteOnBlock:(BOOL)whiteOnBlack
{
static UIFont * uiFont = nil;
static CTFontRef ctFont = NULL;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
uiFont = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline];
ctFont = (__bridge CTFontRef)uiFont;
});
UIFont * uiFont = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline];

UIColor * textColor = whiteOnBlack ? UIColor.whiteColor : UIColor.blackColor;
NSAttributedString * attrString = [[NSAttributedString alloc] initWithString:string
attributes:@{
(NSString *)kCTFontAttributeName : (__bridge id)ctFont,
(NSString *)kCTFontAttributeName : uiFont,
(NSString *)kCTForegroundColorAttributeName : (id)textColor.CGColor }];
CTFramesetterRef framesetter = [self framesetterForString:attrString];
NSInteger charCount = string.length;
Expand Down

0 comments on commit 20276cd

Please sign in to comment.