From 76324d95caa4b83cd4b515f516c2d3674455ea5e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 23 Oct 2018 13:09:30 -0700 Subject: [PATCH] Shift code around --- src/hb-ot-shape.cc | 18 ++++++++++-------- src/hb-ot-shape.hh | 9 +++------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index e05a67706..0de182f4c 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -53,6 +53,15 @@ _hb_apply_morx (hb_face_t *face) hb_aat_layout_has_substitution (face); } +hb_ot_shape_planner_t::hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) : + face (master_plan->face_unsafe), + props (master_plan->props), + map (face, &props), + apply_morx (_hb_apply_morx (face)), + shaper (apply_morx ? + &_hb_ot_complex_shaper_default : + hb_ot_shape_complex_categorize (this)) {} + void hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, const int *coords, @@ -89,7 +98,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, * Decide who does substitutions. GSUB, morx, or fallback. */ - plan.apply_morx = _hb_apply_morx (face); + plan.apply_morx = apply_morx; /* * Decide who does positioning. GPOS, kerx, kern, or fallback. @@ -278,13 +287,6 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan, hb_ot_shape_planner_t planner (shape_plan); - /* Ugly that we have to do this here... - * If we are going to apply morx, choose default shaper. */ - if (_hb_apply_morx (planner.face)) - planner.shaper = &_hb_ot_complex_shaper_default; - else - planner.shaper = hb_ot_shape_complex_categorize (&planner); - hb_ot_shape_collect_features (&planner, &shape_plan->props, user_features, num_user_features); diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh index 93fce2d97..3fa594a85 100644 --- a/src/hb-ot-shape.hh +++ b/src/hb-ot-shape.hh @@ -88,14 +88,11 @@ struct hb_ot_shape_planner_t /* In the order that they are filled in. */ hb_face_t *face; hb_segment_properties_t props; - const struct hb_ot_complex_shaper_t *shaper; hb_ot_map_builder_t map; + bool apply_morx : 1; + const struct hb_ot_complex_shaper_t *shaper; - hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) : - face (master_plan->face_unsafe), - props (master_plan->props), - shaper (nullptr), - map (face, &props) {} + HB_INTERNAL hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan); HB_INTERNAL void compile (hb_ot_shape_plan_t &plan, const int *coords,