[subset] Rewrite CoverageFormat2::intersects as dagger

This commit is contained in:
Behdad Esfahbod 2022-05-18 13:46:06 -06:00
parent cf5001fac7
commit 777debd748
1 changed files with 3 additions and 7 deletions

View File

@ -1547,16 +1547,12 @@ struct CoverageFormat2
bool intersects (const hb_set_t *glyphs) const
{
/* TODO Speed up, using hb_set_next() and bsearch()? */
/* TODO(iter) Rewrite as dagger. */
for (const auto& range : rangeRecord.as_array ())
if (range.intersects (glyphs))
return true;
return false;
return hb_any (+ hb_iter (rangeRecord.as_array ())
| hb_map ([glyphs] (const RangeRecord &range) { return range.intersects (glyphs); }));
}
bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const
{
/* TODO(iter) Rewrite as dagger. */
/* TODO Use bsearch? */
for (const auto& range : rangeRecord.as_array ())
{
if (range.value <= index &&