From 194e683b7a6a61cb1348861b3cca556a18c8aaca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kao=20F=C3=A9lix?= Date: Fri, 4 Oct 2024 16:49:56 +0200 Subject: [PATCH] Load system monospace font from font db, instead of hardcoding --- qtcodeedit.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qtcodeedit.py b/qtcodeedit.py index 190058d..0b8f8b3 100644 --- a/qtcodeedit.py +++ b/qtcodeedit.py @@ -9,6 +9,7 @@ from qtpy.QtGui import ( QColor, QFont, + QFontDatabase, QKeyEvent, QPainter, QPalette, @@ -34,10 +35,8 @@ def __init__(self): super().__init__() self._indentation_mode = self.Indent.WithSpaces - font = QFont() - font.setFamily("Menlo") + font = QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont) font.setPointSize(14) - font.setFixedPitch(True) self.setFont(font) self.highlighter = PygmentsSyntaxHighlighter(self.document())