aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-06-16 09:03:43 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-06-19 11:41:26 +0200
commit1a7457e03381e217f1242bce49b86cd0e06bd65f (patch)
treee4ae2019537091c77f9bf8f3104ff599812d326b /src/quick/items
parentd1b1fa52a2fded9691f6be5ee864b30adab0db2b (diff)
Fix outline for connected text
For any font where glyphs are connected (any font could have this, but specifically Arabic and Indic fonts will typically always connect glyphs, as it is required to express the language correctly), we would draw the outline on a per-glyph basis, thus getting outlines that disconnect the glyphs. In order to fix this, we have to draw the fill of the glyphs in a separate pass after the outline has been drawn. Note that in order for this to look correct, we have to disable subpixel antialiasing on the fill, which required some plumbing in the native rendering glyph node. The outline shaders have also been changed to only draw the outline and not the fill. Also contains back-port of d46c406cc67f12e6a0798ef509abbb973b34d39d in addition to e8d9bc1bcada7d94af5a33d64a9afc860ede5b84. [ChangeLog][QtQuick][Text] Fixed Outline style on connected glyphs, especially visible in e.g. Arabic and Indic writing systems. Fixes: QTBUG-69301 Fixes: QTBUG-83358 Change-Id: If52a940bfb0267384ea002120655aed1310458a1 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit e8d9bc1bcada7d94af5a33d64a9afc860ede5b84)
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquicktextnode.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 9110a0664f..1bdc80c9a5 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -129,6 +129,22 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun
parentNode = this;
parentNode->appendChildNode(node);
+ if (style == QQuickText::Outline && color.alpha() > 0 && styleColor != color) {
+ QSGGlyphNode *fillNode = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode);
+ fillNode->setOwnerElement(m_ownerElement);
+ fillNode->setGlyphs(position + QPointF(0, glyphs.rawFont().ascent()), glyphs);
+ fillNode->setStyle(QQuickText::Normal);
+ fillNode->setPreferredAntialiasingMode(QSGGlyphNode::GrayAntialiasing);
+ fillNode->setColor(color);
+ fillNode->update();
+
+ fillNode->geometry()->setIndexDataPattern(QSGGeometry::StaticPattern);
+ fillNode->geometry()->setVertexDataPattern(QSGGeometry::StaticPattern);
+
+ parentNode->appendChildNode(fillNode);
+ fillNode->setRenderOrder(node->renderOrder() + 1);
+ }
+
return node;
}