Apply the font matcher closer to config read

This commit is contained in:
Veronica Berglyd Olsen
2024-11-26 17:06:34 +01:00
parent 18c70ffe3e
commit c091e0b9bb
5 changed files with 35 additions and 28 deletions
+6 -5
View File
@@ -37,7 +37,7 @@ from PyQt5.QtWidgets import (
)
from novelwriter import CONFIG, SHARED
from novelwriter.common import describeFont, qtLambda
from novelwriter.common import describeFont, fontMatcher, qtLambda
from novelwriter.constants import nwHeadFmt, nwKeyWords, nwLabels, nwStyles, trConst
from novelwriter.core.buildsettings import BuildSettings, FilterMode
from novelwriter.extensions.configlayout import (
@@ -1281,8 +1281,9 @@ class _FormattingTab(NScrollableForm):
# Text Format
# ===========
self._textFont = QFont()
self._textFont.fromString(self._build.getStr("format.textFont"))
font = QFont()
font.fromString(self._build.getStr("format.textFont"))
self._textFont = fontMatcher(font)
self.textFont.setText(describeFont(self._textFont))
self.textFont.setCursorPosition(0)
@@ -1437,9 +1438,9 @@ class _FormattingTab(NScrollableForm):
"""Open the QFontDialog and set a font for the font style."""
font, status = SHARED.getFont(self._textFont, CONFIG.nativeFont)
if status:
self.textFont.setText(describeFont(font))
self._textFont = fontMatcher(font)
self.textFont.setText(describeFont(self._textFont))
self.textFont.setCursorPosition(0)
self._textFont = font
return
@pyqtSlot(int)