Skip to content

Commit

Permalink
Basic font weight management
Browse files Browse the repository at this point in the history
  • Loading branch information
danielzsh committed May 2, 2024
1 parent dae56c8 commit 0c8a0b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ extension TextViewController: ThemeAttributesProviding {
[
.font: font,
.foregroundColor: theme.colorFor(capture),
.kern: textView.kern
.kern: textView.kern,
.strokeWidth: theme.widthFor(capture),
]
}
}
9 changes: 9 additions & 0 deletions Sources/CodeEditSourceEditor/Theme/EditorTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ public struct EditorTheme {
default: return text
}
}

func widthFor(_ capture: CaptureName?) -> Float {
switch capture {
case .include, .constructor, .keyword, .boolean, .variableBuiltin,
.keywordReturn, .keywordFunction, .repeat, .conditional, .tag, .type:
return -4.0
default: return 0.0
}
}
}

extension EditorTheme: Equatable {
Expand Down

0 comments on commit 0c8a0b2

Please sign in to comment.