From bf0af8b5a24de7e595929a64948a3548936aaaee Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 19 Nov 2015 18:10:20 +0100 Subject: Round advances if subpixel position not supported Due to kerning and other OpenType features, it's possible that the advances from the shaping process are fractional, but this gives uneven glyph positioning for font engines that don't support subpixel positioning (since the glyph will not match the expected position, some gaps will look too large and some too small). To match how e.g. GDI renders this, we round the advances before setting the glyph positions for engines that do not support subpixel positions. [ChangeLog][Windows] Fixed uneven kerning for some fonts. Task-number: QTBUG-48546 Change-Id: Ic00dc402abf7149aab6bf9b05b42827b805c1a15 Reviewed-by: Konstantin Ritt --- src/gui/text/qtextengine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 31b1109b6a..1c924175e2 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1277,14 +1277,14 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st for (uint i = 0; i < num_glyphs; ++i) g.advances[i] *= stretch; } - - if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) { - for (uint i = 0; i < num_glyphs; ++i) - g.advances[i] = g.advances[i].round(); - } } #endif + if (!actualFontEngine->supportsSubPixelPositions() || (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics)) { + for (uint i = 0; i < num_glyphs; ++i) + g.advances[i] = g.advances[i].round(); + } + glyphs_shaped += num_glyphs; } -- cgit v1.2.3