@@ -19,6 +19,9 @@ extension SourceEditorConfiguration {
1919 /// The default font.
2020 public var font : NSFont
2121
22+ /// An optional font for line numbers. When `nil`, a font derived from ``font`` is used.
23+ public var lineNumberFont : NSFont ?
24+
2225 /// The line height multiplier (e.g. `1.2`).
2326 public var lineHeightMultiple : Double
2427
@@ -45,6 +48,7 @@ extension SourceEditorConfiguration {
4548 /// - useThemeBackground: Determines whether the editor uses the theme's background color, or a transparent
4649 /// background color.
4750 /// - font: The default font.
51+ /// - lineNumberFont: An optional font for line numbers. Defaults to a font derived from `font`.
4852 /// - lineHeightMultiple: The line height multiplier (e.g. `1.2`).
4953 /// - letterSpacing: The amount of space to use between letters, as a percent. Eg: `1.0` = no space, `1.5`
5054 /// = 1/2 of a character's width between characters, etc. Defaults to `1.0`.
@@ -57,6 +61,7 @@ extension SourceEditorConfiguration {
5761 theme: EditorTheme ,
5862 useThemeBackground: Bool = true ,
5963 font: NSFont ,
64+ lineNumberFont: NSFont ? = nil ,
6065 lineHeightMultiple: Double = 1.2 ,
6166 letterSpacing: Double = 1.0 ,
6267 wrapLines: Bool ,
@@ -67,6 +72,7 @@ extension SourceEditorConfiguration {
6772 self . theme = theme
6873 self . useThemeBackground = useThemeBackground
6974 self . font = font
75+ self . lineNumberFont = lineNumberFont
7076 self . lineHeightMultiple = lineHeightMultiple
7177 self . letterSpacing = letterSpacing
7278 self . wrapLines = wrapLines
@@ -86,10 +92,11 @@ extension SourceEditorConfiguration {
8692 if oldConfig? . font != font {
8793 controller. textView. font = font
8894 controller. textView. typingAttributes = controller. attributesFor ( nil )
89- controller. gutterView. font = font. rulerFont
9095 needsHighlighterInvalidation = true
9196 }
9297
98+ controller. gutterView. font = lineNumberFont ?? font. rulerFont
99+
93100 if oldConfig? . theme != theme || oldConfig? . useThemeBackground != useThemeBackground {
94101 updateControllerNewTheme ( controller: controller)
95102 needsHighlighterInvalidation = true
0 commit comments