[OT] Unbreak Thai shaping and fallback Arabic shaping

The merger of normalizer and glyph-mapping broke shapers that
modified text stream.  Unbreak them by adding a new preprocess_text
shaping stage that happens before normalizing/cmap and disallow
setup_mask modification of actual text.
diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 4f1dd5b..13bc22b 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010  Google, Inc.
+ * Copyright © 2010,2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -90,6 +90,7 @@
   NULL, /* override_features */
   NULL, /* data_create */
   NULL, /* data_destroy */
+  NULL, /* preprocess_text */
   normalization_preference_default,
   NULL, /* setup_masks */
   true, /* zero_width_attached_marks */
@@ -99,9 +100,9 @@
 /* Thai / Lao shaper */
 
 static void
-setup_masks_thai (const hb_ot_shape_plan_t *plan HB_UNUSED,
-		  hb_buffer_t              *buffer,
-		  hb_font_t                *font HB_UNUSED)
+preprocess_text_thai (const hb_ot_shape_plan_t *plan HB_UNUSED,
+		      hb_buffer_t              *buffer,
+		      hb_font_t                *font HB_UNUSED)
 {
   /* The following is NOT specified in the MS OT Thai spec, however, it seems
    * to be what Uniscribe and other engines implement.  According to Eric Muller:
@@ -200,7 +201,8 @@
   NULL, /* override_features */
   NULL, /* data_create */
   NULL, /* data_destroy */
+  preprocess_text_thai,
   NULL, /* normalization_preference */
-  setup_masks_thai,
+  NULL, /* setup_masks */
   true, /* zero_width_attached_marks */
 };