Skip to content

Commit 96ae950

Browse files
committed
use monospaced digit system fonts to prevent jitter
1 parent 0007350 commit 96ae950

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Kit/plugins/Charts.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ internal func scaleValue(scale: Scale = .linear, value: Double, maxValue: Double
7373
return y
7474
}
7575

76-
private let subtitleFont = NSFont.systemFont(ofSize: 9, weight: .medium)
76+
private let titleFont = NSFont.monospacedDigitSystemFont(ofSize: 12, weight: .regular)
77+
private let subtitleFont = NSFont.monospacedDigitSystemFont(ofSize: 9, weight: .medium)
7778

7879
private func drawToolTip(_ frame: NSRect, _ point: CGPoint, _ size: CGSize, value: String, subtitle: String? = nil) {
7980
guard !value.isEmpty else { return }
@@ -105,7 +106,7 @@ private func drawToolTip(_ frame: NSRect, _ point: CGPoint, _ size: CGSize, valu
105106
box.fill()
106107

107108
var attributes = [
108-
NSAttributedString.Key.font: NSFont.systemFont(ofSize: 12, weight: .regular),
109+
NSAttributedString.Key.font: titleFont,
109110
NSAttributedString.Key.foregroundColor: isDarkMode ? NSColor.white : NSColor.textColor
110111
]
111112
var rect = CGRect(x: position.x, y: position.y+valueOffset, width: size.width, height: 12)

0 commit comments

Comments
 (0)