diff options
author | Marcelo Alves <[email protected]> | 2016-12-30 01:47:15 -0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2016-12-30 08:08:31 +0100 |
commit | 2dd9968af2db70243337085bfa3de46fa580f9b1 (patch) | |
tree | 27783d4fa3fae766715757a672e89898c6be2edd /macosx | |
parent | 56e26f4b112a8454c09f355ca3eefab52f2b76ed (diff) |
If available, use the monospaced digit system font to draw the progress over the Dock icon.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/DockTextField.m | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/macosx/DockTextField.m b/macosx/DockTextField.m index 976ee54e6..5ce10da5e 100644 --- a/macosx/DockTextField.m +++ b/macosx/DockTextField.m @@ -37,7 +37,16 @@ { if (self.isHidden) return; - + + NSFont *font; + if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { + // On macOS 10.11+ the monospaced digit system is available. + font = [NSFont monospacedDigitSystemFontOfSize:DOCK_TEXTFIELD_FONTSIZE weight:NSFontWeightBold]; + } else { + // macOS 10.10- use the default system font. + font = [NSFont boldSystemFontOfSize:DOCK_TEXTFIELD_FONTSIZE]; + } + NSRect blackOutlineFrame = NSMakeRect(0.0, 0.0, [self bounds].size.width, [self bounds].size.height-1.0); double radius = self.bounds.size.height / 2; @@ -46,7 +55,7 @@ NSMutableDictionary *drawStringAttributes = [[NSMutableDictionary alloc] init]; [drawStringAttributes setValue:[NSColor whiteColor] forKey:NSForegroundColorAttributeName]; - [drawStringAttributes setValue:[NSFont boldSystemFontOfSize:DOCK_TEXTFIELD_FONTSIZE] forKey:NSFontAttributeName]; + [drawStringAttributes setValue:font forKey:NSFontAttributeName]; NSShadow *stringShadow = [[NSShadow alloc] init]; [stringShadow setShadowColor:[NSColor blackColor]]; NSSize shadowSize; |