From 31f627d786003824d189c786db532600d8701114 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 22 May 2009 17:58:09 -0400 Subject: [PATCH] [HB] Remove apply_subtables() again --- pango/opentype/hb-ot-layout-gpos-private.h | 31 ++++++++++------------------ pango/opentype/hb-ot-layout-gsub-private.h | 33 +++++++++++------------------- 2 files changed, 23 insertions(+), 41 deletions(-) diff --git a/pango/opentype/hb-ot-layout-gpos-private.h b/pango/opentype/hb-ot-layout-gpos-private.h index 2e01615..3d15853 100644 --- a/pango/opentype/hb-ot-layout-gpos-private.h +++ b/pango/opentype/hb-ot-layout-gpos-private.h @@ -1132,7 +1132,7 @@ struct PosLookupSubTable Extension = 9, }; - inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const + bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const { switch (lookup_type) { case Single: return u.single->apply (APPLY_ARG); @@ -1192,14 +1192,17 @@ struct PosLookup : Lookup return type; } - inline bool apply_subtables (hb_ot_layout_t *layout, - hb_buffer_t *buffer, - unsigned int context_length, - unsigned int nesting_level_left, - unsigned int property) const + inline bool apply_once (hb_ot_layout_t *layout, + hb_buffer_t *buffer, + unsigned int context_length, + unsigned int nesting_level_left) const { unsigned int lookup_type = get_type (); unsigned int lookup_flag = get_flag (); + unsigned int property; + + if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property)) + return false; for (unsigned int i = 0; i < get_subtable_count (); i++) if (get_subtable (i).apply (APPLY_ARG, lookup_type)) @@ -1208,17 +1211,6 @@ struct PosLookup : Lookup return false; } - inline bool apply_once (hb_ot_layout_t *layout, hb_buffer_t *buffer) const - { - unsigned int lookup_flag = get_flag (); - - unsigned int property; - if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property)) - return false; - - return apply_subtables (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, property); - } - bool apply_string (hb_ot_layout_t *layout, hb_buffer_t *buffer, hb_ot_layout_feature_mask_t mask) const @@ -1236,7 +1228,7 @@ struct PosLookup : Lookup bool done; if (~IN_PROPERTIES (buffer->in_pos) & mask) { - done = apply_once (layout, buffer); + done = apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL); ret |= done; } else @@ -1309,8 +1301,7 @@ static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index) if (HB_UNLIKELY (context_length < 1)) return false; - /* XXX This should be apply_one I guess */ - return l.apply_subtables (layout, buffer, context_length, nesting_level_left, property); + return l.apply_once (layout, buffer, context_length, nesting_level_left); } diff --git a/pango/opentype/hb-ot-layout-gsub-private.h b/pango/opentype/hb-ot-layout-gsub-private.h index fce4f45..38a99a2 100644 --- a/pango/opentype/hb-ot-layout-gsub-private.h +++ b/pango/opentype/hb-ot-layout-gsub-private.h @@ -590,7 +590,7 @@ struct SubstLookupSubTable ReverseChainSingle = 8, }; - inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const + bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const { switch (lookup_type) { case Single: return u.single->apply (APPLY_ARG); @@ -653,14 +653,17 @@ struct SubstLookup : Lookup return HB_UNLIKELY (get_effective_type () == SubstLookupSubTable::ReverseChainSingle); } - inline bool apply_subtables (hb_ot_layout_t *layout, - hb_buffer_t *buffer, - unsigned int context_length, - unsigned int nesting_level_left, - unsigned int property) const + inline bool apply_once (hb_ot_layout_t *layout, + hb_buffer_t *buffer, + unsigned int context_length, + unsigned int nesting_level_left) const { unsigned int lookup_type = get_type (); unsigned int lookup_flag = get_flag (); + unsigned int property; + + if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property)) + return false; for (unsigned int i = 0; i < get_subtable_count (); i++) if (get_subtable (i).apply (APPLY_ARG, lookup_type)) @@ -669,17 +672,6 @@ struct SubstLookup : Lookup return false; } - inline bool apply_once (hb_ot_layout_t *layout, hb_buffer_t *buffer) const - { - unsigned int lookup_flag = get_flag (); - - unsigned int property; - if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property)) - return false; - - return apply_subtables (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL, property); - } - bool apply_string (hb_ot_layout_t *layout, hb_buffer_t *buffer, hb_ot_layout_feature_mask_t mask) const @@ -697,7 +689,7 @@ struct SubstLookup : Lookup while (buffer->in_pos < buffer->in_length) { if ((~IN_PROPERTIES (buffer->in_pos) & mask) && - apply_once (layout, buffer)) + apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL)) ret = true; else _hb_buffer_next_glyph (buffer); @@ -715,7 +707,7 @@ struct SubstLookup : Lookup do { if ((~IN_PROPERTIES (buffer->in_pos) & mask) && - apply_once (layout, buffer)) + apply_once (layout, buffer, NO_CONTEXT, MAX_NESTING_LEVEL)) ret = true; else buffer->in_pos--; @@ -782,8 +774,7 @@ static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index) if (HB_UNLIKELY (context_length < 1)) return false; - /* XXX This should be apply_one I guess */ - return l.apply_subtables (layout, buffer, context_length, nesting_level_left, property); + return l.apply_once (layout, buffer, context_length, nesting_level_left); } -- 2.7.4