diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 54460f011..75f5fe9c6 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -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) { diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index d9087d648..f8be98e8e 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -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) diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc index 52fbd6d31..3cea7340a 100644 --- a/src/hb-ot-shape-complex-misc.cc +++ b/src/hb-ot-shape-complex-misc.cc @@ -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) { diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh index d2f7959dc..7f74e34a6 100644 --- a/src/hb-ot-shape-complex-private.hh +++ b/src/hb-ot-shape-complex-private.hh @@ -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() * diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 60b028d34..b5485bd8a 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -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++) {