[WIP] [name] Port to fancy serializer machinery

This commit is contained in:
Behdad Esfahbod 2019-05-02 16:29:07 -07:00
parent fa2d97161f
commit c548fcedc4
1 changed files with 11 additions and 7 deletions

View File

@ -279,17 +279,21 @@ struct name
this->format = 0; this->format = 0;
this->count = name_record_idx_to_retain.length; this->count = name_record_idx_to_retain.length;
this->stringOffset = min_size + name_record_idx_to_retain.length * NameRecord::static_size;
auto snap = c->snapshot ();
this->nameRecordZ.serialize (c, this->count);
this->stringOffset = c->length ();
c->revert (snap);
if (!serialize_name_record (c, source_name, name_record_idx_to_retain)) auto src_array = source_name->nameRecordZ.as_array (source_name->count);
return_trace (false); const void *src_base = &(source_name + source_name->stringOffset);
const void *dst_base = &(this + this->stringOffset);
if (!serialize_strings (c, source_name, plan, name_record_idx_to_retain)) + hb_iter (name_record_idx_to_retain)
return_trace (false); | hb_apply ([&] (unsigned _) { c->copy (src_array[_], src_base, dst_base); })
;
if (!pack_record_and_strings (this, c, name_record_idx_to_retain.length)) assert (this->stringOffset == c->length ());
return_trace (false);
return_trace (true); return_trace (true);
} }