[indic] Allow context when matching for Malayalam new-spec
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 17 Dec 2015 17:31:17 +0000 (17:31 +0000)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 17 Dec 2015 17:31:17 +0000 (17:31 +0000)
Test sequence:
U+0995,U+09CD,U+09B0

With Nirmala shipped on Windows 10, this failed to form the below form.
Works now.

Reported by Sairus.

src/hb-ot-shape-complex-indic.cc

index 5354897..a630419 100644 (file)
@@ -557,8 +557,15 @@ data_create_indic (const hb_ot_shape_plan_t *plan)
   indic_plan->virama_glyph = (hb_codepoint_t) -1;
 
   /* Use zero-context would_substitute() matching for new-spec of the main
-   * Indic scripts, and scripts with one spec only, but not for old-specs. */
-  bool zero_context = !indic_plan->is_old_spec;
+   * Indic scripts, and scripts with one spec only, but not for old-specs.
+   * The new-spec for all dual-spec scripts says zero-context matching happens.
+   *
+   * However, testing with Malayalam shows that old and new spec both allow
+   * context.  Testing with Bengali new-spec however shows that it doesn't.
+   * So, the heuristic here is the way it is.  It should *only* be changed,
+   * as we discover more cases of what Windows does.  DON'T TOUCH OTHERWISE.
+   */
+  bool zero_context = !indic_plan->is_old_spec && plan->props.script != HB_SCRIPT_MALAYALAM;
   indic_plan->rphf.init (&plan->map, HB_TAG('r','p','h','f'), zero_context);
   indic_plan->pref.init (&plan->map, HB_TAG('p','r','e','f'), zero_context);
   indic_plan->blwf.init (&plan->map, HB_TAG('b','l','w','f'), zero_context);