[subset] Fix serialize_subset() calls

Ouch.
This commit is contained in:
Behdad Esfahbod 2018-09-03 16:37:17 -07:00
parent 7c9cfa2b40
commit 49c44b58f6
4 changed files with 13 additions and 14 deletions

View File

@ -525,7 +525,7 @@ struct OffsetListOf : OffsetArrayOf<Type>
if (unlikely (!out)) return_trace (false); if (unlikely (!out)) return_trace (false);
unsigned int count = this->len; unsigned int count = this->len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
out->arrayZ[i].serialize_subset (c, (*this)[i], this); out->arrayZ[i].serialize_subset (c, (*this)[i], out);
return_trace (true); return_trace (true);
} }

View File

@ -144,7 +144,7 @@ struct RecordListOf : RecordArrayOf<Type>
if (unlikely (!out)) return_trace (false); if (unlikely (!out)) return_trace (false);
unsigned int count = this->len; unsigned int count = this->len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
out->get_offset (i).serialize_subset (c, (*this)[i], this); out->get_offset (i).serialize_subset (c, (*this)[i], out);
return_trace (true); return_trace (true);
} }
@ -283,10 +283,10 @@ struct Script
TRACE_SUBSET (this); TRACE_SUBSET (this);
struct Script *out = c->serializer->embed (*this); struct Script *out = c->serializer->embed (*this);
if (unlikely (!out)) return_trace (false); if (unlikely (!out)) return_trace (false);
out->defaultLangSys.serialize_subset (c, this+defaultLangSys, this); out->defaultLangSys.serialize_subset (c, this+defaultLangSys, out);
unsigned int count = langSys.len; unsigned int count = langSys.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
out->langSys.arrayZ[i].offset.serialize_subset (c, this+langSys[i].offset, this); out->langSys.arrayZ[i].offset.serialize_subset (c, this+langSys[i].offset, out);
return_trace (true); return_trace (true);
} }

View File

@ -1402,14 +1402,13 @@ struct GSUB : GSUBGPOS
inline bool subset (hb_subset_context_t *c) const inline bool subset (hb_subset_context_t *c) const
{ {
TRACE_SUBSET (this); TRACE_SUBSET (this);
//struct GSUB *out = c->serializer->start_embed<GSUB> (); struct GSUB *out = c->serializer->start_embed<GSUB> ();
if (unlikely (!GSUBGPOS::subset (c))) return_trace (false); if (unlikely (!GSUBGPOS::subset (c))) return_trace (false);
/* TODO Replace following with c->iter_copy_and_subset()ish. */ const OffsetTo<SubstLookupList> &list = CastR<const OffsetTo<SubstLookupList> > (lookupList);
unsigned int count = get_lookup_count (); OffsetTo<SubstLookupList> &outList = CastR<OffsetTo<SubstLookupList> > (out->lookupList);
//LookupList &outLookupList = out+out->lookupList; outList.set (0);
for (unsigned int i = 0; i < count; i++) //outList.serialize_subset (c, this+list, out);
//XXX if (unlikely (!outLookupList.arrayZ[i].subset (c, get_lookup (i), &outLookupList))) /* TODO Use intersects() to count how many subtables survive? */
return_trace (false);
return_trace (true); return_trace (true);
} }

View File

@ -2551,11 +2551,11 @@ struct GSUBGPOS
TRACE_SUBSET (this); TRACE_SUBSET (this);
struct GSUBGPOS *out = c->serializer->embed (*this); struct GSUBGPOS *out = c->serializer->embed (*this);
if (unlikely (!out)) return_trace (false); if (unlikely (!out)) return_trace (false);
out->scriptList.serialize_subset (c, this+scriptList, this); out->scriptList.serialize_subset (c, this+scriptList, out);
out->featureList.serialize_subset (c, this+featureList, this); out->featureList.serialize_subset (c, this+featureList, out);
out->lookupList.set (0); /* GSUB/GPOS fill this one in. */ out->lookupList.set (0); /* GSUB/GPOS fill this one in. */
if (version.to_int () >= 0x00010001u) if (version.to_int () >= 0x00010001u)
out->featureVars.serialize_subset (c, this+featureVars, this); out->featureVars.serialize_subset (c, this+featureVars, out);
return_trace (true); return_trace (true);
} }