From 45def4b3b7c74596f5b481c85031ea31429b2e57 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 12 Feb 2022 17:36:58 +0100 Subject: [PATCH] Set a default editor font for Windows and macOS (#990) * Set a specific default editor font for Windows and macOS as GUI font isn't suitable * Fix wrong reference --- novelwriter/gui/doceditor.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index abc97a8b..41442385 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -235,8 +235,19 @@ class GuiDocEditor(QTextEdit): theFont = QFont() qDoc = self.document() if self.mainConf.textFont is None: - # If none is defined, set the default back to config - self.mainConf.textFont = qDoc.defaultFont().family() + # If none is defined, set a default font + theFont = QFont() + if self.mainConf.osWindows and "Arial" in self.theTheme.guiFontDB.families(): + theFont.setFamily("Arial") + theFont.setPointSize(12) + elif self.mainConf.osDarwin and "Courier" in self.theTheme.guiFontDB.families(): + theFont.setFamily("Courier") + theFont.setPointSize(12) + else: + theFont = qDoc.defaultFont() + + self.mainConf.textFont = theFont.family() + self.mainConf.textSize = theFont.pointSize() theFont.setFamily(self.mainConf.textFont) theFont.setPointSize(self.mainConf.textSize)