diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index d772cfc5e..914b484e5 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -58,7 +58,7 @@ struct Glyph { switch (type) { #ifndef HB_NO_VAR_COMPOSITES - case VAR_COMPOSITE: return bytes; // TODO + case VAR_COMPOSITE: return VarCompositeGlyph (*header, bytes).trim_padding (); #endif case COMPOSITE: return CompositeGlyph (*header, bytes).trim_padding (); case SIMPLE: return SimpleGlyph (*header, bytes).trim_padding (); diff --git a/src/OT/glyf/VarCompositeGlyph.hh b/src/OT/glyf/VarCompositeGlyph.hh index 189122bed..8c774aa27 100644 --- a/src/OT/glyf/VarCompositeGlyph.hh +++ b/src/OT/glyf/VarCompositeGlyph.hh @@ -352,6 +352,13 @@ struct VarCompositeGlyph var_composite_iter_t iter () const { return var_composite_iter_t (bytes, &StructAfter (header)); } + const hb_bytes_t trim_padding () const + { + unsigned length = GlyphHeader::static_size; + for (auto &comp : iter ()) + length += comp.get_size (); + return bytes.sub_array (0, length); + } };