Clean-up add_bool_feature
This commit is contained in:
parent
e7562f53fe
commit
e7ffcfafb1
@ -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);
|
||||
|
||||
inline void add_bool_feature (hb_tag_t tag, bool global = true, bool has_fallback = false)
|
||||
{ add_feature (tag, 1, global, has_fallback); }
|
||||
inline void add_global_bool_feature (hb_tag_t tag)
|
||||
{ add_feature (tag, 1, true, false); }
|
||||
|
||||
inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func)
|
||||
{ add_pause (0, pause_func); }
|
||||
|
@ -178,25 +178,25 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
|
||||
* TODO: Add test cases for these two.
|
||||
*/
|
||||
|
||||
map->add_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('c','c','m','p'));
|
||||
map->add_global_bool_feature (HB_TAG('l','o','c','l'));
|
||||
|
||||
map->add_gsub_pause (NULL);
|
||||
|
||||
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_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_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_bool_feature (HB_TAG('c','s','w','h'));
|
||||
map->add_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('c','s','w','h'));
|
||||
map->add_global_bool_feature (HB_TAG('d','l','i','g'));
|
||||
map->add_global_bool_feature (HB_TAG('m','s','e','t'));
|
||||
}
|
||||
|
||||
#include "hb-ot-shape-complex-arabic-fallback.hh"
|
||||
|
@ -68,7 +68,7 @@ collect_features_default (hb_ot_shape_planner_t *plan)
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -419,21 +419,21 @@ collect_features_indic (hb_ot_shape_planner_t *plan)
|
||||
/* Do this before any lookups have been applied. */
|
||||
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
|
||||
* 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;
|
||||
map->add_gsub_pause (initial_reordering);
|
||||
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 (final_reordering);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,21 +98,21 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan)
|
||||
/* Do this before any lookups have been applied. */
|
||||
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
|
||||
* 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;
|
||||
map->add_gsub_pause (initial_reordering);
|
||||
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 (final_reordering);
|
||||
for (; i < MYANMAR_NUM_FEATURES; i++) {
|
||||
map->add_bool_feature (myanmar_features[i]);
|
||||
map->add_global_bool_feature (myanmar_features[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,21 +100,21 @@ collect_features_sea (hb_ot_shape_planner_t *plan)
|
||||
/* Do this before any lookups have been applied. */
|
||||
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
|
||||
* 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;
|
||||
map->add_gsub_pause (initial_reordering);
|
||||
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 (final_reordering);
|
||||
for (; i < SEA_NUM_FEATURES; i++) {
|
||||
map->add_bool_feature (sea_features[i]);
|
||||
map->add_global_bool_feature (sea_features[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,12 +83,12 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
||||
|
||||
switch (props->direction) {
|
||||
case HB_DIRECTION_LTR:
|
||||
map->add_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','a'));
|
||||
map->add_global_bool_feature (HB_TAG ('l','t','r','m'));
|
||||
break;
|
||||
case HB_DIRECTION_RTL:
|
||||
map->add_bool_feature (HB_TAG ('r','t','l','a'));
|
||||
map->add_bool_feature (HB_TAG ('r','t','l','m'), false);
|
||||
map->add_global_bool_feature (HB_TAG ('r','t','l','a'));
|
||||
map->add_feature (HB_TAG ('r','t','l','m'), 1, false);
|
||||
break;
|
||||
case HB_DIRECTION_TTB:
|
||||
case HB_DIRECTION_BTT:
|
||||
@ -100,7 +100,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
||||
#define ADD_FEATURES(array) \
|
||||
HB_STMT_START { \
|
||||
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
|
||||
|
||||
if (planner->shaper->collect_features)
|
||||
|
Loading…
Reference in New Issue
Block a user