diff --git a/src/OT/Layout/GSUB/AlternateSubstFormat1.hh b/src/OT/Layout/GSUB/AlternateSubstFormat1.hh index e8088f71e..657a33ef3 100644 --- a/src/OT/Layout/GSUB/AlternateSubstFormat1.hh +++ b/src/OT/Layout/GSUB/AlternateSubstFormat1.hh @@ -35,7 +35,7 @@ struct AlternateSubstFormat1_2 { return false; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { // Filter by parent_active_glyphs like closure does + hb_zip (this+coverage, alternateSet) @@ -46,7 +46,6 @@ struct AlternateSubstFormat1_2 as.depend (c, _.first); }) ; - return true; } #endif diff --git a/src/OT/Layout/GSUB/LigatureSubstFormat1.hh b/src/OT/Layout/GSUB/LigatureSubstFormat1.hh index e45247f52..c16e350fc 100644 --- a/src/OT/Layout/GSUB/LigatureSubstFormat1.hh +++ b/src/OT/Layout/GSUB/LigatureSubstFormat1.hh @@ -44,7 +44,7 @@ struct LigatureSubstFormat1_2 { return true; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { + hb_zip (this+coverage, ligatureSet) | hb_filter (c->parent_active_glyphs (), hb_first) @@ -54,7 +54,6 @@ struct LigatureSubstFormat1_2 ls.depend (c, _.first); }) ; - return true; } #endif diff --git a/src/OT/Layout/GSUB/MultipleSubstFormat1.hh b/src/OT/Layout/GSUB/MultipleSubstFormat1.hh index b0eed2d5c..42b15e7bc 100644 --- a/src/OT/Layout/GSUB/MultipleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/MultipleSubstFormat1.hh @@ -45,7 +45,7 @@ struct MultipleSubstFormat1_2 } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { // Filter by parent_active_glyphs like closure does + hb_zip (this+coverage, sequence) @@ -56,7 +56,6 @@ struct MultipleSubstFormat1_2 s.depend (c, _.first); }) ; - return true; } #endif diff --git a/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh b/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh index ba994cdcc..ff31e46c2 100644 --- a/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh @@ -68,9 +68,9 @@ struct ReverseChainSingleSubstFormat1 { return false; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const { + void depend (hb_depend_context_t *c) const { // Filter by intersects and parent_active_glyphs like closure does - if (!intersects (c->glyphs)) return true; + if (!intersects (c->glyphs)) return; const auto &lookahead = StructAfter (backtrack); const auto &substitute = StructAfter (lookahead); @@ -124,8 +124,6 @@ struct ReverseChainSingleSubstFormat1 ; c->depend_data->current_context_set_index = saved_context; - - return true; } #endif diff --git a/src/OT/Layout/GSUB/SingleSubstFormat1.hh b/src/OT/Layout/GSUB/SingleSubstFormat1.hh index c18d76763..231d33633 100644 --- a/src/OT/Layout/GSUB/SingleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/SingleSubstFormat1.hh @@ -46,7 +46,7 @@ struct SingleSubstFormat1_3 { return false; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { hb_codepoint_t d = deltaGlyphID; hb_codepoint_t mask = get_mask (); @@ -59,7 +59,6 @@ struct SingleSubstFormat1_3 | hb_map ([&] (hb_codepoint_t _) { return hb_codepoint_pair_t (_, (_ + d) & mask); }) | hb_apply ([&] (const hb_codepoint_pair_t &_) { c->depend_data->add_gsub_lookup(_.first, c->lookup_index, _.second); }) ; - return true; } #endif diff --git a/src/OT/Layout/GSUB/SingleSubstFormat2.hh b/src/OT/Layout/GSUB/SingleSubstFormat2.hh index 329a42906..a85157174 100644 --- a/src/OT/Layout/GSUB/SingleSubstFormat2.hh +++ b/src/OT/Layout/GSUB/SingleSubstFormat2.hh @@ -35,7 +35,7 @@ struct SingleSubstFormat2_4 { return false; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { auto &cov = this+coverage; auto &glyph_set = c->parent_active_glyphs (); @@ -51,14 +51,13 @@ struct SingleSubstFormat2_4 c->depend_data->add_gsub_lookup (g, c->lookup_index, substitute.arrayZ[i]); } - return true; + return; } + hb_zip (cov, substitute) | hb_filter (glyph_set, hb_first) | hb_apply ([&] (const hb_codepoint_pair_t &_) { c->depend_data->add_gsub_lookup (_.first, c->lookup_index, _.second); }) ; - return true; } #endif diff --git a/src/OT/Layout/GSUB/SubstLookup.hh b/src/OT/Layout/GSUB/SubstLookup.hh index 53a451580..04d422ef1 100644 --- a/src/OT/Layout/GSUB/SubstLookup.hh +++ b/src/OT/Layout/GSUB/SubstLookup.hh @@ -62,10 +62,10 @@ struct SubstLookup : Lookup } #ifndef HB_NO_SUBSET_DEPEND - hb_depend_context_t::return_t depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { c->set_recurse_func (dispatch_depend_recurse_func); - return dispatch (c); + dispatch (c); } #endif @@ -214,7 +214,7 @@ struct SubstLookup : Lookup } #ifndef HB_NO_SUBSET_DEPEND - static inline typename hb_depend_context_t::return_t depend_glyphs_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index); + static inline hb_depend_context_t::return_t depend_glyphs_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index); static inline hb_depend_context_t::return_t dispatch_depend_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index) { diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 7644210ba..c0d13c50e 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -59,7 +59,7 @@ template } #ifndef HB_NO_SUBSET_DEPEND -/*static*/ typename hb_depend_context_t::return_t SubstLookup::depend_glyphs_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index) +/*static*/ hb_depend_context_t::return_t SubstLookup::depend_glyphs_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index) { const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index); /* After a non-1-to-1 lookup (expansion/contraction), subsequent lookups in the same diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 237aed31f..776052c11 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -378,19 +378,18 @@ struct hb_collect_glyphs_context_t : #ifndef HB_NO_SUBSET_DEPEND struct hb_depend_context_t : - hb_dispatch_context_t + hb_dispatch_context_t { typedef return_t (*recurse_func_t) (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indicies, unsigned seq_index, unsigned end_index); template - return_t dispatch (const T &obj) { return obj.depend (this); } - static return_t default_return_value () { return false; } - bool stop_sublookup_iteration (return_t r) const { return false; } + return_t dispatch (const T &obj) { obj.depend (this); return hb_empty_t (); } + static return_t default_return_value () { return hb_empty_t (); } - return_t recurse (unsigned lookup_idx, hb_set_t *covered_seq_indicies, unsigned seq_index, unsigned end_index) + void recurse (unsigned lookup_idx, hb_set_t *covered_seq_indicies, unsigned seq_index, unsigned end_index) { // Don't use lookups_seen check here - same lookup can be called multiple times // with different active glyphs for different sequence positions - return recurse_func (this, lookup_idx, covered_seq_indicies, seq_index, end_index); + recurse_func (this, lookup_idx, covered_seq_indicies, seq_index, end_index); } const hb_set_t& parent_active_glyphs () @@ -2883,10 +2882,10 @@ struct ContextFormat1_4 { return true; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs (); - if (unlikely (!cur_active_glyphs)) return true; + if (unlikely (!cur_active_glyphs)) return; get_coverage ().intersect_set (*c->glyphs, *cur_active_glyphs); struct ContextDependLookupContext lookup_context = { @@ -2906,8 +2905,6 @@ struct ContextFormat1_4 ; c->pop_cur_done_glyphs (); - - return true; } #endif @@ -3080,13 +3077,13 @@ struct ContextFormat2_5 { return true; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { if (!(this+coverage).intersects (c->glyphs)) - return true; + return; hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs (); - if (unlikely (!cur_active_glyphs)) return true; + if (unlikely (!cur_active_glyphs)) return; get_coverage ().intersect_set (*c->glyphs, *cur_active_glyphs); const ClassDef &class_def = this+classDef; @@ -3113,8 +3110,6 @@ struct ContextFormat2_5 ; c->pop_cur_done_glyphs (); - - return true; } #endif @@ -3359,13 +3354,13 @@ struct ContextFormat3 { return true; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { if (!(this+coverageZ[0]).intersects (c->glyphs)) - return true; + return; hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs (); - if (unlikely (!cur_active_glyphs)) return true; + if (unlikely (!cur_active_glyphs)) return; get_coverage ().intersect_set (*c->glyphs, *cur_active_glyphs); const LookupRecord *lookupRecord = &StructAfter (coverageZ.as_array (glyphCount)); @@ -3382,8 +3377,6 @@ struct ContextFormat3 coverageZ[0], lookup_context); c->pop_cur_done_glyphs (); - - return true; } #endif @@ -4382,10 +4375,10 @@ struct ChainContextFormat1_4 { return true; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs (); - if (unlikely (!cur_active_glyphs)) return true; + if (unlikely (!cur_active_glyphs)) return; get_coverage ().intersect_set (*c->glyphs, *cur_active_glyphs); struct ChainContextDependLookupContext lookup_context = { @@ -4405,8 +4398,6 @@ struct ChainContextFormat1_4 ; c->pop_cur_done_glyphs (); - - return true; } #endif @@ -4581,13 +4572,13 @@ struct ChainContextFormat2_5 { return true; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { if (!(this+coverage).intersects (c->glyphs)) - return true; + return; hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs (); - if (unlikely (!cur_active_glyphs)) return true; + if (unlikely (!cur_active_glyphs)) return; get_coverage ().intersect_set (*c->glyphs, *cur_active_glyphs); const ClassDef &backtrack_class_def = this+backtrackClassDef; @@ -4618,8 +4609,6 @@ struct ChainContextFormat2_5 ; c->pop_cur_done_glyphs (); - - return true; } #endif @@ -4921,16 +4910,16 @@ struct ChainContextFormat3 { return true; } #ifndef HB_NO_SUBSET_DEPEND - bool depend (hb_depend_context_t *c) const + void depend (hb_depend_context_t *c) const { const auto &input = StructAfter (backtrack); if (!(this+input[0]).intersects (c->glyphs)) - return true; + return; hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs (); if (unlikely (!cur_active_glyphs)) - return true; + return; get_coverage ().intersect_set (*c->glyphs, *cur_active_glyphs); const auto &lookahead = StructAfter (input); @@ -4950,8 +4939,6 @@ struct ChainContextFormat3 input[0], lookup_context); c->pop_cur_done_glyphs (); - - return true; } #endif