diff --git a/src/OT/glyf/CompositeGlyph.hh b/src/OT/glyf/CompositeGlyph.hh index f0ff8e3e8..abe4c8330 100644 --- a/src/OT/glyf/CompositeGlyph.hh +++ b/src/OT/glyf/CompositeGlyph.hh @@ -25,13 +25,16 @@ struct CompositeGlyphRecord USE_MY_METRICS = 0x0200, OVERLAP_COMPOUND = 0x0400, SCALED_COMPONENT_OFFSET = 0x0800, - UNSCALED_COMPONENT_OFFSET = 0x1000 + UNSCALED_COMPONENT_OFFSET = 0x1000, + GID_IS_24BIT = 0x2000 }; public: unsigned int get_size () const { unsigned int size = min_size; + /* glyphIndex is 24bit instead of 16bit */ + if (flags & GID_IS_24BIT) size += HBGlyphID24::static_size - HBGlyphID16::static_size; /* arg1 and 2 are int16 */ if (flags & ARG_1_AND_2_ARE_WORDS) size += 4; /* arg1 and 2 are int8 */ @@ -60,7 +63,11 @@ struct CompositeGlyphRecord bool is_anchored () const { return !(flags & ARGS_ARE_XY_VALUES); } void get_anchor_points (unsigned int &point1, unsigned int &point2) const { - const HBUINT8 *p = &StructAfter (glyphIndex); + const auto *p = &StructAfter (flags); + if (flags & GID_IS_24BIT) + p += HBGlyphID24::static_size; + else + p += HBGlyphID16::static_size; if (flags & ARG_1_AND_2_ARE_WORDS) { point1 = ((const HBUINT16 *) p)[0]; @@ -101,8 +108,12 @@ struct CompositeGlyphRecord matrix[0] = matrix[3] = 1.f; matrix[1] = matrix[2] = 0.f; + const auto *p = &StructAfter (flags); + if (flags & GID_IS_24BIT) + p += HBGlyphID24::static_size; + else + p += HBGlyphID16::static_size; int tx, ty; - const HBINT8 *p = &StructAfter (glyphIndex); if (flags & ARG_1_AND_2_ARE_WORDS) { tx = *(const HBINT16 *) p; @@ -145,12 +156,25 @@ struct CompositeGlyphRecord } public: - hb_codepoint_t get_gid () const { return glyphIndex; } - void set_gid (hb_codepoint_t gid) { glyphIndex = gid; } + hb_codepoint_t get_gid () const + { + if (flags & GID_IS_24BIT) + return StructAfter (flags); + else + return StructAfter (flags); + } + void set_gid (hb_codepoint_t gid) + { + if (flags & GID_IS_24BIT) + StructAfter (flags) = gid; + else + /* TODO assert? */ + StructAfter (flags) = gid; + } protected: HBUINT16 flags; - HBGlyphID16 glyphIndex; + HBUINT24 pad; public: DEFINE_SIZE_MIN (4); };