aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2022-06-21 13:44:36 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-12 12:54:30 +0000
commitc6780664c692af52e7ae006a9d967cdf10043f50 (patch)
tree528ee8e08f80ddd599160d819ddd05b0a3c49268 /src/quick
parentf501aae4dae7c6debaee63be2eec85cf82a30eb5 (diff)
Fix fractional scaling of text in Qt Quick
As opposed to the raster engine, in Qt Quick we are using unscaled positions for the glyphs and using the vertex shader to scale these after the fact. However, when picking the correct subpixel rendering for each glyph, we would use the unscaled position's fractional part, meaning that we essentially rendered the glyphs at the wrong subpixel position. This was especially visible when doing fractional scaling, e.g. 125%. Instead, we need to ensure that we pick the rendering at the on-screen subpixel position. [ChangeLog][QtQuick][Text] Fixed a kerning issue with native-rendered text when there is a fractional system scale factor set. Fixes: QTBUG-101008 Change-Id: Ic0f94d8b4ca5998dca638bdf7e2a16306d92a926 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 97cc7023ce8b8d903351a2e13f515592854c56fc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index a87fdc29c0..bc34bc063b 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -483,8 +483,12 @@ void QSGTextMaskMaterial::populate(const QPointF &p,
QTextureGlyphCache *cache = glyphCache();
QRawFontPrivate *fontD = QRawFontPrivate::get(m_font);
- cache->populate(fontD->fontEngine, glyphIndexes.size(), glyphIndexes.constData(),
- fixedPointPositions.data());
+ cache->populate(fontD->fontEngine,
+ glyphIndexes.size(),
+ glyphIndexes.constData(),
+ fixedPointPositions.data(),
+ QPainter::RenderHints(),
+ true);
cache->fillInPendingGlyphs();
int margin = fontD->fontEngine->glyphMargin(cache->glyphFormat());
@@ -506,7 +510,7 @@ void QSGTextMaskMaterial::populate(const QPointF &p,
QPointF glyphPosition = glyphPositions.at(i) + position;
QFixed subPixelPosition;
if (supportsSubPixelPositions)
- subPixelPosition = fontD->fontEngine->subPixelPositionForX(QFixed::fromReal(glyphPosition.x()));
+ subPixelPosition = fontD->fontEngine->subPixelPositionForX(QFixed::fromReal(glyphPosition.x() * glyphCacheScaleX));
QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphIndexes.at(i),
QFixedPoint(subPixelPosition, 0));