summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-03-19 13:34:52 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-03-25 06:30:05 +0000
commitbe6c70ed7f9a5fed98d44f9993492ab9d2fc16df (patch)
tree8fb7b17194789bf05d21247a4762590c9e21a065 /src/gui/text
parentd8323376670fdc65e4a4a654def8b78b650bdbe7 (diff)
macOS: Don't scale advances to 0 when stretch is AnyStretch
If the stretch is set to AnyStretch, then this is taken to mean we should accept the font as it is. But on mac, there is a special code path to scale the advances since the shaper doesn't do it for us, and this neglected to check the stretch, thus it would scale the advances by 0%. This happened when loading a file directly in QRawFont and using this in a QTextLayout, since no part of the code path will attempt to calculate the stretch in that case. Reproducible in q3dsviewer in Qt 3D Runtime 2.3. Task-number: QT3DS-3132 Change-Id: I8f934f3fac41bf7a93c01cca0416d44003119907 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qtextengine.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index a83ef95c79..22c93d7ec2 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1754,7 +1754,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
#ifdef Q_OS_DARWIN
if (actualFontEngine->type() == QFontEngine::Mac) {
- if (actualFontEngine->fontDef.stretch != 100) {
+ if (actualFontEngine->fontDef.stretch != 100 && actualFontEngine->fontDef.stretch != QFont::AnyStretch) {
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] *= stretch;