Change some members of QFontEngineFT::Glyph to short

Some color bitmap fonts will have a size greater than 127 pixels,
 areMetricsTooLarge() will return true(its advance exceed 127) for
 these fonts and we are unable to render these fonts since
 QFontEngineFT::loadGlyph() will simply do nothing if
 areMetricsTooLarge() return true. To support bitmap font whose size
 is between 128 and 255, we change x,y,advance of QFontEngineFT::Glyph
 to short variable to make areMetricsTooLarge() return false, in this
 way we will be able to render such color bitmap fonts.

Change-Id: I9ab244b14884cdde91040a462f2fbca650b91289
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Jian Liang 2016-04-28 22:14:20 +08:00 committed by jian liang
parent c8e4d15004
commit d2304a28ca
2 changed files with 4 additions and 7 deletions

View File

@ -849,11 +849,8 @@ static inline bool areMetricsTooLarge(const QFontEngineFT::GlyphInfo &info)
{ {
// false if exceeds QFontEngineFT::Glyph metrics // false if exceeds QFontEngineFT::Glyph metrics
return (short)(info.linearAdvance) != info.linearAdvance return (short)(info.linearAdvance) != info.linearAdvance
|| (signed char)(info.xOff) != info.xOff
|| (uchar)(info.width) != info.width || (uchar)(info.width) != info.width
|| (uchar)(info.height) != info.height || (uchar)(info.height) != info.height;
|| (signed char)(info.x) != info.x
|| (signed char)(info.y) != info.y;
} }
QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,

View File

@ -140,9 +140,9 @@ public:
short linearAdvance; short linearAdvance;
unsigned char width; unsigned char width;
unsigned char height; unsigned char height;
signed char x; short x;
signed char y; short y;
signed char advance; short advance;
signed char format; signed char format;
uchar *data; uchar *data;
}; };