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>
This commit is contained in:
Ziming Song 2022-12-06 16:30:40 +08:00
parent 0326ea08b1
commit 6b1044cc3f

View File

@ -1734,8 +1734,10 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
} }
if (!actualFontEngine->supportsHorizontalSubPixelPositions()) { 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.advances[i] = g.advances[i].round();
g.offsets[i].x = g.offsets[i].x.round();
}
} }
glyphs_shaped += num_glyphs; glyphs_shaped += num_glyphs;