[VarComposite] Implement trim_padding()
This commit is contained in:
parent
591c9460dc
commit
2b042cc5c6
|
@ -58,7 +58,7 @@ struct Glyph
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
#ifndef HB_NO_VAR_COMPOSITES
|
#ifndef HB_NO_VAR_COMPOSITES
|
||||||
case VAR_COMPOSITE: return bytes; // TODO
|
case VAR_COMPOSITE: return VarCompositeGlyph (*header, bytes).trim_padding ();
|
||||||
#endif
|
#endif
|
||||||
case COMPOSITE: return CompositeGlyph (*header, bytes).trim_padding ();
|
case COMPOSITE: return CompositeGlyph (*header, bytes).trim_padding ();
|
||||||
case SIMPLE: return SimpleGlyph (*header, bytes).trim_padding ();
|
case SIMPLE: return SimpleGlyph (*header, bytes).trim_padding ();
|
||||||
|
|
|
@ -352,6 +352,13 @@ struct VarCompositeGlyph
|
||||||
var_composite_iter_t iter () const
|
var_composite_iter_t iter () const
|
||||||
{ return var_composite_iter_t (bytes, &StructAfter<VarCompositeGlyphRecord, GlyphHeader> (header)); }
|
{ return var_composite_iter_t (bytes, &StructAfter<VarCompositeGlyphRecord, GlyphHeader> (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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue