summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-09-19 15:55:39 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-19 16:37:51 +0200
commit4a34b671f8f423fd4904e3947a3590d2088fb438 (patch)
tree29342a9e3b5f9f899889a18c50d927a01283c5c3 /src
parent6e1f1df625a85894822ea107b3c9423ad69441b7 (diff)
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 <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontengine_ft.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 6a65aad1c1..1e7c3a2e1d 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));