From f78661b03cc1affcdd222be50b35d956edac4711 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 5 Nov 2013 20:20:07 +0100 Subject: 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 --- src/gui/opengl/qopengltextureglyphcache.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 061e8f4166..3b62d1d63a 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -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(); -- cgit v1.2.3