summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2015-11-19 18:10:20 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2015-12-02 18:25:45 +0000
commitbf0af8b5a24de7e595929a64948a3548936aaaee (patch)
treee49544d41fbb2517423028d334a9138027b23b76 /src
parenta2ef3479b8e6fcebf97e6c67f4eb1910db66cdba (diff)
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 <ritt.ks@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp10
1 files changed, 5 insertions, 5 deletions
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;
}