[OTLayout] Templatize process_recurse_func

This commit is contained in:
Behdad Esfahbod 2012-11-23 18:04:08 -05:00
parent 9b34677f36
commit c6fb843f2a
2 changed files with 15 additions and 3 deletions

View File

@ -1354,6 +1354,8 @@ struct PosLookup : Lookup
} }
return TRACE_RETURN (c->default_return_value ()); return TRACE_RETURN (c->default_return_value ());
} }
template <typename context_t>
static inline typename context_t::return_t process_recurse_func (context_t *c, unsigned int lookup_index);
template <typename set_t> template <typename set_t>
inline void add_coverage (set_t *glyphs) const inline void add_coverage (set_t *glyphs) const
@ -1523,6 +1525,14 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer, hb_bool_t
/* Out-of-class implementation for methods recursing */ /* Out-of-class implementation for methods recursing */
template <typename context_t>
inline typename context_t::return_t PosLookup::process_recurse_func (context_t *c, unsigned int lookup_index)
{
const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
const PosLookup &l = gpos.get_lookup (lookup_index);
return l.process (c);
}
inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index) inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
{ {
const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos); const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);

View File

@ -1140,11 +1140,12 @@ struct SubstLookup : Lookup
} }
return TRACE_RETURN (c->default_return_value ()); return TRACE_RETURN (c->default_return_value ());
} }
template <typename context_t>
static inline typename context_t::return_t process_recurse_func (context_t *c, unsigned int lookup_index);
static inline void_t closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index);
inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
{ {
c->set_recurse_func (closure_recurse_func); c->set_recurse_func (process_recurse_func<hb_closure_context_t>);
return process (c); return process (c);
} }
@ -1377,7 +1378,8 @@ inline bool ExtensionSubst::is_reverse (void) const
return SubstLookup::lookup_type_is_reverse (type); return SubstLookup::lookup_type_is_reverse (type);
} }
inline void_t SubstLookup::closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index) template <typename context_t>
inline typename context_t::return_t SubstLookup::process_recurse_func (context_t *c, unsigned int lookup_index)
{ {
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub); const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index); const SubstLookup &l = gsub.get_lookup (lookup_index);