summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_ft.cpp
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2014-11-26 10:12:55 +0000
committerKonstantin Ritt <ritt.ks@gmail.com>2014-12-04 19:21:15 +0100
commit1edc7554deb557e3045076336e4b036109906db1 (patch)
tree3e10b56e828206ffe9f7b9f4e27da778aaec5da7 /src/gui/text/qfontengine_ft.cpp
parent33739ccb95b5341bbf8173350a66a766277e9bc1 (diff)
FreeType: Fix font rendering with fonts with embedded bitmaps
Only reproduced with Windows font Calibri. This font has both outline (vector) and bitmap glyphs. QFontEngine_FT has an hack to get metrics from EBLC table, but this might fail, resulting in a 0 ascender and descender, meaning QFontMetrics::height() will be 0, meaning totally broken text. This patch checks for that failure, and fallbacks to the outline metrics instead of the bitmap ones. Task-number: QTBUG-42898 Change-Id: If33fc3404d0c7f84557f8c4a5ae71b30f78d60a7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/gui/text/qfontengine_ft.cpp')
-rw-r--r--src/gui/text/qfontengine_ft.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index e2c8f905b9..0a8be67e43 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -762,8 +762,10 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
face->face_flags &= ~FT_FACE_FLAG_SCALABLE;
FT_Select_Size(face, i);
- metrics.ascender = face->size->metrics.ascender;
- metrics.descender = face->size->metrics.descender;
+ if (face->size->metrics.ascender + face->size->metrics.descender > 0) {
+ metrics.ascender = face->size->metrics.ascender;
+ metrics.descender = face->size->metrics.descender;
+ }
FT_Set_Char_Size(face, xsize, ysize, 0, 0);
face->face_flags |= FT_FACE_FLAG_SCALABLE;