diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 4e15dfbd8..bf2a95258 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -404,7 +404,7 @@ struct RangeRecord { return glyphs->intersects (first, last); } template - bool add_coverage (set_t *glyphs) const + bool collect_coverage (set_t *glyphs) const { return glyphs->add_range (first, last); } HBGlyphID first; /* First GlyphID in the range */ @@ -1195,7 +1195,7 @@ struct CoverageFormat1 { return glyphs->has (glyphArray[index]); } template - bool add_coverage (set_t *glyphs) const + bool collect_coverage (set_t *glyphs) const { return glyphs->add_sorted_array (glyphArray.arrayZ, glyphArray.len); } public: @@ -1314,11 +1314,11 @@ struct CoverageFormat2 } template - bool add_coverage (set_t *glyphs) const + bool collect_coverage (set_t *glyphs) const { unsigned int count = rangeRecord.len; for (unsigned int i = 0; i < count; i++) - if (unlikely (!rangeRecord[i].add_coverage (glyphs))) + if (unlikely (!rangeRecord[i].collect_coverage (glyphs))) return false; return true; } @@ -1485,12 +1485,12 @@ struct Coverage /* Might return false if array looks unsorted. * Used for faster rejection of corrupt data. */ template - bool add_coverage (set_t *glyphs) const + bool collect_coverage (set_t *glyphs) const { switch (u.format) { - case 1: return u.format1.add_coverage (glyphs); - case 2: return u.format2.add_coverage (glyphs); + case 1: return u.format1.collect_coverage (glyphs); + case 2: return u.format2.collect_coverage (glyphs); default:return false; } } @@ -1696,7 +1696,7 @@ struct ClassDefFormat1 } template - bool add_coverage (set_t *glyphs) const + bool collect_coverage (set_t *glyphs) const { unsigned int start = 0; unsigned int count = classValue.len; @@ -1868,12 +1868,12 @@ struct ClassDefFormat2 } template - bool add_coverage (set_t *glyphs) const + bool collect_coverage (set_t *glyphs) const { unsigned int count = rangeRecord.len; for (unsigned int i = 0; i < count; i++) if (rangeRecord[i].value) - if (unlikely (!rangeRecord[i].add_coverage (glyphs))) + if (unlikely (!rangeRecord[i].collect_coverage (glyphs))) return false; return true; } @@ -1885,7 +1885,7 @@ struct ClassDefFormat2 for (unsigned int i = 0; i < count; i++) { if (rangeRecord[i].value == klass) - if (unlikely (!rangeRecord[i].add_coverage (glyphs))) + if (unlikely (!rangeRecord[i].collect_coverage (glyphs))) return false; } return true; @@ -2024,11 +2024,11 @@ struct ClassDef /* Might return false if array looks unsorted. * Used for faster rejection of corrupt data. */ template - bool add_coverage (set_t *glyphs) const + bool collect_coverage (set_t *glyphs) const { switch (u.format) { - case 1: return u.format1.add_coverage (glyphs); - case 2: return u.format2.add_coverage (glyphs); + case 1: return u.format1.collect_coverage (glyphs); + case 2: return u.format2.collect_coverage (glyphs); default:return false; } } diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 4827384f7..d55d6ece8 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -613,7 +613,7 @@ struct SinglePosFormat1 void closure_lookups (hb_closure_lookups_context_t *c) const {} void collect_glyphs (hb_collect_glyphs_context_t *c) const - { if (unlikely (!(this+coverage).add_coverage (c->input))) return; } + { if (unlikely (!(this+coverage).collect_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+coverage; } @@ -703,7 +703,7 @@ struct SinglePosFormat2 void closure_lookups (hb_closure_lookups_context_t *c) const {} void collect_glyphs (hb_collect_glyphs_context_t *c) const - { if (unlikely (!(this+coverage).add_coverage (c->input))) return; } + { if (unlikely (!(this+coverage).collect_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+coverage; } @@ -1054,7 +1054,7 @@ struct PairPosFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+coverage).add_coverage (c->input))) return; + if (unlikely (!(this+coverage).collect_coverage (c->input))) return; unsigned int count = pairSet.len; for (unsigned int i = 0; i < count; i++) (this+pairSet[i]).collect_glyphs (c, valueFormat); @@ -1166,8 +1166,8 @@ struct PairPosFormat2 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+coverage).add_coverage (c->input))) return; - if (unlikely (!(this+classDef2).add_coverage (c->input))) return; + if (unlikely (!(this+coverage).collect_coverage (c->input))) return; + if (unlikely (!(this+classDef2).collect_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+coverage; } @@ -1371,7 +1371,7 @@ struct CursivePosFormat1 void closure_lookups (hb_closure_lookups_context_t *c) const {} void collect_glyphs (hb_collect_glyphs_context_t *c) const - { if (unlikely (!(this+coverage).add_coverage (c->input))) return; } + { if (unlikely (!(this+coverage).collect_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+coverage; } @@ -1594,8 +1594,8 @@ struct MarkBasePosFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+markCoverage).add_coverage (c->input))) return; - if (unlikely (!(this+baseCoverage).add_coverage (c->input))) return; + if (unlikely (!(this+markCoverage).collect_coverage (c->input))) return; + if (unlikely (!(this+baseCoverage).collect_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+markCoverage; } @@ -1779,8 +1779,8 @@ struct MarkLigPosFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+markCoverage).add_coverage (c->input))) return; - if (unlikely (!(this+ligatureCoverage).add_coverage (c->input))) return; + if (unlikely (!(this+markCoverage).collect_coverage (c->input))) return; + if (unlikely (!(this+ligatureCoverage).collect_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+markCoverage; } @@ -1901,8 +1901,8 @@ struct MarkMarkPosFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+mark1Coverage).add_coverage (c->input))) return; - if (unlikely (!(this+mark2Coverage).add_coverage (c->input))) return; + if (unlikely (!(this+mark1Coverage).collect_coverage (c->input))) return; + if (unlikely (!(this+mark2Coverage).collect_coverage (c->input))) return; } const Coverage &get_coverage () const { return this+mark1Coverage; } @@ -2191,9 +2191,9 @@ struct PosLookup : Lookup } template - void add_coverage (set_t *glyphs) const + void collect_coverage (set_t *glyphs) const { - hb_add_coverage_context_t c (glyphs); + hb_collect_coverage_context_t c (glyphs); dispatch (&c); } diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 5d48c2fc6..01a5af125 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -60,7 +60,7 @@ struct SingleSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+coverage).add_coverage (c->input))) return; + if (unlikely (!(this+coverage).collect_coverage (c->input))) return; unsigned d = deltaGlyphID; + hb_iter (this+coverage) | hb_map ([d] (hb_codepoint_t g) { return (g + d) & 0xFFFFu; }) @@ -160,7 +160,7 @@ struct SingleSubstFormat2 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+coverage).add_coverage (c->input))) return; + if (unlikely (!(this+coverage).collect_coverage (c->input))) return; + hb_zip (this+coverage, substitute) | hb_map (hb_second) | hb_sink (c->output) @@ -402,7 +402,7 @@ struct MultipleSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+coverage).add_coverage (c->input))) return; + if (unlikely (!(this+coverage).collect_coverage (c->input))) return; + hb_zip (this+coverage, sequence) | hb_map (hb_second) | hb_map (hb_add (this)) @@ -615,7 +615,7 @@ struct AlternateSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+coverage).add_coverage (c->input))) return; + if (unlikely (!(this+coverage).collect_coverage (c->input))) return; + hb_zip (this+coverage, alternateSet) | hb_map (hb_second) | hb_map (hb_add (this)) @@ -978,7 +978,7 @@ struct LigatureSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+coverage).add_coverage (c->input))) return; + if (unlikely (!(this+coverage).collect_coverage (c->input))) return; + hb_zip (this+coverage, ligatureSet) | hb_map (hb_second) @@ -1170,18 +1170,18 @@ struct ReverseChainSingleSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - if (unlikely (!(this+coverage).add_coverage (c->input))) return; + if (unlikely (!(this+coverage).collect_coverage (c->input))) return; unsigned int count; count = backtrack.len; for (unsigned int i = 0; i < count; i++) - if (unlikely (!(this+backtrack[i]).add_coverage (c->before))) return; + if (unlikely (!(this+backtrack[i]).collect_coverage (c->before))) return; const OffsetArrayOf &lookahead = StructAfter> (backtrack); count = lookahead.len; for (unsigned int i = 0; i < count; i++) - if (unlikely (!(this+lookahead[i]).add_coverage (c->after))) return; + if (unlikely (!(this+lookahead[i]).collect_coverage (c->after))) return; const ArrayOf &substitute = StructAfter> (lookahead); count = substitute.len; @@ -1415,9 +1415,9 @@ struct SubstLookup : Lookup } template - void add_coverage (set_t *glyphs) const + void collect_coverage (set_t *glyphs) const { - hb_add_coverage_context_t c (glyphs); + hb_collect_coverage_context_t c (glyphs); dispatch (&c); } diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index cf07ff449..98d505899 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -307,8 +307,8 @@ struct hb_collect_glyphs_context_t : template -struct hb_add_coverage_context_t : - hb_dispatch_context_t, const Coverage &, HB_DEBUG_GET_COVERAGE> +struct hb_collect_coverage_context_t : + hb_dispatch_context_t, const Coverage &, HB_DEBUG_GET_COVERAGE> { const char *get_name () { return "GET_COVERAGE"; } typedef const Coverage &return_t; @@ -317,13 +317,13 @@ struct hb_add_coverage_context_t : static return_t default_return_value () { return Null (Coverage); } bool stop_sublookup_iteration (return_t r) const { - r.add_coverage (set); + r.collect_coverage (set); return false; } - hb_add_coverage_context_t (set_t *set_) : - set (set_), - debug_depth (0) {} + hb_collect_coverage_context_t (set_t *set_) : + set (set_), + debug_depth (0) {} set_t *set; unsigned int debug_depth; @@ -720,7 +720,7 @@ struct hb_get_subtables_context_t : obj = &obj_; apply_func = apply_func_; digest.init (); - obj_.get_coverage ().add_coverage (&digest); + obj_.get_coverage ().collect_coverage (&digest); } bool apply (OT::hb_ot_apply_context_t *c) const @@ -815,7 +815,7 @@ static inline void collect_class (hb_set_t *glyphs, const HBUINT16 &value, const static inline void collect_coverage (hb_set_t *glyphs, const HBUINT16 &value, const void *data) { const OffsetTo &coverage = (const OffsetTo&)value; - (data+coverage).add_coverage (glyphs); + (data+coverage).collect_coverage (glyphs); } static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED, hb_set_t *glyphs, @@ -1605,7 +1605,7 @@ struct ContextFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - (this+coverage).add_coverage (c->input); + (this+coverage).collect_coverage (c->input); struct ContextCollectGlyphsLookupContext lookup_context = { {collect_glyph}, @@ -1727,7 +1727,7 @@ struct ContextFormat2 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - (this+coverage).add_coverage (c->input); + (this+coverage).collect_coverage (c->input); const ClassDef &class_def = this+classDef; struct ContextCollectGlyphsLookupContext lookup_context = { @@ -1840,7 +1840,7 @@ struct ContextFormat3 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - (this+coverageZ[0]).add_coverage (c->input); + (this+coverageZ[0]).collect_coverage (c->input); const LookupRecord *lookupRecord = &StructAfter (coverageZ.as_array (glyphCount)); struct ContextCollectGlyphsLookupContext lookup_context = { @@ -2418,7 +2418,7 @@ struct ChainContextFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - (this+coverage).add_coverage (c->input); + (this+coverage).collect_coverage (c->input); struct ChainContextCollectGlyphsLookupContext lookup_context = { {collect_glyph}, @@ -2562,7 +2562,7 @@ struct ChainContextFormat2 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - (this+coverage).add_coverage (c->input); + (this+coverage).collect_coverage (c->input); const ClassDef &backtrack_class_def = this+backtrackClassDef; const ClassDef &input_class_def = this+inputClassDef; @@ -2762,7 +2762,7 @@ struct ChainContextFormat3 { const OffsetArrayOf &input = StructAfter> (backtrack); - (this+input[0]).add_coverage (c->input); + (this+input[0]).collect_coverage (c->input); const OffsetArrayOf &lookahead = StructAfter> (input); const ArrayOf &lookup = StructAfter> (lookahead); @@ -3003,7 +3003,7 @@ struct hb_ot_layout_lookup_accelerator_t void init (const TLookup &lookup) { digest.init (); - lookup.add_coverage (&digest); + lookup.collect_coverage (&digest); subtables.init (); OT::hb_get_subtables_context_t c_get_subtables (subtables);