Some more
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index cb70583..ebac6d1 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -74,8 +74,9 @@
stages[table_index].fini ();
}
-void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value,
- hb_ot_map_feature_flags_t flags)
+void hb_ot_map_builder_t::add_feature (hb_tag_t tag,
+ hb_ot_map_feature_flags_t flags,
+ unsigned int value)
{
feature_info_t *info = feature_infos.push();
if (unlikely (!tag)) return;
diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh
index c4e7837..f719cc6 100644
--- a/src/hb-ot-map.hh
+++ b/src/hb-ot-map.hh
@@ -196,17 +196,18 @@
HB_INTERNAL ~hb_ot_map_builder_t (void);
- HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value,
- hb_ot_map_feature_flags_t flags);
+ HB_INTERNAL void add_feature (hb_tag_t tag,
+ hb_ot_map_feature_flags_t flags=F_NONE,
+ unsigned int value=1);
inline void add_feature (const hb_ot_map_feature_t &feat)
- { add_feature (feat.tag, 1, feat.flags); }
+ { add_feature (feat.tag, feat.flags); }
- inline void add_global_bool_feature (hb_tag_t tag)
- { add_feature (tag, 1, F_GLOBAL); }
+ inline void enable_feature (hb_tag_t tag)
+ { add_feature (tag, F_GLOBAL); }
inline void disable_feature (hb_tag_t tag)
- { add_feature (tag, 0, F_GLOBAL); }
+ { add_feature (tag, F_GLOBAL, 0); }
inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func)
{ add_pause (0, pause_func); }
diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index ebc1d3d..fff3b31 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -202,28 +202,28 @@
map->add_gsub_pause (nuke_joiners);
- map->add_global_bool_feature (HB_TAG('s','t','c','h'));
+ map->enable_feature (HB_TAG('s','t','c','h'));
map->add_gsub_pause (record_stch);
- map->add_global_bool_feature (HB_TAG('c','c','m','p'));
- map->add_global_bool_feature (HB_TAG('l','o','c','l'));
+ map->enable_feature (HB_TAG('c','c','m','p'));
+ map->enable_feature (HB_TAG('l','o','c','l'));
map->add_gsub_pause (nullptr);
for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++)
{
bool has_fallback = plan->props.script == HB_SCRIPT_ARABIC && !FEATURE_IS_SYRIAC (arabic_features[i]);
- map->add_feature (arabic_features[i], 1, has_fallback ? F_HAS_FALLBACK : F_NONE);
+ map->add_feature (arabic_features[i], has_fallback ? F_HAS_FALLBACK : F_NONE);
map->add_gsub_pause (nullptr);
}
- map->add_feature (HB_TAG('r','l','i','g'), 1, F_GLOBAL|F_HAS_FALLBACK);
+ map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL|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_global_bool_feature (HB_TAG('r','c','l','t'));
- map->add_global_bool_feature (HB_TAG('c','a','l','t'));
+ map->enable_feature (HB_TAG('r','c','l','t'));
+ map->enable_feature (HB_TAG('c','a','l','t'));
map->add_gsub_pause (nullptr);
/* The spec includes 'cswh'. Earlier versions of Windows
@@ -234,8 +234,8 @@
* Note that IranNastaliq uses this feature extensively
* to fixup broken glyph sequences. Oh well...
* Test case: U+0643,U+0640,U+0631. */
- //map->add_global_bool_feature (HB_TAG('c','s','w','h'));
- map->add_global_bool_feature (HB_TAG('m','s','e','t'));
+ //map->enable_feature (HB_TAG('c','s','w','h'));
+ map->enable_feature (HB_TAG('m','s','e','t'));
}
#include "hb-ot-shape-complex-arabic-fallback.hh"
diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc
index 3d8199b..96fd426 100644
--- a/src/hb-ot-shape-complex-hangul.cc
+++ b/src/hb-ot-shape-complex-hangul.cc
@@ -56,7 +56,7 @@
hb_ot_map_builder_t *map = &plan->map;
for (unsigned int i = FIRST_HANGUL_FEATURE; i < HANGUL_FEATURE_COUNT; i++)
- map->add_feature (hangul_features[i], 1, F_NONE);
+ map->add_feature (hangul_features[i]);
}
static void
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index b541402..e2fae7a 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -190,10 +190,10 @@
/* Do this before any lookups have been applied. */
map->add_gsub_pause (setup_syllables);
- map->add_global_bool_feature (HB_TAG('l','o','c','l'));
+ map->enable_feature (HB_TAG('l','o','c','l'));
/* The Indic specs do not require ccmp, but we apply it here since if
* there is a use of it, it's typically at the beginning. */
- map->add_global_bool_feature (HB_TAG('c','c','m','p'));
+ map->enable_feature (HB_TAG('c','c','m','p'));
unsigned int i = 0;
@@ -209,8 +209,8 @@
for (; i < INDIC_NUM_FEATURES; i++)
map->add_feature (indic_features[i]);
- map->add_global_bool_feature (HB_TAG('c','a','l','t'));
- map->add_global_bool_feature (HB_TAG('c','l','i','g'));
+ map->enable_feature (HB_TAG('c','a','l','t'));
+ map->enable_feature (HB_TAG('c','l','i','g'));
map->add_gsub_pause (clear_syllables);
}
diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc
index 9987841..7705929 100644
--- a/src/hb-ot-shape-complex-khmer.cc
+++ b/src/hb-ot-shape-complex-khmer.cc
@@ -116,8 +116,8 @@
*
* https://github.com/harfbuzz/harfbuzz/issues/974
*/
- map->add_global_bool_feature (HB_TAG('l','o','c','l'));
- map->add_global_bool_feature (HB_TAG('c','c','m','p'));
+ map->enable_feature (HB_TAG('l','o','c','l'));
+ map->enable_feature (HB_TAG('c','c','m','p'));
unsigned int i = 0;
for (; i < KHMER_BASIC_FEATURES; i++)
@@ -128,8 +128,8 @@
for (; i < KHMER_NUM_FEATURES; i++)
map->add_feature (khmer_features[i]);
- map->add_global_bool_feature (HB_TAG('c','a','l','t'));
- map->add_global_bool_feature (HB_TAG('c','l','i','g'));
+ map->enable_feature (HB_TAG('c','a','l','t'));
+ map->enable_feature (HB_TAG('c','l','i','g'));
}
diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc
index 215e705..532ebfd 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
@@ -96,27 +96,27 @@
/* Do this before any lookups have been applied. */
map->add_gsub_pause (setup_syllables);
- map->add_global_bool_feature (HB_TAG('l','o','c','l'));
+ map->enable_feature (HB_TAG('l','o','c','l'));
/* The Indic specs do not require ccmp, but we apply it here since if
* there is a use of it, it's typically at the beginning. */
- map->add_global_bool_feature (HB_TAG('c','c','m','p'));
+ map->enable_feature (HB_TAG('c','c','m','p'));
map->add_gsub_pause (initial_reordering);
for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++)
{
- map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ);
+ map->add_feature (basic_features[i], F_GLOBAL | 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], 1, F_GLOBAL | F_MANUAL_ZWJ);
+ map->add_feature (other_features[i], F_GLOBAL | F_MANUAL_ZWJ);
for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++)
- map->add_feature (positioning_features[i], 1, F_GLOBAL);
+ map->enable_feature (positioning_features[i]);
}
static void
diff --git a/src/hb-ot-shape-complex-tibetan.cc b/src/hb-ot-shape-complex-tibetan.cc
index 9982ebc..27c60b1 100644
--- a/src/hb-ot-shape-complex-tibetan.cc
+++ b/src/hb-ot-shape-complex-tibetan.cc
@@ -40,7 +40,7 @@
collect_features_tibetan (hb_ot_shape_planner_t *plan)
{
for (const hb_tag_t *script_features = tibetan_features; script_features && *script_features; script_features++)
- plan->map.add_global_bool_feature (*script_features);
+ plan->map.enable_feature (*script_features);
}
diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index 62aef7e..0ca088b 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -129,37 +129,37 @@
map->add_gsub_pause (setup_syllables);
/* "Default glyph pre-processing group" */
- map->add_global_bool_feature (HB_TAG('l','o','c','l'));
- map->add_global_bool_feature (HB_TAG('c','c','m','p'));
- map->add_global_bool_feature (HB_TAG('n','u','k','t'));
- map->add_global_bool_feature (HB_TAG('a','k','h','n'));
+ 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->enable_feature (HB_TAG('a','k','h','n'));
/* "Reordering group" */
map->add_gsub_pause (clear_substitution_flags);
- map->add_feature (HB_TAG('r','p','h','f'), 1, F_MANUAL_ZWJ);
+ 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'), 1, F_GLOBAL | F_MANUAL_ZWJ);
+ map->add_feature (HB_TAG('p','r','e','f'), F_GLOBAL | 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], 1, F_GLOBAL | F_MANUAL_ZWJ);
+ map->add_feature (basic_features[i], F_GLOBAL | F_MANUAL_ZWJ);
map->add_gsub_pause (reorder);
/* "Topographical features" */
for (unsigned int i = 0; i < ARRAY_LENGTH (arabic_features); i++)
- map->add_feature (arabic_features[i], 1, F_NONE);
+ map->add_feature (arabic_features[i]);
map->add_gsub_pause (nullptr);
/* "Standard typographic presentation" */
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
- map->add_feature (other_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ);
+ map->add_feature (other_features[i], F_GLOBAL | F_MANUAL_ZWJ);
/* "Positional feature application" */
for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++)
- map->add_feature (positioning_features[i], 1, F_GLOBAL);
+ map->enable_feature (positioning_features[i]);
}
struct use_shape_plan_t
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 437b0fe..6bfd2c7 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -71,17 +71,17 @@
{
hb_ot_map_builder_t *map = &planner->map;
- map->add_global_bool_feature (HB_TAG('r','v','r','n'));
+ map->enable_feature (HB_TAG('r','v','r','n'));
map->add_gsub_pause (nullptr);
switch (props->direction) {
case HB_DIRECTION_LTR:
- map->add_global_bool_feature (HB_TAG ('l','t','r','a'));
- map->add_global_bool_feature (HB_TAG ('l','t','r','m'));
+ map->enable_feature (HB_TAG ('l','t','r','a'));
+ map->enable_feature (HB_TAG ('l','t','r','m'));
break;
case HB_DIRECTION_RTL:
- map->add_global_bool_feature (HB_TAG ('r','t','l','a'));
- map->add_feature (HB_TAG ('r','t','l','m'), 1, F_NONE);
+ map->enable_feature (HB_TAG ('r','t','l','a'));
+ map->add_feature (HB_TAG ('r','t','l','m'));
break;
case HB_DIRECTION_TTB:
case HB_DIRECTION_BTT:
@@ -91,22 +91,22 @@
}
/* Automatic fractions. */
- map->add_feature (HB_TAG ('f','r','a','c'), 1, F_NONE);
- map->add_feature (HB_TAG ('n','u','m','r'), 1, F_NONE);
- map->add_feature (HB_TAG ('d','n','o','m'), 1, F_NONE);
+ map->add_feature (HB_TAG ('f','r','a','c'));
+ map->add_feature (HB_TAG ('n','u','m','r'));
+ map->add_feature (HB_TAG ('d','n','o','m'));
/* Random! */
- map->add_feature (HB_TAG ('r','a','n','d'), HB_OT_MAP_MAX_VALUE, F_GLOBAL | F_RANDOM);
+ map->add_feature (HB_TAG ('r','a','n','d'), F_GLOBAL | F_RANDOM, HB_OT_MAP_MAX_VALUE);
if (planner->shaper->collect_features)
planner->shaper->collect_features (planner);
for (unsigned int i = 0; i < ARRAY_LENGTH (common_features); i++)
- map->add_global_bool_feature (common_features[i]);
+ map->enable_feature (common_features[i]);
if (HB_DIRECTION_IS_HORIZONTAL (props->direction))
for (unsigned int i = 0; i < ARRAY_LENGTH (horizontal_features); i++)
- map->add_feature (horizontal_features[i], 1, F_GLOBAL |
+ map->add_feature (horizontal_features[i], F_GLOBAL |
(horizontal_features[i] == HB_TAG('k','e','r','n') ?
F_HAS_FALLBACK : F_NONE));
else
@@ -115,7 +115,7 @@
* 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'), 1, F_GLOBAL | F_GLOBAL_SEARCH);
+ map->add_feature (HB_TAG ('v','e','r','t'), F_GLOBAL | F_GLOBAL_SEARCH);
}
if (planner->shaper->override_features)
@@ -124,9 +124,9 @@
for (unsigned int i = 0; i < num_user_features; i++)
{
const hb_feature_t *feature = &user_features[i];
- map->add_feature (feature->tag, feature->value,
- (feature->start == 0 && feature->end == (unsigned int) -1) ?
- F_GLOBAL : F_NONE);
+ map->add_feature (feature->tag,
+ (feature->start == 0 && feature->end == (unsigned int) -1) ? F_GLOBAL : F_NONE,
+ feature->value);
}
}