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) {
|
if(cellView.textField) {
|
||||||
cellView.textField.allowsDefaultTighteningForTruncation = YES;
|
cellView.textField.allowsDefaultTighteningForTruncation = YES;
|
||||||
|
|
||||||
NSFont *sysFont = [NSFont systemFontOfSize:fontSize];
|
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:fontSize weight:NSFontWeightRegular];
|
||||||
|
|
||||||
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];
|
|
||||||
|
|
||||||
cellView.textField.font = font;
|
cellView.textField.font = font;
|
||||||
cellView.textField.stringValue = cellText;
|
cellView.textField.stringValue = cellText;
|
||||||
|
|
|
@ -29,16 +29,7 @@ NSString *formatTimer(long minutes, long seconds, unichar prefix, int padding) {
|
||||||
|
|
||||||
showTimeRemaining = [[NSUserDefaults standardUserDefaults] boolForKey:kTimerModeKey];
|
showTimeRemaining = [[NSUserDefaults standardUserDefaults] boolForKey:kTimerModeKey];
|
||||||
|
|
||||||
NSFontDescriptor *fontDesc = [[NSFont systemFontOfSize:fontSize] fontDescriptor];
|
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:fontSize weight:NSFontWeightRegular];
|
||||||
|
|
||||||
NSDictionary *fontFeatureSettings = @{ NSFontFeatureTypeIdentifierKey: @(kNumberSpacingType),
|
|
||||||
NSFontFeatureSelectorIdentifierKey: @(kMonospacedNumbersSelector) };
|
|
||||||
|
|
||||||
NSDictionary *fontFeatureAttributes = @{ NSFontFeatureSettingsAttribute: @[fontFeatureSettings] };
|
|
||||||
|
|
||||||
fontDesc = [fontDesc fontDescriptorByAddingAttributes:fontFeatureAttributes];
|
|
||||||
|
|
||||||
NSFont *font = [NSFont fontWithDescriptor:fontDesc size:fontSize];
|
|
||||||
|
|
||||||
fontAttributes = @{ NSFontAttributeName: font };
|
fontAttributes = @{ NSFontAttributeName: font };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue