From f6fd3780e12b23ff7ed3743497c8996e71dcb064 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 8 Jul 2011 00:22:40 -0400 Subject: [PATCH] Let shapers decide when to apply ccmp and locl Instead of always applying those two features before the complex shaper, let the complex shaper decide whether they should be applied first. Also add stub for Indic's final_reordering(). --- src/hb-ot-shape-complex-arabic.cc | 2 ++ src/hb-ot-shape-complex-indic.cc | 16 ++++++++++++++++ src/hb-ot-shape.cc | 7 +------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 3b0bb936c..9720f7ab9 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -163,6 +163,8 @@ _hb_ot_shape_complex_collect_features_arabic (hb_ot_map_builder_t *map, const hb * TODO: Add test cases for these two. */ + map->add_bool_feature (HB_TAG('c','c','m','p')); + map->add_gsub_pause (NULL, NULL); unsigned int num_features = props->script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES; diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index e3832f46e..53464aa48 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -281,13 +281,29 @@ static const hb_tag_t indic_other_features[] = HB_TAG('b','l','w','m'), }; +static void +final_reordering (const hb_ot_map_t *map, + hb_face_t *face, + hb_buffer_t *buffer, + void *user_data HB_UNUSED) +{ +} void _hb_ot_shape_complex_collect_features_indic (hb_ot_map_builder_t *map, const hb_segment_properties_t *props) { + map->add_bool_feature (HB_TAG('l','o','c','l')); + /* The Indic specs do not require ccmp, but we apply 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_gsub_pause (NULL, NULL); + for (unsigned int i = 0; i < ARRAY_LENGTH (indic_basic_features); i++) map->add_bool_feature (indic_basic_features[i].tag, indic_basic_features[i].is_global); + map->add_gsub_pause (final_reordering, NULL); + for (unsigned int i = 0; i < ARRAY_LENGTH (indic_other_features); i++) map->add_bool_feature (indic_other_features[i], true); } diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 8378e813c..7a84d9b2c 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -34,12 +34,9 @@ HB_BEGIN_DECLS -hb_tag_t early_features[] = { +hb_tag_t common_features[] = { HB_TAG('c','c','m','p'), HB_TAG('l','o','c','l'), -}; - -hb_tag_t common_features[] = { HB_TAG('m','a','r','k'), HB_TAG('m','k','m','k'), HB_TAG('r','l','i','g'), @@ -94,8 +91,6 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, planner->map.add_bool_feature (array[i]); \ } HB_STMT_END - ADD_FEATURES (early_features); - hb_ot_shape_complex_collect_features (planner->shaper, &planner->map, props); ADD_FEATURES (common_features);