From bb9a40da653b5bab595f79de76a8feda18cb1b5c Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 19 Jun 2020 19:22:47 +0430 Subject: [PATCH] [lcar] Use dagger --- src/hb-aat-layout-lcar-table.hh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/hb-aat-layout-lcar-table.hh b/src/hb-aat-layout-lcar-table.hh index 90cfd9292..25458a1a0 100644 --- a/src/hb-aat-layout-lcar-table.hh +++ b/src/hb-aat-layout-lcar-table.hh @@ -53,9 +53,10 @@ struct lcarFormat0 const LigCaretClassEntry& array = entry_offset ? base+*entry_offset : Null (LigCaretClassEntry); if (caret_count) { - hb_array_t arr = array.sub_array (start_offset, caret_count); - for (unsigned int i = 0; i < arr.length; ++i) - caret_array[i] = font->em_scale_dir (arr[i], direction); + + array.sub_array (start_offset, caret_count) + | hb_map ([&] (int v) { return font->em_scale_dir (v, direction); }) + | hb_sink (hb_array (caret_array, *caret_count)) + ; } return array.len; } @@ -88,13 +89,15 @@ struct lcarFormat1 const LigCaretClassEntry& array = entry_offset ? base+*entry_offset : Null (LigCaretClassEntry); if (caret_count) { - hb_array_t arr = array.sub_array (start_offset, caret_count); - for (unsigned int i = 0; i < arr.length; ++i) - { - hb_position_t x = 0, y = 0; - font->get_glyph_contour_point_for_origin (glyph, arr[i], direction, &x, &y); - caret_array[i] = HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y; - } + + array.sub_array (start_offset, caret_count) + | hb_map ([&] (unsigned int point_index) + { + hb_position_t x = 0, y = 0; + font->get_glyph_contour_point_for_origin (glyph, point_index, direction, &x, &y); + return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y; + }) + | hb_sink (hb_array (caret_array, *caret_count)) + ; } return array.len; }