diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc index 03c9ba1cfd2920ff543f0205501b1019d0bcd68b..7192c2ba1bef3bd8e027090c0e64e93e462ae1b3 100644 --- a/src/hb-ot-map.cc +++ b/src/hb-ot-map.cc @@ -28,8 +28,6 @@ #include "hb-ot-map-private.hh" -#include "hb-ot-shape-private.hh" - void hb_ot_map_t::add_lookups (hb_face_t *face, @@ -303,5 +301,3 @@ hb_ot_map_builder_t::compile (hb_face_t *face, } } } - - diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh index fd45e2db4a3a2b8af220107e52000e2c1d982191..89f15bef926db9bf57d9fd8e60f021b9b5e89fdf 100644 --- a/src/hb-ot-shape-private.hh +++ b/src/hb-ot-shape-private.hh @@ -35,11 +35,37 @@ struct hb_ot_shape_plan_t { + const hb_ot_complex_shaper_t *shaper; hb_ot_map_t map; +}; + +struct hb_ot_shape_planner_t +{ + /* In the order that they are filled in. */ + hb_face_t *face; + hb_segment_properties_t props; const hb_ot_complex_shaper_t *shaper; + hb_ot_map_builder_t map; + + hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) : + face (master_plan->face), + props (master_plan->props), + shaper (NULL), + map () {} + ~hb_ot_shape_planner_t (void) { map.finish (); } + + inline void compile (hb_ot_shape_plan_t &plan) + { + plan.shaper = shaper; + map.compile (face, &props, plan.map); + } + + private: + NO_COPY (hb_ot_shape_planner_t); }; + inline void _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode) { diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 66664c5c60aa177021f9406496f258c6abcc8654..f6d7a839dd918738c5ab5014d030ee7c443816f7 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -70,26 +70,6 @@ hb_tag_t vertical_features[] = { -struct hb_ot_shape_planner_t -{ - hb_ot_map_builder_t map; - const hb_ot_complex_shaper_t *shaper; - - hb_ot_shape_planner_t (void) : map () {} - ~hb_ot_shape_planner_t (void) { map.finish (); } - - inline void compile (hb_face_t *face, - const hb_segment_properties_t *props, - hb_ot_shape_plan_t &plan) - { - plan.shaper = shaper; - map.compile (face, props, plan.map); - } - - private: - NO_COPY (hb_ot_shape_planner_t); -}; - static void hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, const hb_segment_properties_t *props, @@ -188,15 +168,13 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan, if (unlikely (!data)) return NULL; - hb_ot_shape_planner_t planner; - - assert (HB_DIRECTION_IS_VALID (shape_plan->props.direction)); + hb_ot_shape_planner_t planner (shape_plan); planner.shaper = hb_ot_shape_complex_categorize (&shape_plan->props); hb_ot_shape_collect_features (&planner, &shape_plan->props, user_features, num_user_features); - planner.compile (shape_plan->face, &shape_plan->props, *data); + planner.compile (*data); return data; } diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index a478ba51dc6c9f0191c67cf08ac090c3cc543b64..974c37028f988d520e8a82189623eff4ac7e5dc1 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -90,6 +90,8 @@ hb_shape_plan_create (hb_face_t *face, unsigned int num_user_features, const char * const *shaper_list) { + assert (props->direction != HB_DIRECTION_INVALID); + hb_shape_plan_t *shape_plan; if (unlikely (!face)) diff --git a/src/hb-shape.cc b/src/hb-shape.cc index b3d373bf104503131aef0c8b0a8b20115ae745e5..5aa587bc35f3b2f2fef2a2d36d47dcb545d9b696 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -87,8 +87,6 @@ hb_shape_full (hb_font_t *font, buffer->guess_properties (); - assert (buffer->props.direction != HB_DIRECTION_INVALID); - hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props, features, num_features, shaper_list); hb_bool_t res = hb_shape_plan_execute (shape_plan, font, buffer, features, num_features); hb_shape_plan_destroy (shape_plan);