Play Time Field: Changed how control achieves monospace numbers, and changed font

CQTexperiment
Christopher Snowhill 2022-01-20 22:03:59 -08:00
parent 0f90dd3b3e
commit 71347aab83
1 changed files with 15 additions and 6 deletions

View File

@ -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