From 25677ec4b2957f7fd56618781dec28cb139f9df7 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 25 Feb 2020 15:59:31 +0100 Subject: Fix bounding box of zero-width entities in QFontEngineFT Freetype can give us non empty bounds for zero-width characters, this change just makes us skip metrics of characters already found to not contribute to text advance. The coretext and windows font-engines already uses the already calculated advance. Change-Id: I82b3521a4fb92614be509be5982cd5ab9c1eb7de Fixes: QTBUG-58854 Reviewed-by: Konstantin Ritt Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 8c6cc8fbc1..d176f60d10 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -1672,6 +1672,9 @@ glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs) QFixed ymax = 0; QFixed xmax = 0; for (int i = 0; i < glyphs.numGlyphs; i++) { + // If shaping has found this should be ignored, ignore it. + if (!glyphs.advances[i] || glyphs.attributes[i].dontPrint) + continue; Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs.glyphs[i]) : 0; if (!g) { if (!face) -- cgit v1.2.3