From e8a990c67467d60d4b95a94c1b763284e331adcf Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 11 Mar 2019 11:22:02 +0100 Subject: Fix aliased font rendering in native xcb mode Freetype creates 1bpp bitmaps in msb order, while XRender expects lsb order. Change-Id: If8dd8e07c424df2d135f56f1ce105ef94963f536 Reviewed-by: Lars Knoll Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp index d43b273f4d..6ddcec0256 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp @@ -2645,6 +2645,13 @@ bool QXRenderGlyphCache::addGlyphs(const QTextItemInt &ti, if (glyph == 0 || glyph->format != glyphFormat()) return false; + if (glyph->format == QFontEngine::Format_Mono) { + // Must convert bitmap from msb to lsb bit order + QImage img(glyph->data, glyph->width, glyph->height, QImage::Format_Mono); + img = img.convertToFormat(QImage::Format_MonoLSB); + memcpy(glyph->data, img.constBits(), static_cast(img.sizeInBytes())); + } + set->setGlyph(glyphs[i], spp, glyph); Q_ASSERT(glyph->data || glyph->width == 0 || glyph->height == 0); -- cgit v1.2.3