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,7 +1543,9 @@ class ConfigEditor(QDialog):
|
||||||
tooltip(tr.addons_restored_defaults(), parent=self)
|
tooltip(tr.addons_restored_defaults(), parent=self)
|
||||||
|
|
||||||
def setupFonts(self) -> None:
|
def setupFonts(self) -> None:
|
||||||
font_mono = QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont)
|
font_mono = QFont("Consolas")
|
||||||
|
if not font_mono.exactMatch():
|
||||||
|
font_mono = QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont)
|
||||||
font_mono.setPointSize(font_mono.pointSize() + 1)
|
font_mono.setPointSize(font_mono.pointSize() + 1)
|
||||||
self.form.editor.setFont(font_mono)
|
self.form.editor.setFont(font_mono)
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,10 @@ class CardLayout(QDialog):
|
||||||
|
|
||||||
self.current_editor_index = 0
|
self.current_editor_index = 0
|
||||||
editor.setAcceptRichText(False)
|
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)
|
tab_width = self.fontMetrics().horizontalAdvance(" " * 4)
|
||||||
editor.setTabStopDistance(tab_width)
|
editor.setTabStopDistance(tab_width)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue