Make OpenGL texture glyph cache use the right freetype glyphs

The freetype font engine would fall back to rasterizing glyphs
via QPainterPath in QFontEngine::alphaMapForGlyph() which has
a rather unfortunate implementation.

Change-Id: Ic0b4095b6f17ab33f0602139f0a8fb441dfba0ee
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Gunnar Sletta 2013-11-05 20:20:07 +01:00 committed by The Qt Project
parent 6d45bf683e
commit f78661b03c

View File

@ -303,7 +303,17 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
return;
}
QImage mask = textureMapForGlyph(glyph, subPixelPosition);
QImage mask;
if (m_current_fontengine->hasInternalCaching()) {
QImage *alphaMap = m_current_fontengine->lockedAlphaMapForGlyph(glyph, subPixelPosition, QFontEngine::Format_None);
if (!alphaMap || alphaMap->isNull())
return;
mask = alphaMap->copy();
m_current_fontengine->unlockAlphaMapForGlyph();
} else {
mask = textureMapForGlyph(glyph, subPixelPosition);
}
const int maskWidth = mask.width();
const int maskHeight = mask.height();