diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 896f7a015..a2521dcea 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -320,17 +320,21 @@ struct OffsetTo : Offset /* TODO: Somehow merge this with previous function into a serialize_dispatch(). */ template - bool serialize_copy (hb_serialize_context_t *c, const Type &src, const void *base, Ts&&... ds) + bool serialize_copy (hb_serialize_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; c->push (); - bool ret = c->copy (src, hb_forward (ds)...); + bool ret = c->copy (src_base+src, hb_forward (ds)...); - c->add_link (*this, c->pop_pack (), base); + c->add_link (*this, c->pop_pack (), dst_base); return ret; } diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index bd728ecad..b1f4d06ab 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -279,10 +279,10 @@ struct Script TRACE_SUBSET (this); auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); - out->defaultLangSys.serialize_copy (c->serializer, this+defaultLangSys, out); + out->defaultLangSys.serialize_copy (c->serializer, defaultLangSys, this, out); unsigned int count = langSys.len; for (unsigned int i = 0; i < count; i++) - out->langSys.arrayZ[i].offset.serialize_copy (c->serializer, this+langSys[i].offset, out); + out->langSys.arrayZ[i].offset.serialize_copy (c->serializer, langSys[i].offset, this, out); return_trace (true); } diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 7d395b5d8..987689d3b 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -2695,7 +2695,7 @@ struct GSUBGPOS out); if (version.to_int () >= 0x00010001u) - out->featureVars.serialize_copy (c->serializer, this+featureVars, out); + out->featureVars.serialize_copy (c->serializer, featureVars, this, out); return_trace (true); } diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 4eda46789..68d7b3a65 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -104,7 +104,7 @@ struct NameRecord TRACE_SERIALIZE (this); auto *out = c->embed (this); if (unlikely (!out)) return_trace (nullptr); - out->offset.serialize_copy (c, src_base + offset, dst_base, length); + out->offset.serialize_copy (c, offset, src_base, dst_base, length); return_trace (out); }