diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2018-11-12 18:05:02 -0500 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2018-11-12 18:05:02 -0500 |
commit | 1082338525c96206f43785e283e41b3e959871fd (patch) | |
tree | e620adeaa01a138d1768e7b47a165a2ed6d0fc1b | |
parent | 7ac03f88a22325fb4d6b77ee7694ad11f6a99bcb (diff) |
[shape-plan] Only use shape-plan key to initialize hb_ot_shape_plan_t
Such that we don't accidentally use info not in the cache key.
-rw-r--r-- | src/hb-ot-shape.cc | 25 | ||||
-rw-r--r-- | src/hb-ot-shape.hh | 8 | ||||
-rw-r--r-- | src/hb-shape-plan.cc | 7 |
3 files changed, 15 insertions, 25 deletions
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 2500bcb8..b94b0107 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -53,7 +53,6 @@ static void hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, - const hb_segment_properties_t *props, const hb_feature_t *user_features, unsigned int num_user_features); @@ -150,21 +149,20 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, bool hb_ot_shape_plan_t::init0 (hb_face_t *face, - const hb_segment_properties_t *props, - const hb_feature_t *user_features, - unsigned int num_user_features, - const int *coords, - unsigned int num_coords) + const hb_shape_plan_key_t *key) { map.init (); aat_map.init (); - hb_ot_shape_planner_t planner (face, props); + hb_ot_shape_planner_t planner (face, + &key->props); + hb_ot_shape_collect_features (&planner, + key->user_features, + key->num_user_features); - hb_ot_shape_collect_features (&planner, props, - user_features, num_user_features); - - planner.compile (*this, coords, num_coords); + planner.compile (*this, + key->coords, + key->num_coords); if (shaper->data_create) { @@ -211,7 +209,6 @@ horizontal_features[] = static void hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, - const hb_segment_properties_t *props, const hb_feature_t *user_features, unsigned int num_user_features) { @@ -220,7 +217,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, map->enable_feature (HB_TAG('r','v','r','n')); map->add_gsub_pause (nullptr); - switch (props->direction) { + switch (planner->props.direction) { case HB_DIRECTION_LTR: map->enable_feature (HB_TAG ('l','t','r','a')); map->enable_feature (HB_TAG ('l','t','r','m')); @@ -259,7 +256,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, for (unsigned int i = 0; i < ARRAY_LENGTH (common_features); i++) map->add_feature (common_features[i]); - if (HB_DIRECTION_IS_HORIZONTAL (props->direction)) + if (HB_DIRECTION_IS_HORIZONTAL (planner->props.direction)) for (unsigned int i = 0; i < ARRAY_LENGTH (horizontal_features); i++) map->add_feature (horizontal_features[i]); else diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh index 9753752a..956cc6df 100644 --- a/src/hb-ot-shape.hh +++ b/src/hb-ot-shape.hh @@ -33,6 +33,8 @@ #include "hb-aat-map.hh" +struct hb_shape_plan_key_t; + struct hb_ot_shape_plan_t { hb_segment_properties_t props; @@ -74,11 +76,7 @@ struct hb_ot_shape_plan_t inline void position (hb_font_t *font, hb_buffer_t *buffer) const { map.position (this, font, buffer); } HB_INTERNAL bool init0 (hb_face_t *face, - const hb_segment_properties_t *props, - const hb_feature_t *user_features, - unsigned int num_user_features, - const int *coords, - unsigned int num_coords); + const hb_shape_plan_key_t *key); HB_INTERNAL void fini (void); }; diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index 4c3ae062..70083c8b 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -194,12 +194,7 @@ hb_shape_plan_create2 (hb_face_t *face, num_coords, shaper_list))) goto bail2; - if (unlikely (!shape_plan->ot.init0 (face, - props, - user_features, - num_user_features, - coords, - num_coords))) + if (unlikely (!shape_plan->ot.init0 (face, &shape_plan->key))) goto bail3; return shape_plan; |