mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 18:13:53 +01:00
[depend] Change depend() methods from bool to void
hb_depend_context_t switches to hb_dispatch_context_t<hb_depend_context_t> (void-style, return_t = hb_empty_t). All bool depend() methods in gsubgpos.hh and GSUB subtype files become void, matching the closure convention. Recurse functions retain hb_depend_context_t::return_t signatures (= hb_empty_t) to satisfy the recurse_func_t typedef, consistent with the closure pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b5d2b4d5fb
commit
2e217dc652
9 files changed
+33
-53
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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<decltype (lookaheadX)> (backtrack);
|
||||
const auto &substitute = StructAfter<decltype (substituteX)> (lookahead);
|
||||
@@ -124,8 +124,6 @@ struct ReverseChainSingleSubstFormat1
|
||||
;
|
||||
|
||||
c->depend_data->current_context_set_index = saved_context;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ template <typename context_t>
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
@@ -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_depend_context_t, bool>
|
||||
hb_dispatch_context_t<hb_depend_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 <typename T>
|
||||
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<LookupRecord> (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<decltype (inputX)> (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<decltype (lookaheadX)> (input);
|
||||
@@ -4950,8 +4939,6 @@ struct ChainContextFormat3
|
||||
input[0], lookup_context);
|
||||
|
||||
c->pop_cur_done_glyphs ();
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user