Fix em unit calculation in document preview (#1961)

This commit is contained in:
Veronica Berglyd Olsen
2024-07-05 13:21:39 +02:00
parent 7bdadadea1
commit 2e1c08cbfa
+3 -3
View File
@@ -26,7 +26,7 @@ from __future__ import annotations
import logging import logging
from PyQt5.QtGui import ( from PyQt5.QtGui import (
QColor, QFont, QFontMetrics, QTextBlockFormat, QTextCharFormat, QColor, QFont, QFontMetricsF, QTextBlockFormat, QTextCharFormat,
QTextCursor, QTextDocument QTextCursor, QTextDocument
) )
@@ -99,8 +99,8 @@ class ToQTextDocument(Tokenizer):
self._document.clear() self._document.clear()
self._document.setDefaultFont(self._textFont) self._document.setDefaultFont(self._textFont)
qMetric = QFontMetrics(self._textFont) qMetric = QFontMetricsF(self._textFont)
mScale = qMetric.height() mScale = qMetric.ascent()
fPt = self._textFont.pointSizeF() fPt = self._textFont.pointSizeF()
# Scaled Sizes # Scaled Sizes