From c6fb843f2a1c26322c6f4c85d1589f01a9e7a2ef Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 23 Nov 2012 18:04:08 -0500 Subject: [PATCH] [OTLayout] Templatize process_recurse_func --- src/hb-ot-layout-gpos-table.hh | 10 ++++++++++ src/hb-ot-layout-gsub-table.hh | 8 +++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 86c0d8d21..2e6933fc4 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1354,6 +1354,8 @@ struct PosLookup : Lookup } return TRACE_RETURN (c->default_return_value ()); } + template + static inline typename context_t::return_t process_recurse_func (context_t *c, unsigned int lookup_index); template 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 */ +template +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) { const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos); diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 0679dc132..0d14a1c90 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1140,11 +1140,12 @@ struct SubstLookup : Lookup } return TRACE_RETURN (c->default_return_value ()); } + template + 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 { - c->set_recurse_func (closure_recurse_func); + c->set_recurse_func (process_recurse_func); return process (c); } @@ -1377,7 +1378,8 @@ inline bool ExtensionSubst::is_reverse (void) const return SubstLookup::lookup_type_is_reverse (type); } -inline void_t SubstLookup::closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index) +template +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 SubstLookup &l = gsub.get_lookup (lookup_index);