From d38eb49f46a3381c7930568b4bfb35af4052c0f9 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 19 Jun 2020 23:40:42 +0430 Subject: [PATCH] Move the iteration logic to FeatureParamsCharacterVariants Hopefully I can make members protected also. --- src/hb-ot-layout-common.hh | 12 ++++++++++++ src/hb-ot-layout.cc | 15 ++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 1062d7c27..30571fb80 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -805,6 +805,18 @@ struct FeatureParamsStylisticSet /* https://docs.microsoft.com/en-us/typography/opentype/spec/features_ae#cv01-cv99 */ struct FeatureParamsCharacterVariants { + unsigned + get_characters (unsigned start_offset, unsigned *char_count, hb_codepoint_t *chars) const + { + if (char_count) + { + + characters.sub_array (start_offset, char_count) + | hb_sink (hb_array (chars, *char_count)) + ; + } + return characters.len; + } + unsigned get_size () const { return min_size + characters.len * HBUINT24::static_size; } diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 820727092..703d426d4 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1723,17 +1723,10 @@ hb_ot_layout_feature_get_characters (hb_face_t *face, hb_codepoint_t *characters /* OUT. May be NULL */) { const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); - auto &cv_params = g.get_feature (feature_index) - .get_feature_params () - .get_character_variants_params(g.get_feature_tag (feature_index)); - - if (char_count) - { - + cv_params.characters.sub_array (start_offset, char_count) - | hb_sink (hb_array (characters, *char_count)) - ; - } - return cv_params.characters.len; + return g.get_feature (feature_index) + .get_feature_params () + .get_character_variants_params(g.get_feature_tag (feature_index)) + .get_characters (start_offset, char_count, characters); } #endif