Allow complex shapers overriding common features

In a new callback...  Currently unused by all complex shapers.
diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index 54460f0..75f5fe9 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -199,6 +199,12 @@
   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 d9087d6..f8be98e 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -217,6 +217,12 @@
   }
 }
 
+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 52fbd6d..3cea734 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -42,6 +42,12 @@
 {
 }
 
+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 @@
     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 @@
 {
 }
 
+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 d2f7959..7f74e34 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -249,6 +249,36 @@
 
 
 /*
+ * 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()
  *
  * Called during shape_execute().
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 60b028d..b5485bd 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -123,6 +123,8 @@
   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++) {