Use hb_enumerate in more places

This commit is contained in:
Behdad Esfahbod 2022-12-03 10:16:35 -07:00
parent 02bc4dd69b
commit 2cdaedaf54
3 changed files with 9 additions and 11 deletions

View File

@ -372,7 +372,7 @@ struct MarkBasePosFormat1 : public OT::Layout::GPOS_impl::MarkBasePosFormat1_2<S
if (!mark_coverage) return false;
hb_set_t marks = sc.marks_for (0, count);
auto new_coverage =
+ hb_zip (hb_range (), mark_coverage.table->iter ())
+ hb_enumerate (mark_coverage.table->iter ())
| hb_filter (marks, hb_first)
| hb_map_retains_sorting (hb_second)
;
@ -431,7 +431,7 @@ struct MarkBasePosFormat1 : public OT::Layout::GPOS_impl::MarkBasePosFormat1_2<S
if (!mark_coverage) return false;
hb_set_t marks = sc.marks_for (start, end);
auto new_coverage =
+ hb_zip (hb_range (), mark_coverage.table->iter ())
+ hb_enumerate (mark_coverage.table->iter ())
| hb_filter (marks, hb_first)
| hb_map_retains_sorting (hb_second)
;

View File

@ -337,13 +337,13 @@ struct fvar
{
const InstanceRecord *instance = get_instance (i);
if (hb_any (+ hb_zip (instance->get_coordinates (axisCount), hb_range ((unsigned)axisCount))
| hb_filter (pinned_axes, hb_second)
| hb_map ([&] (const hb_pair_t<const F16DOT16&, unsigned>& _)
if (hb_any (+ hb_enumerate (instance->get_coordinates (axisCount))
| hb_filter (pinned_axes, hb_first)
| hb_map ([&] (const hb_pair_t<unsigned, const F16DOT16&>& _)
{
hb_tag_t axis_tag = pinned_axes.get (_.second);
hb_tag_t axis_tag = pinned_axes.get (_.first);
float location = user_axes_location->get (axis_tag);
if (fabs ((double)location - (double)_.first.to_float ()) > 0.001) return true;
if (fabs ((double)location - (double)_.second.to_float ()) > 0.001) return true;
return false;
})
))

View File

@ -85,10 +85,8 @@ static void
_remap_indexes (const hb_set_t *indexes,
hb_map_t *mapping /* OUT */)
{
unsigned count = indexes->get_population ();
for (auto _ : + hb_zip (indexes->iter (), hb_range (count)))
mapping->set (_.first, _.second);
for (auto _ : + hb_enumerate (indexes->iter ()))
mapping->set (_.second, _.first);
}