From 0a371fee4d22ed63207aa76c00b05b75bbc95f5f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 14:48:39 +0200 Subject: [PATCH] Minor --- src/hb-ot-map.hh | 6 ++++-- src/hb-ot-shape-complex-arabic.cc | 6 +++--- src/hb-ot-shape-complex-myanmar.cc | 4 ++-- src/hb-ot-shape-complex-use.cc | 8 ++++---- src/hb-ot-shape.cc | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index 16a0c4778..40b9921fd 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -205,8 +205,10 @@ struct hb_ot_map_builder_t inline void add_feature (const hb_ot_map_feature_t &feat) { add_feature (feat.tag, feat.flags); } - inline void enable_feature (hb_tag_t tag) - { add_feature (tag, F_GLOBAL); } + inline void enable_feature (hb_tag_t tag, + hb_ot_map_feature_flags_t flags=F_NONE, + unsigned int value=1) + { add_feature (tag, F_GLOBAL | flags, value); } inline void disable_feature (hb_tag_t tag) { add_feature (tag, F_GLOBAL, 0); } diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 9893a22fb..2cdd7ba8a 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -215,14 +215,14 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) * however, it says a ZWJ should also mean "don't ligate". So we run * the main ligating features as MANUAL_ZWJ. */ - map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL | F_MANUAL_ZWJ | F_HAS_FALLBACK); + map->enable_feature (HB_TAG('r','l','i','g'), F_MANUAL_ZWJ | F_HAS_FALLBACK); if (plan->props.script == HB_SCRIPT_ARABIC) map->add_gsub_pause (arabic_fallback_shape); /* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */ - map->add_feature (HB_TAG('r','c','l','t'), F_GLOBAL | F_MANUAL_ZWJ); - map->add_feature (HB_TAG('c','a','l','t'), F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (HB_TAG('r','c','l','t'), F_MANUAL_ZWJ); + map->enable_feature (HB_TAG('c','a','l','t'), F_MANUAL_ZWJ); map->add_gsub_pause (nullptr); /* And undo here. */ diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index b0ca3c74a..bebb8ec52 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -106,14 +106,14 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan) for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) { - map->add_feature (basic_features[i], F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (basic_features[i], F_MANUAL_ZWJ); map->add_gsub_pause (nullptr); } map->add_gsub_pause (final_reordering); for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->add_feature (other_features[i], F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (other_features[i], F_MANUAL_ZWJ); for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) map->enable_feature (positioning_features[i]); diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index bdcad409d..f9a580ca2 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -132,19 +132,19 @@ collect_features_use (hb_ot_shape_planner_t *plan) map->enable_feature (HB_TAG('l','o','c','l')); map->enable_feature (HB_TAG('c','c','m','p')); map->enable_feature (HB_TAG('n','u','k','t')); - map->add_feature (HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (HB_TAG('a','k','h','n'), F_MANUAL_ZWJ); /* "Reordering group" */ map->add_gsub_pause (clear_substitution_flags); map->add_feature (HB_TAG('r','p','h','f'), F_MANUAL_ZWJ); map->add_gsub_pause (record_rphf); map->add_gsub_pause (clear_substitution_flags); - map->add_feature (HB_TAG('p','r','e','f'), F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (HB_TAG('p','r','e','f'), F_MANUAL_ZWJ); map->add_gsub_pause (record_pref); /* "Orthographic unit shaping group" */ for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) - map->add_feature (basic_features[i], F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (basic_features[i], F_MANUAL_ZWJ); map->add_gsub_pause (reorder); @@ -155,7 +155,7 @@ collect_features_use (hb_ot_shape_planner_t *plan) /* "Standard typographic presentation" */ for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->add_feature (other_features[i], F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (other_features[i], F_MANUAL_ZWJ); /* "Positional feature application" */ for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 34434efe1..dc88fa9b4 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -125,7 +125,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, map->add_feature (HB_TAG ('d','n','o','m')); /* Random! */ - map->add_feature (HB_TAG ('r','a','n','d'), F_GLOBAL | F_RANDOM, HB_OT_MAP_MAX_VALUE); + map->enable_feature (HB_TAG ('r','a','n','d'), F_RANDOM, HB_OT_MAP_MAX_VALUE); if (planner->shaper->collect_features) planner->shaper->collect_features (planner); @@ -142,7 +142,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, * matter which script/langsys it is listed (or not) under. * See various bugs referenced from: * https://github.com/harfbuzz/harfbuzz/issues/63 */ - map->add_feature (HB_TAG ('v','e','r','t'), F_GLOBAL | F_GLOBAL_SEARCH); + map->enable_feature (HB_TAG ('v','e','r','t'), F_GLOBAL_SEARCH); } if (planner->shaper->override_features)