summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <[email protected]>2025-03-07 10:56:55 +0100
committerEskil Abrahamsen Blomfeldt <[email protected]>2025-03-07 15:12:39 +0100
commit54555755f8780e4e7c665a1502309da9fa807066 (patch)
tree6a91043bbb3d3896c774f5f7a842c440de54d134
parent11f7ab988e1b8f601506100e6d654fc9a2506260 (diff)
windows: Fix rendering monochrome glyphs in color fontsv6.9.0-rc1
If we encounter a normal, monochrome glyph in a color font, we go via the normal glyph rendering code path. But since we are drawing into a color-capable glyph cache, we need to make sure the image we draw has an alpha channel. This was inadvertedly broken by the refactoring in 1b85143d217042876209794bf8d0361b7ce8834f, causing black backgrounds on all such glyphs. Since the default font in Qt Creator is a color font, it was noticed when upgrading this to 6.9. Pick-to: dev 6.9 Fixes: QTBUG-134473 Change-Id: Iee7eb73a5727324e2ff3bacc2d9ae45cb64fd0b9 Reviewed-by: Eirik Aavitsland <[email protected]> Reviewed-by: David Schulz <[email protected]>
-rw-r--r--src/gui/text/windows/qwindowsfontenginedirectwrite.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp b/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
index 791e17f1d69..34c0d1b4047 100644
--- a/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
@@ -1663,8 +1663,10 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
// -1 due to Qt's off-by-one definition of a QRect
image = QImage(boundingRect.width() - 1,
boundingRect.height() - 1,
- QImage::Format_RGB32);
- image.fill(0xffffffff);
+ glyphFormat == QFontEngine::Format_ARGB
+ ? QImage::Format_ARGB32_Premultiplied
+ : QImage::Format_RGB32);
+ image.fill(image.format() == QImage::Format_ARGB32_Premultiplied ? 0x0 : 0xffffffff);
float r, g, b, a;
if (glyphFormat == QFontEngine::Format_ARGB) {