diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-11-08 12:28:23 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-10 23:04:21 +0100 |
commit | f9399d69add411adf757e3390488ff57655833b7 (patch) | |
tree | 3e81b7faf2f0467a7bff6c5e710895ecb567319c | |
parent | 8462a6933c843eeed2d94d83d4b10f7c946a5475 (diff) |
Force FT font engine to load the right glyph metrics
Change-Id: If027ea4c1a3b2ca8f972592abe3534165f62cf4e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 2166ae7975..b953f8d81f 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -152,6 +152,18 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const continue; if (listItemCoordinates.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition))) continue; + + // This is a rather crude hack, but it works. + // The FreeType font engine is not capable of getting precise metrics for the alphamap + // without first rasterizing the glyph. If we force the glyph to be rasterized before + // we ask for the alphaMapBoundingBox(), the glyph will be loaded, rasterized and its + // proper metrics will be cached and used later. + if (fontEngine->hasInternalCaching()) { + QImage *locked = fontEngine->lockedAlphaMapForGlyph(glyph, subPixelPosition, format); + if (locked) + fontEngine->unlockAlphaMapForGlyph(); + } + glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, subPixelPosition, m_transform, format); #ifdef CACHE_DEBUG |