mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Change default font in code editors (#2985)
* Change default font in code editors * Fall back to system font
This commit is contained in:
parent
54b1cc5689
commit
312d396505
2 changed files with 7 additions and 2 deletions
|
@ -1543,6 +1543,8 @@ class ConfigEditor(QDialog):
|
|||
tooltip(tr.addons_restored_defaults(), parent=self)
|
||||
|
||||
def setupFonts(self) -> None:
|
||||
font_mono = QFont("Consolas")
|
||||
if not font_mono.exactMatch():
|
||||
font_mono = QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont)
|
||||
font_mono.setPointSize(font_mono.pointSize() + 1)
|
||||
self.form.editor.setFont(font_mono)
|
||||
|
|
|
@ -267,7 +267,10 @@ class CardLayout(QDialog):
|
|||
|
||||
self.current_editor_index = 0
|
||||
editor.setAcceptRichText(False)
|
||||
editor.setFont(QFont("Courier"))
|
||||
font = QFont("Consolas")
|
||||
if not font.exactMatch():
|
||||
font = QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont)
|
||||
editor.setFont(font)
|
||||
tab_width = self.fontMetrics().horizontalAdvance(" " * 4)
|
||||
editor.setTabStopDistance(tab_width)
|
||||
|
||||
|
|
Loading…
Reference in a new issue