Templatize GSUBGPOS::sanitize()

pull/1151/head
Behdad Esfahbod 6 years ago
parent 49c44b58f6
commit 6d618522d6
  1. 6
      src/hb-ot-layout-gpos-table.hh
  2. 14
      src/hb-ot-layout-gsub-table.hh
  3. 4
      src/hb-ot-layout-gsubgpos.hh

@ -1548,8 +1548,6 @@ struct PosLookup : Lookup
}
};
typedef OffsetListOf<PosLookup> PosLookupList;
/*
* GPOS -- Glyph Positioning
* https://docs.microsoft.com/en-us/typography/opentype/spec/gpos
@ -1569,9 +1567,7 @@ struct GPOS : GSUBGPOS
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!GSUBGPOS::sanitize (c))) return_trace (false);
const OffsetTo<PosLookupList> &list = CastR<OffsetTo<PosLookupList> > (lookupList);
return_trace (list.sanitize (c, this));
return_trace (GSUBGPOS::sanitize<PosLookup> (c));
}
typedef GSUBGPOS::accelerator_t<GPOS> accelerator_t;

@ -1385,8 +1385,6 @@ struct SubstLookup : Lookup
}
};
typedef OffsetListOf<SubstLookup> SubstLookupList;
/*
* GSUB -- Glyph Substitution
* https://docs.microsoft.com/en-us/typography/opentype/spec/gsub
@ -1402,11 +1400,11 @@ struct GSUB : GSUBGPOS
inline bool subset (hb_subset_context_t *c) const
{
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);
const OffsetTo<SubstLookupList> &list = CastR<const OffsetTo<SubstLookupList> > (lookupList);
OffsetTo<SubstLookupList> &outList = CastR<OffsetTo<SubstLookupList> > (out->lookupList);
outList.set (0);
//const OffsetTo<SubstLookupList> &list = CastR<const OffsetTo<SubstLookupList> > (lookupList);
//OffsetTo<SubstLookupList> &outList = CastR<OffsetTo<SubstLookupList> > (out->lookupList);
//outList.set (0);
//outList.serialize_subset (c, this+list, out);
/* TODO Use intersects() to count how many subtables survive? */
return_trace (true);
@ -1415,9 +1413,7 @@ struct GSUB : GSUBGPOS
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!GSUBGPOS::sanitize (c))) return_trace (false);
const OffsetTo<SubstLookupList> &list = CastR<OffsetTo<SubstLookupList> > (lookupList);
return_trace (list.sanitize (c, this));
return_trace (GSUBGPOS::sanitize<SubstLookup> (c));
}
typedef GSUBGPOS::accelerator_t<GSUB> accelerator_t;

@ -2565,14 +2565,16 @@ struct GSUBGPOS
(version.to_int () >= 0x00010001u ? featureVars.static_size : 0);
}
template <typename TLookup>
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
typedef OffsetListOf<TLookup> TLookupList;
return_trace (version.sanitize (c) &&
likely (version.major == 1) &&
scriptList.sanitize (c, this) &&
featureList.sanitize (c, this) &&
lookupList.sanitize (c, this) &&
CastR<OffsetTo<TLookupList> > (lookupList).sanitize (c, this) &&
(version.to_int () < 0x00010001u || featureVars.sanitize (c, this)));
}

Loading…
Cancel
Save