diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2016-01-22 14:56:18 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2016-03-30 10:33:12 +0000 |
commit | adc4e000fc1ffe1acba47ff932c092678a54b9f2 (patch) | |
tree | 8a3dcd19c585106f7071ac68271fd01fe84734b5 /src/gui | |
parent | 9bc352e38d6b03fbb12a359a7bdfc8d22aa7e192 (diff) |
QFontEngineFT: Apply hinting for non-scaled rotated glyphs
Scaled hinted glyphs looks ugly, see QTBUG-24846. It was fixed
in 6da6845f078e419ccb555fe1dd152e0ba82a7e88 by disabling hinting
for them. But at the same time that commit also disabled hinting
for glyphs with the most common transformation - rotating without
scaling.
Detect this type of transformation and don't disable hinting for it.
Change-Id: I0e69a2b60e7e4bc24e9efc4fdedb984df07ad15c
Task-number: QTBUG-50574
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index ebfd2a8182..361702681f 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1780,6 +1780,12 @@ void QFontEngineFT::unlockAlphaMapForGlyph() QFontEngine::unlockAlphaMapForGlyph(); } +static inline bool is2dRotation(const QTransform &t) +{ + return qFuzzyCompare(t.m11(), t.m22()) && qFuzzyCompare(t.m12(), -t.m21()) + && qFuzzyCompare(t.m11()*t.m22() - t.m12()*t.m21(), 1.0); +} + QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, @@ -1793,7 +1799,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, Glyph *glyph = glyphSet != 0 ? glyphSet->getGlyph(g, subPixelPosition) : 0; if (!glyph || glyph->format != format || (!fetchBoundingBox && !glyph->data)) { QScopedValueRollback<HintStyle> saved_default_hint_style(default_hint_style); - if (t.type() >= QTransform::TxScale) + if (t.type() >= QTransform::TxScale && !is2dRotation(t)) default_hint_style = HintNone; // disable hinting if the glyphs are transformed lockFace(); |