Templatize GSUBGPOS::sanitize()
This commit is contained in:
parent
49c44b58f6
commit
6d618522d6
|
@ -1548,8 +1548,6 @@ struct PosLookup : Lookup
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef OffsetListOf<PosLookup> PosLookupList;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPOS -- Glyph Positioning
|
* GPOS -- Glyph Positioning
|
||||||
* https://docs.microsoft.com/en-us/typography/opentype/spec/gpos
|
* 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
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
if (unlikely (!GSUBGPOS::sanitize (c))) return_trace (false);
|
return_trace (GSUBGPOS::sanitize<PosLookup> (c));
|
||||||
const OffsetTo<PosLookupList> &list = CastR<OffsetTo<PosLookupList> > (lookupList);
|
|
||||||
return_trace (list.sanitize (c, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef GSUBGPOS::accelerator_t<GPOS> accelerator_t;
|
typedef GSUBGPOS::accelerator_t<GPOS> accelerator_t;
|
||||||
|
|
|
@ -1385,8 +1385,6 @@ struct SubstLookup : Lookup
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef OffsetListOf<SubstLookup> SubstLookupList;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GSUB -- Glyph Substitution
|
* GSUB -- Glyph Substitution
|
||||||
* https://docs.microsoft.com/en-us/typography/opentype/spec/gsub
|
* 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
|
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);
|
||||||
const OffsetTo<SubstLookupList> &list = CastR<const OffsetTo<SubstLookupList> > (lookupList);
|
//const OffsetTo<SubstLookupList> &list = CastR<const OffsetTo<SubstLookupList> > (lookupList);
|
||||||
OffsetTo<SubstLookupList> &outList = CastR<OffsetTo<SubstLookupList> > (out->lookupList);
|
//OffsetTo<SubstLookupList> &outList = CastR<OffsetTo<SubstLookupList> > (out->lookupList);
|
||||||
outList.set (0);
|
//outList.set (0);
|
||||||
//outList.serialize_subset (c, this+list, out);
|
//outList.serialize_subset (c, this+list, out);
|
||||||
/* TODO Use intersects() to count how many subtables survive? */
|
/* TODO Use intersects() to count how many subtables survive? */
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
|
@ -1415,9 +1413,7 @@ struct GSUB : GSUBGPOS
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
if (unlikely (!GSUBGPOS::sanitize (c))) return_trace (false);
|
return_trace (GSUBGPOS::sanitize<SubstLookup> (c));
|
||||||
const OffsetTo<SubstLookupList> &list = CastR<OffsetTo<SubstLookupList> > (lookupList);
|
|
||||||
return_trace (list.sanitize (c, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef GSUBGPOS::accelerator_t<GSUB> accelerator_t;
|
typedef GSUBGPOS::accelerator_t<GSUB> accelerator_t;
|
||||||
|
|
|
@ -2565,14 +2565,16 @@ struct GSUBGPOS
|
||||||
(version.to_int () >= 0x00010001u ? featureVars.static_size : 0);
|
(version.to_int () >= 0x00010001u ? featureVars.static_size : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename TLookup>
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
|
typedef OffsetListOf<TLookup> TLookupList;
|
||||||
return_trace (version.sanitize (c) &&
|
return_trace (version.sanitize (c) &&
|
||||||
likely (version.major == 1) &&
|
likely (version.major == 1) &&
|
||||||
scriptList.sanitize (c, this) &&
|
scriptList.sanitize (c, this) &&
|
||||||
featureList.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)));
|
(version.to_int () < 0x00010001u || featureVars.sanitize (c, this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue