Playlist/Time: Simplify font initialization
Apparently this simpler API already existed on a minimum of 10.11 for creating a system font with monospaced digits. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
eaa73bc52f
commit
0ba766023e
|
@ -318,18 +318,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
if(cellView.textField) {
|
||||
cellView.textField.allowsDefaultTighteningForTruncation = YES;
|
||||
|
||||
NSFont *sysFont = [NSFont systemFontOfSize:fontSize];
|
||||
|
||||
NSFontDescriptor *fontDesc = [sysFont fontDescriptor];
|
||||
|
||||
NSDictionary *fontFeatureSettings = @{ NSFontFeatureTypeIdentifierKey: @(kNumberSpacingType),
|
||||
NSFontFeatureSelectorIdentifierKey: @(kMonospacedNumbersSelector) };
|
||||
|
||||
NSDictionary *fontFeatureAttributes = @{ NSFontFeatureSettingsAttribute: @[fontFeatureSettings] };
|
||||
|
||||
fontDesc = [fontDesc fontDescriptorByAddingAttributes:fontFeatureAttributes];
|
||||
|
||||
NSFont *font = [NSFont fontWithDescriptor:fontDesc size:fontSize];
|
||||
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:fontSize weight:NSFontWeightRegular];
|
||||
|
||||
cellView.textField.font = font;
|
||||
cellView.textField.stringValue = cellText;
|
||||
|
|
|
@ -29,16 +29,7 @@ NSString *formatTimer(long minutes, long seconds, unichar prefix, int padding) {
|
|||
|
||||
showTimeRemaining = [[NSUserDefaults standardUserDefaults] boolForKey:kTimerModeKey];
|
||||
|
||||
NSFontDescriptor *fontDesc = [[NSFont systemFontOfSize:fontSize] fontDescriptor];
|
||||
|
||||
NSDictionary *fontFeatureSettings = @{ NSFontFeatureTypeIdentifierKey: @(kNumberSpacingType),
|
||||
NSFontFeatureSelectorIdentifierKey: @(kMonospacedNumbersSelector) };
|
||||
|
||||
NSDictionary *fontFeatureAttributes = @{ NSFontFeatureSettingsAttribute: @[fontFeatureSettings] };
|
||||
|
||||
fontDesc = [fontDesc fontDescriptorByAddingAttributes:fontFeatureAttributes];
|
||||
|
||||
NSFont *font = [NSFont fontWithDescriptor:fontDesc size:fontSize];
|
||||
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:fontSize weight:NSFontWeightRegular];
|
||||
|
||||
fontAttributes = @{ NSFontAttributeName: font };
|
||||
|
||||
|
|
Loading…
Reference in New Issue