summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qtextureglyphcache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qtextureglyphcache.cpp')
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp12
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