Shrink the time field on macOS 10.13 and older
Since 10.13 doesn't want to observe the auto sizing attribute of the field properly, gotta use the tiny font size that the field is already configured to use. Should fix #243 Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
9fd85f6670
commit
763f4c8cd5
|
@ -22,9 +22,14 @@ NSString *formatTimer(long minutes, long seconds, unichar prefix, int padding) {
|
|||
}
|
||||
|
||||
- (void)awakeFromNib {
|
||||
CGFloat fontSize = 11.0;
|
||||
if(@available(macOS 10.14, *)) {
|
||||
fontSize = 13.0;
|
||||
}
|
||||
|
||||
showTimeRemaining = [[NSUserDefaults standardUserDefaults] boolForKey:kTimerModeKey];
|
||||
|
||||
NSFontDescriptor *fontDesc = [[NSFont systemFontOfSize:13] fontDescriptor];
|
||||
NSFontDescriptor *fontDesc = [[NSFont systemFontOfSize:fontSize] fontDescriptor];
|
||||
|
||||
NSDictionary *fontFeatureSettings = @{ NSFontFeatureTypeIdentifierKey: @(kNumberSpacingType),
|
||||
NSFontFeatureSelectorIdentifierKey: @(kMonospacedNumbersSelector) };
|
||||
|
@ -33,10 +38,11 @@ NSString *formatTimer(long minutes, long seconds, unichar prefix, int padding) {
|
|||
|
||||
fontDesc = [fontDesc fontDescriptorByAddingAttributes:fontFeatureAttributes];
|
||||
|
||||
NSFont *font = [NSFont fontWithDescriptor:fontDesc size:13];
|
||||
NSFont *font = [NSFont fontWithDescriptor:fontDesc size:fontSize];
|
||||
|
||||
fontAttributes =
|
||||
@{ NSFontAttributeName: font };
|
||||
fontAttributes = @{ NSFontAttributeName: font };
|
||||
|
||||
[self update];
|
||||
}
|
||||
|
||||
static int _log10(long minutes) {
|
||||
|
|
Loading…
Reference in New Issue