[layout] Refactor get_subtable()
This commit is contained in:
parent
f72f326aea
commit
70366f5d19
|
@ -571,6 +571,17 @@ struct Lookup
|
|||
{
|
||||
inline unsigned int get_subtable_count (void) const { return subTable.len; }
|
||||
|
||||
template <typename SubTableType>
|
||||
inline const SubTableType& get_subtable (unsigned int i) const
|
||||
{ return this+CastR<OffsetArrayOf<SubTableType> > (subTable)[i]; }
|
||||
|
||||
template <typename SubTableType>
|
||||
inline const OffsetArrayOf<SubTableType>& get_subtables (void) const
|
||||
{ return CastR<OffsetArrayOf<SubTableType> > (subTable); }
|
||||
template <typename SubTableType>
|
||||
inline OffsetArrayOf<SubTableType>& get_subtables (void)
|
||||
{ return CastR<OffsetArrayOf<SubTableType> > (subTable); }
|
||||
|
||||
inline unsigned int get_type (void) const { return lookupType; }
|
||||
|
||||
/* lookup_props is a 32-bit integer where the lower 16-bit is LookupFlag and
|
||||
|
@ -618,6 +629,7 @@ struct Lookup
|
|||
return TRACE_RETURN (true);
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT lookupType; /* Different enumerations for GSUB and GPOS */
|
||||
USHORT lookupFlag; /* Lookup qualifiers */
|
||||
ArrayOf<Offset<> >
|
||||
|
|
|
@ -1489,7 +1489,7 @@ struct PosLookupSubTable
|
|||
struct PosLookup : Lookup
|
||||
{
|
||||
inline const PosLookupSubTable& get_subtable (unsigned int i) const
|
||||
{ return this+CastR<OffsetArrayOf<PosLookupSubTable> > (subTable)[i]; }
|
||||
{ return Lookup::get_subtable<PosLookupSubTable> (i); }
|
||||
|
||||
inline bool is_reverse (void) const
|
||||
{
|
||||
|
@ -1540,7 +1540,7 @@ struct PosLookup : Lookup
|
|||
{
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!Lookup::sanitize (c))) return TRACE_RETURN (false);
|
||||
const OffsetArrayOf<PosLookupSubTable> &list = CastR<OffsetArrayOf<PosLookupSubTable> > (subTable);
|
||||
const OffsetArrayOf<PosLookupSubTable> &list = get_subtables<PosLookupSubTable> ();
|
||||
return TRACE_RETURN (list.sanitize (c, this, get_type ()));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1170,7 +1170,7 @@ struct SubstLookupSubTable
|
|||
struct SubstLookup : Lookup
|
||||
{
|
||||
inline const SubstLookupSubTable& get_subtable (unsigned int i) const
|
||||
{ return this+CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable)[i]; }
|
||||
{ return Lookup::get_subtable<SubstLookupSubTable> (i); }
|
||||
|
||||
inline static bool lookup_type_is_reverse (unsigned int lookup_type)
|
||||
{ return lookup_type == SubstLookupSubTable::ReverseChainSingle; }
|
||||
|
@ -1225,7 +1225,7 @@ struct SubstLookup : Lookup
|
|||
|
||||
inline SubstLookupSubTable& serialize_subtable (hb_serialize_context_t *c,
|
||||
unsigned int i)
|
||||
{ return CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable)[i].serialize (c, this); }
|
||||
{ return get_subtables<SubstLookupSubTable> ()[i].serialize (c, this); }
|
||||
|
||||
inline bool serialize_single (hb_serialize_context_t *c,
|
||||
uint32_t lookup_props,
|
||||
|
@ -1300,7 +1300,7 @@ struct SubstLookup : Lookup
|
|||
{
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!Lookup::sanitize (c))) return TRACE_RETURN (false);
|
||||
const OffsetArrayOf<SubstLookupSubTable> &list = CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable);
|
||||
const OffsetArrayOf<SubstLookupSubTable> &list = get_subtables<SubstLookupSubTable> ();
|
||||
if (unlikely (!list.sanitize (c, this, get_type ()))) return TRACE_RETURN (false);
|
||||
|
||||
if (unlikely (get_type () == SubstLookupSubTable::Extension))
|
||||
|
|
Loading…
Reference in New Issue