summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-01-28 08:22:33 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-01-29 17:36:24 +0000
commit4514cf27b27a9b334d49b969760856751d0b227a (patch)
tree0d56cd795728ab14b375bd83e9804cb9d90c7487 /src/gui
parent9906cc57ed3eed64d534f43c677bb16e08561bb6 (diff)
Fix default font properties when using raw fonts for text layouts
When a QRawFont is set explicitly on the layout, we would get certain font properties from the QTextCharFormat instead. But when the properties had not been set on the QTextCharFormat, we would get the default values which were always 0/false, not the actual default values used in QFont. Instead, we calculate a QFont query based on the format and use the properties from this. This will give us the correct default values in the cases where they are not overridden. Change-Id: I53e5103739164c3d9eafaf76fcb4e8bda57bd12a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextengine.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 506df0664d..9ed497839c 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1398,11 +1398,12 @@ void QTextEngine::shapeText(int item) const
#ifndef QT_NO_RAWFONT
if (useRawFont) {
QTextCharFormat f = format(&si);
- kerningEnabled = f.fontKerning();
+ QFont font = f.font();
+ kerningEnabled = font.kerning();
shapingEnabled = QFontEngine::scriptRequiresOpenType(QChar::Script(si.analysis.script))
- || (f.fontStyleStrategy() & QFont::PreferNoShaping) == 0;
- wordSpacing = QFixed::fromReal(f.fontWordSpacing());
- letterSpacing = QFixed::fromReal(f.fontLetterSpacing());
+ || (font.styleStrategy() & QFont::PreferNoShaping) == 0;
+ wordSpacing = QFixed::fromReal(font.wordSpacing());
+ letterSpacing = QFixed::fromReal(font.letterSpacing());
letterSpacingIsAbsolute = true;
} else
#endif