Skip to content

Commit

Permalink
Fixing Font bugs (#1337)
Browse files Browse the repository at this point in the history
Fixes font bugs
  • Loading branch information
bombardier200 authored Jun 19, 2023
1 parent 31ac645 commit c345316
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CodeEdit/Features/CodeFile/CodeFileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ struct CodeFileView: View {

private let isEditable: Bool

private let systemFont: NSFont = .monospacedSystemFont(ofSize: 11, weight: .medium)

init(codeFile: CodeFileDocument, isEditable: Bool = true) {
self.codeFile = codeFile
self.isEditable = isEditable
Expand Down Expand Up @@ -142,7 +144,10 @@ struct CodeFileView: View {
self.selectedTheme = theme
}
.onChange(of: settingsFont) { _ in
font = Settings.shared.preferences.textEditing.font.current()
font = NSFont(
name: settingsFont.name,
size: CGFloat(settingsFont.size)
) ?? systemFont
}
.onChange(of: bracketHighlight) { _ in
bracketPairHighlight = getBracketPairHighlight()
Expand Down
4 changes: 2 additions & 2 deletions CodeEdit/Features/Settings/Views/MonospacedFontPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ struct MonospacedFontPicker: View {
}
}
}
.onChange(of: selectedFontName) { selection in
.onChange(of: selectedFontName) { _ in
if selectedFontName != "SF Mono" {
pushIntoRecentFonts(selection)
pushIntoRecentFonts(selectedFontName)
}
}
.onAppear(perform: getFonts)
Expand Down

0 comments on commit c345316

Please sign in to comment.