Browse Source

Line Height Multiple for Location Text in Status Bar

Addressing feedback:

In the menu bar, whenever I have locations that have letters like “p”, “q”, “y”, and “g” (i.e. they go below the “line”) the portion below the “line” gets truncated. So it ends up that “p”, “q” and “g” look kind of like “o” and “y” looks like “v”. This means I can’t really pick the names I want sometimes (e.g. for Germany I use Frankfurt as a workaround). Please fix!
master
Abhi 1 year ago
parent
commit
3d31ce8269
  1. 13
      Clocker/Preferences/Menu Bar/StatusItemView.swift
  2. 2
      Clocker/Preferences/Menu Bar/UpcomingEventStatusItemView.swift

13
Clocker/Preferences/Menu Bar/StatusItemView.swift

@ -3,10 +3,21 @@
import Cocoa
import CoreModelKit
var defaultTimeParagraphStyle: NSMutableParagraphStyle {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .center
paragraphStyle.lineBreakMode = .byTruncatingTail
return paragraphStyle
}
var defaultParagraphStyle: NSMutableParagraphStyle {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .center
paragraphStyle.lineBreakMode = .byTruncatingTail
// Better readability for p,q,y,g in the status bar.
let userPreferredLanguage = Locale.preferredLanguages.first ?? "en-US"
let lineHeight = userPreferredLanguage.contains("en") ? 0.92 : 1
paragraphStyle.lineHeightMultiple = lineHeight
return paragraphStyle
}
@ -50,7 +61,7 @@ class StatusItemView: NSView {
NSAttributedString.Key.font: compactModeTimeFont,
NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.backgroundColor: NSColor.clear,
NSAttributedString.Key.paragraphStyle: defaultParagraphStyle,
NSAttributedString.Key.paragraphStyle: defaultTimeParagraphStyle,
]
return attributes
}

2
Clocker/Preferences/Menu Bar/UpcomingEventStatusItemView.swift

@ -21,7 +21,7 @@ class UpcomingEventStatusItemView: NSView {
NSAttributedString.Key.font: compactModeTimeFont,
NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.backgroundColor: NSColor.clear,
NSAttributedString.Key.paragraphStyle: defaultParagraphStyle,
NSAttributedString.Key.paragraphStyle: defaultTimeParagraphStyle,
]
return attributes
}

Loading…
Cancel
Save