summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-02-05 12:36:37 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-02-08 10:01:03 +0100
commit6a64b8ed56d70d76cc154e66f03824b3c3a2a786 (patch)
tree6dcbccd72f501985069ee9f951d678be883e3740 /src
parent41883b3b9ef43bc4c7b47a19b59f3ee8143db3da (diff)
Fix crash when requesting A32 glyph on Wayland
On Wayland we aren't getting any information about the subpixel layout of the screen. On Freetype, this triggers an assert / memory corruption when explicitly requesting a subpixel antialiased glyph (via QRawFont) because it needs to know the layout to render the glyphs. It might be possible to get this information in the Wayland plugin, but at least we should have a failsafe which doesn't crash when the problem occurs. This simply falls back to using A8 antialiasing when it doesn't know the subpixel layout. [ChangeLog][Freetype] Fixed crash when calling QRawFont::alphaMapForGlyph() with subpixel antialiasing on Wayland. Fixes: QTBUG-90236 Change-Id: Iddee2e171a81664ae9e3989115881f23262b2182 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit ef763e195892a6d8ce207f5d947fe508f645cb6d)
Diffstat (limited to 'src')
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
index 13c49ab404..9922fd6c7f 100644
--- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
+++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
@@ -1078,7 +1078,11 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
renderMode = FT_RENDER_MODE_MONO;
break;
case Format_A32:
- Q_ASSERT(hsubpixel || vfactor != 1);
+ if (!hsubpixel && vfactor == 1) {
+ qWarning("Format_A32 requested, but subpixel layout is unknown.");
+ return nullptr;
+ }
+
renderMode = hsubpixel ? FT_RENDER_MODE_LCD : FT_RENDER_MODE_LCD_V;
break;
case Format_A8: