diff --git a/Clocker/Preferences/Menu Bar/StatusContainerView.swift b/Clocker/Preferences/Menu Bar/StatusContainerView.swift index 0c8984f..3821276 100644 --- a/Clocker/Preferences/Menu Bar/StatusContainerView.swift +++ b/Clocker/Preferences/Menu Bar/StatusContainerView.swift @@ -57,6 +57,16 @@ protocol StatusItemViewConforming { class StatusContainerView: NSView { private var previousX: Int = 0 private let store: DataStore + private lazy var paragraphStyle: 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 = CGFloat(lineHeight) + return paragraphStyle + }() override func awakeFromNib() { super.awakeFromNib() @@ -167,7 +177,7 @@ class StatusContainerView: NSView { NSAttributedString.Key.font: compactModeTimeFont, NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.backgroundColor: NSColor.clear, - NSAttributedString.Key.paragraphStyle: defaultParagraphStyle, + NSAttributedString.Key.paragraphStyle: paragraphStyle, ] let operation = TimezoneDataOperations(with: timezone, store: store) diff --git a/Clocker/Preferences/Menu Bar/StatusItemView.swift b/Clocker/Preferences/Menu Bar/StatusItemView.swift index 4c687bb..b90dca3 100644 --- a/Clocker/Preferences/Menu Bar/StatusItemView.swift +++ b/Clocker/Preferences/Menu Bar/StatusItemView.swift @@ -53,6 +53,16 @@ class StatusItemView: NSView { private var operationsObject: TimezoneDataOperations { return TimezoneDataOperations(with: dataObject, store: DataStore.shared()) } + private lazy var paragraphStyle: 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 = CGFloat(lineHeight) + return paragraphStyle + }() private var timeAttributes: [NSAttributedString.Key: AnyObject] { let textColor = hasDarkAppearance ? NSColor.white : NSColor.black @@ -61,7 +71,7 @@ class StatusItemView: NSView { NSAttributedString.Key.font: compactModeTimeFont, NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.backgroundColor: NSColor.clear, - NSAttributedString.Key.paragraphStyle: defaultTimeParagraphStyle, + NSAttributedString.Key.paragraphStyle: paragraphStyle, ] return attributes } @@ -73,7 +83,7 @@ class StatusItemView: NSView { NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 10), NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.backgroundColor: NSColor.clear, - NSAttributedString.Key.paragraphStyle: defaultParagraphStyle, + NSAttributedString.Key.paragraphStyle: paragraphStyle, ] return textFontAttributes }