Skip to content

Commit

Permalink
Merge pull request #148 from thomasbachem/monospaced-digits
Browse files Browse the repository at this point in the history
Use monospacedDigitSystemFontOfSize on OS X 10.11+
  • Loading branch information
matryer committed Jan 8, 2016
2 parents 0774ef4 + 226fd82 commit 7620049
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions App/BitBar/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ - (NSAttributedString*) attributedTitleWithParams:(NSDictionary *)params {
NSString * title = truncLength < titleLength ? [[fullTitle substringToIndex:truncLength] stringByAppendingString:@""] : fullTitle;

CGFloat size = params[@"size"] ? [params[@"size"] floatValue] : 14;
NSFont * font = [self isFontValid:params[@"font"]] ? [NSFont fontWithName:params[@"font"] size:size]
: [NSFont menuFontOfSize:size]
?: [NSFont menuFontOfSize:size];
NSFont * font;
if ([NSFont respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
font = [self isFontValid:params[@"font"]] ? [NSFont fontWithName:params[@"font"] size:size]
: [NSFont monospacedDigitSystemFontOfSize:size weight:NSFontWeightRegular]
?: [NSFont monospacedDigitSystemFontOfSize:size weight:NSFontWeightRegular];
} else {
font = [self isFontValid:params[@"font"]] ? [NSFont fontWithName:params[@"font"] size:size]
: [NSFont menuFontOfSize:size]
?: [NSFont menuFontOfSize:size];
}
NSColor * fgColor;
NSMutableAttributedString * attributedTitle = [NSMutableAttributedString.alloc initWithString:title attributes:@{NSFontAttributeName: font}];
if (!params[@"color"]) return attributedTitle;
Expand Down

0 comments on commit 7620049

Please sign in to comment.