Clean-up add_bool_feature

This commit is contained in:
Behdad Esfahbod 2013-02-14 11:05:56 -05:00
parent e7562f53fe
commit e7ffcfafb1
7 changed files with 28 additions and 28 deletions

View File

@ -155,8 +155,8 @@ struct hb_ot_map_builder_t
HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value, bool global, bool has_fallback = false); HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value, bool global, bool has_fallback = false);
inline void add_bool_feature (hb_tag_t tag, bool global = true, bool has_fallback = false) inline void add_global_bool_feature (hb_tag_t tag)
{ add_feature (tag, 1, global, has_fallback); } { add_feature (tag, 1, true, false); }
inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func) inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func)
{ add_pause (0, pause_func); } { add_pause (0, pause_func); }

View File

@ -178,25 +178,25 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
* TODO: Add test cases for these two. * TODO: Add test cases for these two.
*/ */
map->add_bool_feature (HB_TAG('c','c','m','p')); map->add_global_bool_feature (HB_TAG('c','c','m','p'));
map->add_bool_feature (HB_TAG('l','o','c','l')); map->add_global_bool_feature (HB_TAG('l','o','c','l'));
map->add_gsub_pause (NULL); map->add_gsub_pause (NULL);
for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++) for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++)
map->add_bool_feature (arabic_features[i], false, i < 4); /* The first four features have fallback. */ map->add_feature (arabic_features[i], 1, false, i < 4); /* The first four features have fallback. */
map->add_gsub_pause (NULL); map->add_gsub_pause (NULL);
map->add_bool_feature (HB_TAG('r','l','i','g'), true, true); map->add_feature (HB_TAG('r','l','i','g'), 1, true, true);
map->add_gsub_pause (arabic_fallback_shape); map->add_gsub_pause (arabic_fallback_shape);
map->add_bool_feature (HB_TAG('c','a','l','t')); map->add_global_bool_feature (HB_TAG('c','a','l','t'));
map->add_gsub_pause (NULL); map->add_gsub_pause (NULL);
map->add_bool_feature (HB_TAG('c','s','w','h')); map->add_global_bool_feature (HB_TAG('c','s','w','h'));
map->add_bool_feature (HB_TAG('d','l','i','g')); map->add_global_bool_feature (HB_TAG('d','l','i','g'));
map->add_bool_feature (HB_TAG('m','s','e','t')); map->add_global_bool_feature (HB_TAG('m','s','e','t'));
} }
#include "hb-ot-shape-complex-arabic-fallback.hh" #include "hb-ot-shape-complex-arabic-fallback.hh"

View File

@ -68,7 +68,7 @@ collect_features_default (hb_ot_shape_planner_t *plan)
} }
for (; script_features && *script_features; script_features++) for (; script_features && *script_features; script_features++)
plan->map.add_bool_feature (*script_features); plan->map.add_global_bool_feature (*script_features);
} }
static hb_ot_shape_normalization_mode_t static hb_ot_shape_normalization_mode_t

View File

@ -419,21 +419,21 @@ collect_features_indic (hb_ot_shape_planner_t *plan)
/* Do this before any lookups have been applied. */ /* Do this before any lookups have been applied. */
map->add_gsub_pause (setup_syllables); map->add_gsub_pause (setup_syllables);
map->add_bool_feature (HB_TAG('l','o','c','l')); map->add_global_bool_feature (HB_TAG('l','o','c','l'));
/* The Indic specs do not require ccmp, but we apply it here since if /* 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. */ * there is a use of it, it's typically at the beginning. */
map->add_bool_feature (HB_TAG('c','c','m','p')); map->add_global_bool_feature (HB_TAG('c','c','m','p'));
unsigned int i = 0; unsigned int i = 0;
map->add_gsub_pause (initial_reordering); map->add_gsub_pause (initial_reordering);
for (; i < INDIC_BASIC_FEATURES; i++) { for (; i < INDIC_BASIC_FEATURES; i++) {
map->add_bool_feature (indic_features[i].tag, indic_features[i].is_global); map->add_feature (indic_features[i].tag, 1, indic_features[i].is_global);
map->add_gsub_pause (NULL); map->add_gsub_pause (NULL);
} }
map->add_gsub_pause (final_reordering); map->add_gsub_pause (final_reordering);
for (; i < INDIC_NUM_FEATURES; i++) { for (; i < INDIC_NUM_FEATURES; i++) {
map->add_bool_feature (indic_features[i].tag, indic_features[i].is_global); map->add_feature (indic_features[i].tag, 1, indic_features[i].is_global);
} }
} }

