copy all cmap groups at once

This commit is contained in:
Rod Sheeter 2018-02-14 10:52:41 -08:00
parent d008b62887
commit a0fe3011ba
1 changed files with 4 additions and 10 deletions

View File

@ -272,17 +272,12 @@ struct CmapSubtableLongSegmented
} }
inline bool serialize(hb_serialize_context_t *context, inline bool serialize(hb_serialize_context_t *context,
unsigned int group_count, hb_prealloced_array_t<CmapSubtableLongGroup> &group_data)
Supplier<CmapSubtableLongGroup> &group_supplier)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely(!context->extend_min (*this))) return_trace (false); if (unlikely(!context->extend_min (*this))) return_trace (false);
if (unlikely(!groups.serialize(context, group_count))) return_trace (false); if (unlikely(!groups.serialize(context, group_data.len))) return_trace (false);
for (unsigned int i = 0; i < group_count; i++) memcpy(&groups[0], &group_data[0], group_data.len * sizeof(CmapSubtableLongGroup));
{
const CmapSubtableLongGroup &group = group_supplier[i];
memcpy(&groups[i], &group, sizeof(group));
}
return true; return true;
} }
@ -594,8 +589,7 @@ struct cmap
format12.reservedZ.set(0); format12.reservedZ.set(0);
format12.lengthZ.set(16 + 12 * groups.len); format12.lengthZ.set(16 + 12 * groups.len);
OT::Supplier<CmapSubtableLongGroup> group_supplier (&groups[0], groups.len, sizeof (CmapSubtableLongGroup)); if (unlikely(!format12.serialize(&context, groups)))
if (unlikely(!format12.serialize(&context, groups.len, group_supplier)))
{ {
return false; return false;
} }