[GSUB] Simplify Extension is_reverse()

We don't allow extension lookups to chain to another extension lookup.
Simplify code for that.
This commit is contained in:
Behdad Esfahbod 2019-12-10 13:21:26 -06:00
parent 858b627984
commit dd3972a364
2 changed files with 10 additions and 14 deletions

View File

@ -239,9 +239,9 @@ struct ValueFormat : HBUINT16
}; };
template<typename Iterator> template<typename Iterator>
static inline void SinglePos_serialize (hb_serialize_context_t *c, static void SinglePos_serialize (hb_serialize_context_t *c,
Iterator it, Iterator it,
ValueFormat valFormat); ValueFormat valFormat);
struct AnchorFormat1 struct AnchorFormat1
@ -749,7 +749,7 @@ struct SinglePos
}; };
template<typename Iterator> template<typename Iterator>
static inline void static void
SinglePos_serialize (hb_serialize_context_t *c, SinglePos_serialize (hb_serialize_context_t *c,
Iterator it, Iterator it,
ValueFormat valFormat) ValueFormat valFormat)
@ -2048,7 +2048,7 @@ struct GPOS_accelerator_t : GPOS::accelerator_t {};
#ifndef HB_NO_OT_LAYOUT #ifndef HB_NO_OT_LAYOUT
template <typename context_t> template <typename context_t>
/*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) /*static*/ typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
{ {
const PosLookup &l = c->face->table.GPOS.get_relaxed ()->table->get_lookup (lookup_index); const PosLookup &l = c->face->table.GPOS.get_relaxed ()->table->get_lookup (lookup_index);
return l.dispatch (c); return l.dispatch (c);

View File

@ -37,8 +37,8 @@ namespace OT {
typedef hb_pair_t<hb_codepoint_t, hb_codepoint_t> hb_codepoint_pair_t; typedef hb_pair_t<hb_codepoint_t, hb_codepoint_t> hb_codepoint_pair_t;
template<typename Iterator> template<typename Iterator>
static inline void SingleSubst_serialize (hb_serialize_context_t *c, static void SingleSubst_serialize (hb_serialize_context_t *c,
Iterator it); Iterator it);
struct SingleSubstFormat1 struct SingleSubstFormat1
@ -293,7 +293,7 @@ struct SingleSubst
}; };
template<typename Iterator> template<typename Iterator>
static inline void static void
SingleSubst_serialize (hb_serialize_context_t *c, SingleSubst_serialize (hb_serialize_context_t *c,
Iterator it) Iterator it)
{ c->start_embed<SingleSubst> ()->serialize (c, it); } { c->start_embed<SingleSubst> ()->serialize (c, it); }
@ -1114,7 +1114,6 @@ struct ChainContextSubst : ChainContext {};
struct ExtensionSubst : Extension<ExtensionSubst> struct ExtensionSubst : Extension<ExtensionSubst>
{ {
typedef struct SubstLookupSubTable SubTable; typedef struct SubstLookupSubTable SubTable;
bool is_reverse () const; bool is_reverse () const;
}; };
@ -1522,13 +1521,10 @@ struct GSUB_accelerator_t : GSUB::accelerator_t {};
#ifndef HB_NO_OT_LAYOUT #ifndef HB_NO_OT_LAYOUT
/*static*/ inline bool ExtensionSubst::is_reverse () const /*static*/ inline bool ExtensionSubst::is_reverse () const
{ {
unsigned int type = get_type (); return SubstLookup::lookup_type_is_reverse (get_type ());
if (unlikely (type == SubTable::Extension))
return reinterpret_cast<const ExtensionSubst &> (get_subtable<SubTable>()).is_reverse ();
return SubstLookup::lookup_type_is_reverse (type);
} }
template <typename context_t> template <typename context_t>
/*static*/ inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) /*static*/ typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
{ {
const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index); const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index);
return l.dispatch (c); return l.dispatch (c);