View File

@ -98,21 +98,21 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan)
/* Do this before any lookups have been applied. */ /* Do this before any lookups have been applied. */
map->add_gsub_pause (setup_syllables); map->add_gsub_pause (setup_syllables);
map->add_bool_feature (HB_TAG('l','o','c','l')); map->add_global_bool_feature (HB_TAG('l','o','c','l'));
/* The Indic specs do not require ccmp, but we apply it here since if /* 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. */ * there is a use of it, it's typically at the beginning. */
map->add_bool_feature (HB_TAG('c','c','m','p')); map->add_global_bool_feature (HB_TAG('c','c','m','p'));
unsigned int i = 0; unsigned int i = 0;
map->add_gsub_pause (initial_reordering); map->add_gsub_pause (initial_reordering);
for (; i < MYANMAR_BASIC_FEATURES; i++) { for (; i < MYANMAR_BASIC_FEATURES; i++) {
map->add_bool_feature (myanmar_features[i]); map->add_global_bool_feature (myanmar_features[i]);
map->add_gsub_pause (NULL); map->add_gsub_pause (NULL);
} }
map->add_gsub_pause (final_reordering); map->add_gsub_pause (final_reordering);
for (; i < MYANMAR_NUM_FEATURES; i++) { for (; i < MYANMAR_NUM_FEATURES; i++) {
map->add_bool_feature (myanmar_features[i]); map->add_global_bool_feature (myanmar_features[i]);
} }
} }

View File

@ -100,21 +100,21 @@ collect_features_sea (hb_ot_shape_planner_t *plan)
/* Do this before any lookups have been applied. */ /* Do this before any lookups have been applied. */
map->add_gsub_pause (setup_syllables); map->add_gsub_pause (setup_syllables);
map->add_bool_feature (HB_TAG('l','o','c','l')); map->add_global_bool_feature (HB_TAG('l','o','c','l'));
/* The Indic specs do not require ccmp, but we apply it here since if /* 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. */ * there is a use of it, it's typically at the beginning. */
map->add_bool_feature (HB_TAG('c','c','m','p')); map->add_global_bool_feature (HB_TAG('c','c','m','p'));
unsigned int i = 0; unsigned int i = 0;
map->add_gsub_pause (initial_reordering); map->add_gsub_pause (initial_reordering);
for (; i < SEA_BASIC_FEATURES; i++) { for (; i < SEA_BASIC_FEATURES; i++) {
map->add_bool_feature (sea_features[i]); map->add_global_bool_feature (sea_features[i]);
map->add_gsub_pause (NULL); map->add_gsub_pause (NULL);
} }
map->add_gsub_pause (final_reordering); map->add_gsub_pause (final_reordering);
for (; i < SEA_NUM_FEATURES; i++) { for (; i < SEA_NUM_FEATURES; i++) {
map->add_bool_feature (sea_features[i]); map->add_global_bool_feature (sea_features[i]);
} }
} }

View File

@ -83,12 +83,12 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
switch (props->direction) { switch (props->direction) {
case HB_DIRECTION_LTR: case HB_DIRECTION_LTR:
map->add_bool_feature (HB_TAG ('l','t','r','a')); map->add_global_bool_feature (HB_TAG ('l','t','r','a'));
map->add_bool_feature (HB_TAG ('l','t','r','m')); map->add_global_bool_feature (HB_TAG ('l','t','r','m'));
break; break;
case HB_DIRECTION_RTL: case HB_DIRECTION_RTL:
map->add_bool_feature (HB_TAG ('r','t','l','a')); map->add_global_bool_feature (HB_TAG ('r','t','l','a'));
map->add_bool_feature (HB_TAG ('r','t','l','m'), false); map->add_feature (HB_TAG ('r','t','l','m'), 1, false);
break; break;
case HB_DIRECTION_TTB: case HB_DIRECTION_TTB:
case HB_DIRECTION_BTT: case HB_DIRECTION_BTT:
@ -100,7 +100,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
#define ADD_FEATURES(array) \ #define ADD_FEATURES(array) \
HB_STMT_START { \ HB_STMT_START { \
for (unsigned int i = 0; i < ARRAY_LENGTH (array); i++) \ for (unsigned int i = 0; i < ARRAY_LENGTH (array); i++) \
map->add_bool_feature (array[i]); \ map->add_global_bool_feature (array[i]); \
} HB_STMT_END } HB_STMT_END
if (planner->shaper->collect_features) if (planner->shaper->collect_features)