diff options
author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2023-01-10 17:59:44 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-01-30 19:23:00 +0000 |
commit | fcacc00bc80459a33b8b9583af5591c0ca6f183a (patch) | |
tree | 661b3ca19fd1c5a4254f30a56885cd7d0b017bb8 /src | |
parent | 20e1812301b74a3c07796b69de3022e6f5633666 (diff) |
Fix positioning of text decoration with some fonts
Actually it just reverts 4db31cbd4e29cf5387f4332537f8ea9e0e9f62ae.
When calculating a position for a decoration, we should just apply the
decoration's offset to the line's baseline (line.y + line.ascent).
The regression was introduced by 54b5287adf4f5b004fcf47840c7f2e1e561a90c1
in Qt 5.6, when we switched from prepending leading to the baseline
of text and started appending it instead.
Fixes: QTBUG-96700
Fixes: QTBUG-97594
Change-Id: I7f816b71859ffcb6b1c641f0c8b8e1d810bfc525
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5d082dc9b87cfce68676f2fc1666a54afd8399b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquicktextnodeengine.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 7b4b41925a..2b9c3acde8 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -209,10 +209,7 @@ void QQuickTextNodeEngine::addTextDecorations(const QVarLengthArray<TextDecorati { QRectF &rect = textDecoration.rect; - rect.setY(qRound(rect.y() - + m_currentLine.ascent() - + (m_currentLine.leadingIncluded() ? m_currentLine.leading() : qreal(0.0f)) - + offset)); + rect.setY(qRound(rect.y() + m_currentLine.ascent() + offset)); rect.setHeight(thickness); } |