summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/fontdatabases
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-06-02 13:43:06 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-06-03 07:00:32 +0200
commitc2dcb7eaa19251123f9fa9546f4fe3508751b918 (patch)
tree8ae1e3ac2b1b9b91d34dde5ed7b9c689efa955e1 /src/platformsupport/fontdatabases
parent7f927b373e4652af9777748c5e2bce4bddad8da3 (diff)
Windows: Fix QPainter warnings when using some fonts
Some fonts, like Segoe UI, have empty glyphs defined for characters such as space. When there is a margin on the glyphs, we would previously render them as 4x4 completely transparent images. This is a waste of time, and in the case of DirectWrite, we fixed it in bb67c3b68b00fb2075a971f4f0d58e1867ef7128 so that it will always return an invalid image when the glyph does not have dimensions. But since we did not account for this in alphaMapBoundingBox(), the texture glyph cache did not detect this case and would request the empty image and try to add it to the cache. Fixes: QTBUG-84629 Pick-to: 5.15 Change-Id: I470a4a55577c5e9239bf77de81c2b381bf8e6a49 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/platformsupport/fontdatabases')
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
index 6070d59a3e..4c1bfc4d43 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
@@ -1046,6 +1046,9 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph
int margin = glyphMargin(format);
+ if (rect.left == rect.right || rect.top == rect.bottom)
+ return glyph_metrics_t();
+
return glyph_metrics_t(rect.left,
rect.top,
rect.right - rect.left + margin * 2,