Shift code around
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index e05a677..0de182f 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -53,6 +53,15 @@
 	 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 @@
    * 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_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 93fce2d..3fa594a 100644
--- a/src/hb-ot-shape.hh
+++ b/src/hb-ot-shape.hh
@@ -88,14 +88,11 @@
   /* 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,