Fix regression causing synthesized oblique glyphs to clip

In 20009ed797 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 <qt_sanity_bot@ovi.com>
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2011-09-19 15:55:39 +02:00 committed by Qt by Nokia
parent 6e1f1df625
commit 4a34b671f8

View File

@ -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));