aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextnode.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-08-12 09:27:03 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-08-17 07:09:31 +0200
commitcbbbfe3bff29d8db84771e07ac6f16209b0969d1 (patch)
treea37c1a23cadc6ae6a0d8e367d0b582768e943e6a /src/quick/items/qquicktextnode.cpp
parent0cb02b7ee0f72674640ffe5a0fabc1dacc259de0 (diff)
Add renderTypeQuality property to Text element
For large scale text, the default distance field size gives artifacts on certain font features. We already have an environment variable which overrides this on an application level, but this will cause all distance fields to be rendered at the high resolution, whereas you may just want it for one particular text field. Since this becomes an especially important use case now that we can embed the text fields in a 3D scene, we add a property which can be used to tweak the base font size used for generating the distance fields. [ChangeLog][QtQuick][Text] Added "renderTypeQuality" property, which can be used in cases of very large fonts, where Qt's font rasterization may show some rendering artifacts when using the default quality. Fixes: QTBUG-84696 Change-Id: Ie4205e82cf441562dcc65a8e432a941a3baeddf3 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/items/qquicktextnode.cpp')
-rw-r--r--src/quick/items/qquicktextnode.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 1bdc80c9a5..2ee8d08fff 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -78,7 +78,7 @@ namespace {
Creates an empty QQuickTextNode
*/
QQuickTextNode::QQuickTextNode(QQuickItem *ownerElement)
- : m_cursorNode(nullptr), m_ownerElement(ownerElement), m_useNativeRenderer(false)
+ : m_cursorNode(nullptr), m_ownerElement(ownerElement), m_useNativeRenderer(false), m_renderTypeQuality(-1)
{
#ifdef QSG_RUNTIME_DESCRIPTION
qsgnode_set_description(this, QLatin1String("text"));
@@ -107,7 +107,7 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun
}
}
- QSGGlyphNode *node = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode);
+ QSGGlyphNode *node = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode, m_renderTypeQuality);
node->setOwnerElement(m_ownerElement);
node->setGlyphs(position + QPointF(0, glyphs.rawFont().ascent()), glyphs);
@@ -130,7 +130,7 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun
parentNode->appendChildNode(node);
if (style == QQuickText::Outline && color.alpha() > 0 && styleColor != color) {
- QSGGlyphNode *fillNode = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode);
+ QSGGlyphNode *fillNode = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode, m_renderTypeQuality);
fillNode->setOwnerElement(m_ownerElement);
fillNode->setGlyphs(position + QPointF(0, glyphs.rawFont().ascent()), glyphs);
fillNode->setStyle(QQuickText::Normal);