Allow complex shapers overriding common features

In a new callback...  Currently unused by all complex shapers.
This commit is contained in:
Behdad Esfahbod 2012-07-16 20:26:57 -04:00
parent df50b84740
commit d96838ef95
5 changed files with 62 additions and 0 deletions

View File

@ -199,6 +199,12 @@ _hb_ot_shape_complex_collect_features_arabic (hb_ot_map_builder_t *map,
map->add_bool_feature (HB_TAG('c','s','w','h'));
}
void
_hb_ot_shape_complex_override_features_arabic (hb_ot_map_builder_t *map,
const hb_segment_properties_t *props)
{
}
hb_ot_shape_normalization_mode_t
_hb_ot_shape_complex_normalization_preference_arabic (void)
{

View File

@ -217,6 +217,12 @@ _hb_ot_shape_complex_collect_features_indic (hb_ot_map_builder_t *map,
}
}
void
_hb_ot_shape_complex_override_features_indic (hb_ot_map_builder_t *map,
const hb_segment_properties_t *props HB_UNUSED)
{
}
hb_ot_shape_normalization_mode_t
_hb_ot_shape_complex_normalization_preference_indic (void)

View File

@ -42,6 +42,12 @@ _hb_ot_shape_complex_collect_features_default (hb_ot_map_builder_t *map HB_UNUSE
{
}
void
_hb_ot_shape_complex_override_features_default (hb_ot_map_builder_t *map HB_UNUSED,
const hb_segment_properties_t *props HB_UNUSED)
{
}
hb_ot_shape_normalization_mode_t
_hb_ot_shape_complex_normalization_preference_default (void)
{
@ -74,6 +80,12 @@ _hb_ot_shape_complex_collect_features_hangul (hb_ot_map_builder_t *map,
map->add_bool_feature (hangul_features[i]);
}
void
_hb_ot_shape_complex_override_features_hangul (hb_ot_map_builder_t *map,
const hb_segment_properties_t *props HB_UNUSED)
{
}
hb_ot_shape_normalization_mode_t
_hb_ot_shape_complex_normalization_preference_hangul (void)
{
@ -97,6 +109,12 @@ _hb_ot_shape_complex_collect_features_thai (hb_ot_map_builder_t *map HB_UNUSED,
{
}
void
_hb_ot_shape_complex_override_features_thai (hb_ot_map_builder_t *map HB_UNUSED,
const hb_segment_properties_t *props HB_UNUSED)
{
}
hb_ot_shape_normalization_mode_t
_hb_ot_shape_complex_normalization_preference_thai (void)
{

View File

@ -248,6 +248,36 @@ hb_ot_shape_complex_collect_features (hb_ot_complex_shaper_t shaper,
}
/*
* override_features()
*
* Called during shape_plan().
*
* Shapers should use map to override features and add callbacks after
* common features are added.
*/
typedef void hb_ot_shape_complex_override_features_func_t (hb_ot_map_builder_t *map, const hb_segment_properties_t *props);
#define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
HB_INTERNAL hb_ot_shape_complex_override_features_func_t _hb_ot_shape_complex_override_features_##name;
HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
#undef HB_COMPLEX_SHAPER_IMPLEMENT
static inline void
hb_ot_shape_complex_override_features (hb_ot_complex_shaper_t shaper,
hb_ot_map_builder_t *map,
const hb_segment_properties_t *props)
{
switch (shaper) {
default:
#define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_override_features_##name (map, props); return;
HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
#undef HB_COMPLEX_SHAPER_IMPLEMENT
}
}
/*
* normalization_preference()
*

View File

@ -123,6 +123,8 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
else
ADD_FEATURES (vertical_features);
hb_ot_shape_complex_override_features (planner->shaper, &planner->map, props);
#undef ADD_FEATURES
for (unsigned int i = 0; i < num_user_features; i++) {