From: Eskil Abrahamsen Blomfeldt Date: Mon, 19 Sep 2011 13:55:39 +0000 (+0200) Subject: Fix regression causing synthesized oblique glyphs to clip X-Git-Tag: qt-v5.0.0-alpha1~3539 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a34b671f8f423fd4904e3947a3590d2088fb438;p=profile%2Fivi%2Fqtbase.git Fix regression causing synthesized oblique glyphs to clip In 20009ed797fb30952a889df5716aa2399102be58 I introduced a new approach to synthesized oblique. However, while the embolden function in FT alters the glyph metrics accordingly, the oblique function does not, so the glyphs would be clipped to the original, unslanted metrics. So I've implemented the same matrix in the loadGlyph() function and we now apply this to the metrics manually. This will only work as long as the underlying algorithm doesn't change significantly. Task-number: QTBUG-21202 Change-Id: Ic20b2a0fdeac5ce833e95fd06efa12b3b70feee5 Reviewed-on: http://codereview.qt-project.org/5156 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang --- diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 6a65aad..1e7c3a2 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -892,7 +892,21 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, FT_GlyphSlot slot = face->glyph; if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot); - if (obliquen) Q_FT_GLYPHSLOT_OBLIQUE(slot); + if (obliquen) { + Q_FT_GLYPHSLOT_OBLIQUE(slot); + + // While Embolden alters the metrics of the slot, oblique does not, so we need + // to fix this ourselves. + transform = true; + FT_Matrix m; + m.xx = 0x10000; + m.yx = 0x0; + m.xy = 0x6000; + m.yy = 0x10000; + + FT_Matrix_Multiply(&m, &matrix); + } + FT_Library library = qt_getFreetype(); info.xOff = TRUNC(ROUND(slot->advance.x));