diff options
author | Ziming Song <s.ziming@hotmail.com> | 2022-12-06 16:30:40 +0800 |
---|---|---|
committer | Ziming Song <s.ziming@hotmail.com> | 2022-12-09 04:33:57 +0800 |
commit | 6b1044cc3f79736b9d707d7f9f3cc8c3eae65193 (patch) | |
tree | 36ae2eb4513ce23a9f70a867e3673307ef398a3f /src | |
parent | 0326ea08b1d856b5d879564d8dc4a122ad457575 (diff) |
QTextEngine: also round x-offset for non-subpixel text render
If horizontal subpixel is not supported, both glyph advance and
x-offset should be rounded. Or the position of rendered glyph might
be fraction number.
Fixes: QTBUG-104895
Change-Id: Ia572764bb87db9712847ceea532d8d424ec7704b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 2dfb7f0073..c174eefa70 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1734,8 +1734,10 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, } if (!actualFontEngine->supportsHorizontalSubPixelPositions()) { - for (uint i = 0; i < num_glyphs; ++i) + for (uint i = 0; i < num_glyphs; ++i) { g.advances[i] = g.advances[i].round(); + g.offsets[i].x = g.offsets[i].x.round(); + } } glyphs_shaped += num_glyphs; |