Switch Tokenizer to use QFont instead of font family and size

This commit is contained in:
Veronica Berglyd Olsen
2024-05-22 16:57:50 +02:00
parent c63a0c2f58
commit 7e1f1a725c
8 changed files with 81 additions and 73 deletions
+5 -7
View File
@@ -34,7 +34,9 @@ from pathlib import Path
from time import time
from PyQt5.QtCore import QCoreApplication, QRegularExpression
from PyQt5.QtGui import QFont
from novelwriter import CONFIG
from novelwriter.common import checkInt, formatTimeStamp, numberToRoman
from novelwriter.constants import (
nwHeadFmt, nwKeyWords, nwLabels, nwRegEx, nwShortcode, nwUnicode, trConst
@@ -139,9 +141,7 @@ class Tokenizer(ABC):
self._markdown: list[str] = []
# User Settings
self._textFont = "Serif" # Output text font
self._textSize = 11 # Output text size
self._textFixed = False # Fixed width text
self._textFont = CONFIG.textFont # Output text font
self._lineHeight = 1.15 # Line height in units of em
self._blockIndent = 4.00 # Block indent in units of em
self._firstIndent = False # Enable first line indent
@@ -315,11 +315,9 @@ class Tokenizer(ABC):
)
return
def setFont(self, family: str, size: int, isFixed: bool = False) -> None:
def setFont(self, font: QFont) -> None:
"""Set the build font."""
self._textFont = family
self._textSize = round(int(size))
self._textFixed = isFixed
self._textFont = font
return
def setLineHeight(self, height: float) -> None: