diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index a2521dcea..de2d25638 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -298,20 +298,24 @@ struct OffsetTo : Offset } template - bool serialize_subset (hb_subset_context_t *c, const Type &src, const void *base, Ts&&... ds) + bool serialize_subset (hb_subset_context_t *c, + const OffsetTo& src, + const void *src_base, + const void *dst_base, + Ts&&... ds) { *this = 0; - if (has_null && &src == _hb_has_null::get_null ()) + if (src.is_null ()) return false; auto *s = c->serializer; s->push (); - bool ret = c->dispatch (src, hb_forward (ds)...); + bool ret = c->dispatch (src_base+src, hb_forward (ds)...); if (ret || !has_null) - s->add_link (*this, s->pop_pack (), base); + s->add_link (*this, s->pop_pack (), dst_base); else s->pop_discard (); @@ -683,7 +687,7 @@ struct OffsetListOf : OffsetArrayOf if (unlikely (!out)) return_trace (false); unsigned int count = this->len; for (unsigned int i = 0; i < count; i++) - out->arrayZ[i].serialize_subset (c, (*this)[i], out); + out->arrayZ[i].serialize_subset (c, this->arrayZ[i], this, out); return_trace (true); } diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index b1f4d06ab..f801f5af8 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -142,7 +142,7 @@ struct RecordListOf : RecordArrayOf if (unlikely (!out)) return_trace (false); unsigned int count = this->len; for (unsigned int i = 0; i < count; i++) - out->get_offset (i).serialize_subset (c, (*this)[i], out); + out->get_offset (i).serialize_subset (c, this->get_offset (i), this, out); return_trace (true); } @@ -732,7 +732,7 @@ struct Lookup OffsetArrayOf& out_subtables = out->get_subtables (); unsigned int count = subTable.len; for (unsigned int i = 0; i < count; i++) - out_subtables[i].serialize_subset (c, this+subtables[i], out, get_type ()); + out_subtables[i].serialize_subset (c, subtables[i], this, out, get_type ()); return_trace (true); } diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index ac1bddb2e..0fca9947d 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -442,16 +442,16 @@ struct GDEF auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); - out->glyphClassDef.serialize_subset (c, this+glyphClassDef, out); - out->attachList = 0;//TODO(subset) serialize_subset (c, this+attachList, out); - out->ligCaretList = 0;//TODO(subset) serialize_subset (c, this+ligCaretList, out); - out->markAttachClassDef.serialize_subset (c, this+markAttachClassDef, out); + out->glyphClassDef.serialize_subset (c, glyphClassDef, this, out); + out->attachList = 0;//TODO(subset) serialize_subset (c, attachList, this, out); + out->ligCaretList = 0;//TODO(subset) serialize_subset (c, ligCaretList, this, out); + out->markAttachClassDef.serialize_subset (c, markAttachClassDef, this, out); if (version.to_int () >= 0x00010002u) - out->markGlyphSetsDef = 0;// TODO(subset) serialize_subset (c, this+markGlyphSetsDef, out); + out->markGlyphSetsDef = 0;// TODO(subset) serialize_subset (c, markGlyphSetsDef, this, out); if (version.to_int () >= 0x00010003u) - out->varStore = 0;// TODO(subset) serialize_subset (c, this+varStore, out); + out->varStore = 0;// TODO(subset) serialize_subset (c, varStore, this, out); return_trace (true); } diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 987689d3b..4bc3d7e15 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -2684,14 +2684,15 @@ struct GSUBGPOS auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); - out->scriptList.serialize_subset (c, this+scriptList, out); - out->featureList.serialize_subset (c, this+featureList, out); + out->scriptList.serialize_subset (c, scriptList, this, out); + out->featureList.serialize_subset (c, featureList, this, out); typedef OffsetListOf TLookupList; /* TODO Use intersects() to count how many subtables survive? */ CastR> (out->lookupList) .serialize_subset (c, - this+CastR> (lookupList), + CastR> (lookupList), + this, out); if (version.to_int () >= 0x00010001u)