Force FT font engine to load the right glyph metrics
Change-Id: If027ea4c1a3b2ca8f972592abe3534165f62cf4e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
8462a6933c
commit
f9399d69ad
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user