diff --git a/src/gui/text/freetype/qfontengine_ft.cpp b/src/gui/text/freetype/qfontengine_ft.cpp index 66e7f098fdd..cc9391cd0d4 100644 --- a/src/gui/text/freetype/qfontengine_ft.cpp +++ b/src/gui/text/freetype/qfontengine_ft.cpp @@ -1133,7 +1133,7 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, static inline bool areMetricsTooLarge(const QFontEngineFT::GlyphInfo &info) { // false if exceeds QFontEngineFT::Glyph metrics - return info.width > 0xFF || info.height > 0xFF || info.linearAdvance > 0x7FFF; + return info.width > 0xFF || info.height > 0xFF; } static inline void transformBoundingBox(int *left, int *top, int *right, int *bottom, FT_Matrix *matrix) @@ -1874,7 +1874,6 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, info.height = TRUNC(top - bottom); // If any of the metrics are too large to fit, don't cache them - // Also, avoid integer overflow when linearAdvance is to large to fit in a signed short if (areMetricsTooLarge(info)) return nullptr; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 4d1243ccc51..304da0c40de 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -88,7 +88,7 @@ class Q_GUI_EXPORT QFontEngine struct Glyph { Glyph() = default; ~Glyph() { delete [] data; } - short linearAdvance = 0; + int linearAdvance = 0; unsigned short width = 0; unsigned short height = 0; short x = 0;