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>
This commit is contained in:
parent
a2ef3479b8
commit
bf0af8b5a2
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user