From 71347aab8386028f44a8483a79778135e5245547 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Thu, 20 Jan 2022 22:03:59 -0800 Subject: [PATCH] Play Time Field: Changed how control achieves monospace numbers, and changed font --- Window/TimeField.m | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Window/TimeField.m b/Window/TimeField.m index f593665c1..50e6d9902 100644 --- a/Window/TimeField.m +++ b/Window/TimeField.m @@ -22,12 +22,21 @@ NSString * formatTimer(long minutes, long seconds, unichar prefix) { - (void)awakeFromNib { showTimeRemaining = [[NSUserDefaults standardUserDefaults] boolForKey:kTimerModeKey]; - if (@available(macOS 10.15, *)) { - fontAttributes = - @{NSFontAttributeName : [NSFont monospacedSystemFontOfSize:13 - weight:NSFontWeightMedium]}; - [self update]; - } + + NSFontDescriptor * fontDesc = [[NSFont systemFontOfSize:13] fontDescriptor]; + + NSDictionary *fontFeatureSettings = @{NSFontFeatureTypeIdentifierKey: @(kNumberSpacingType), + NSFontFeatureSelectorIdentifierKey: @(kMonospacedNumbersSelector) + }; + + NSDictionary *fontFeatureAttributes = @{NSFontFeatureSettingsAttribute: @[ fontFeatureSettings ] }; + + fontDesc = [fontDesc fontDescriptorByAddingAttributes:fontFeatureAttributes]; + + NSFont * font = [NSFont fontWithDescriptor:fontDesc size:13]; + + fontAttributes = + @{NSFontAttributeName : font}; } - (void)update