Set kerning to zero if font is monospaced (close #1531)

This commit is contained in:
1024jp 2023-10-16 22:41:12 +09:00
parent e6ae3c8734
commit 8849209aa0
2 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,7 @@ Change Log
### Improvements
- Set the text kerning in the editor to zero if the font is monospaced.
- Improve Chinese localizations.
- [trivial] Update label and tooltip for the Line Wrapping toolbar item.
- [trivial] Avoid unwanted line break in the character inspector.

View File

@ -224,6 +224,7 @@ class EditorTextView: NSTextView, Themable, CurrentLineHighlighting, MultiCursor
layoutManager.showsIndentGuides = defaults[.showIndentGuides]
self.ligature = defaults[.ligature(for: fontType)] ? .standard : .none
self.typingAttributes[.kern] = (fontType == .monospaced) ? 0 : nil
self.invalidateDefaultParagraphStyle(initial: true)
// observe font changes in defaults
@ -1326,6 +1327,7 @@ class EditorTextView: NSTextView, Themable, CurrentLineHighlighting, MultiCursor
self.font = defaults.font(for: type)
self.ligature = defaults[.ligature(for: type)] ? .standard : .none
self.usesAntialias = defaults[.antialias(for: type)]
self.typingAttributes[.kern] = (type == .monospaced) ? 0 : nil
self.observeFontDefaults(for: type)
}