Skip to content

Allow larger linearAdvance #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/gui/text/freetype/qfontengine_ft.cpp
Original file line number Diff line number Diff line change
@@ -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;

2 changes: 1 addition & 1 deletion src/gui/text/qfontengine_p.h
Original file line number Diff line number Diff line change
@@ -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;