Freetype: Don't do image transform for translations
In 6ba003f73295b896aa6dc1fba099daadb4760209, we added support for transforming bitmap fonts in Freetype by rotating the rendered glyphs as images rather than using FT_Set_Transform(). However, we enabled this for all transforms, even the ones that were only doing translations, which is unnecessary and also caused some issues. We restrict the condition to only cover rotations, scales and shears and let translations be handled as before. [ChangeLog][Text][Freetype] Fixed an issue where setting a translation matrix on text using a bitmap font would cause rendering artifacts. Fixes: QTBUG-114229 Change-Id: Ib3f2870e57c881364c85432a7937f15f3664eda7 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 90e3f0bd73e5fea6e0ed3fec65e3a5864d5e132f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a9870df180
commit
7a42679a98
@ -1828,7 +1828,8 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph,
|
||||
// outline drawing. To ensure the bounding box matches the rendered glyph, we
|
||||
// need to do the same here.
|
||||
|
||||
const bool needsImageTransform = !FT_IS_SCALABLE(freetype->face) && !matrix.isIdentity();
|
||||
const bool needsImageTransform = !FT_IS_SCALABLE(freetype->face)
|
||||
&& matrix.type() > QTransform::TxTranslate;
|
||||
if (needsImageTransform && format == QFontEngine::Format_Mono)
|
||||
format = QFontEngine::Format_A8;
|
||||
Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix, true, true);
|
||||
@ -1957,7 +1958,8 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g,
|
||||
const QFixedPoint &subPixelPosition,
|
||||
const QTransform &t)
|
||||
{
|
||||
const bool needsImageTransform = !FT_IS_SCALABLE(freetype->face) && !t.isIdentity();
|
||||
const bool needsImageTransform = !FT_IS_SCALABLE(freetype->face)
|
||||
&& t.type() > QTransform::TxTranslate;
|
||||
const GlyphFormat neededFormat = antialias || needsImageTransform ? Format_A8 : Format_Mono;
|
||||
|
||||
Glyph *glyph = loadGlyphFor(g, subPixelPosition, neededFormat, t, false, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user