diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 62f117273..638aa3db7 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -1365,10 +1365,34 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, * cluster. */ + bool try_pref = !!indic_plan->mask_array[PREF]; + /* Find base again */ unsigned int base; for (base = start; base < end; base++) - if (info[base].indic_position() >= POS_BASE_C) { + if (info[base].indic_position() >= POS_BASE_C) + { + if (try_pref && base + 1 < end && indic_plan->config->pref_len == 2) + { + for (unsigned int i = base + 1; i < end; i++) + if ((info[i].mask & indic_plan->mask_array[PREF]) != 0) + { + if (!(_hb_glyph_info_substituted (&info[i]) && + _hb_glyph_info_ligated_and_didnt_multiply (&info[i]))) + { + /* Ok, this was a 'pref' candidate but didn't form any. + * Base is around here... */ + base = i; + while (base < end && is_halant_or_coeng (info[base])) + base++; + info[base].indic_position() = POS_BASE_C; + + try_pref = false; + } + break; + } + } + if (start < base && info[base].indic_position() > POS_BASE_C) base--; break; @@ -1603,7 +1627,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, * the following rules: */ - if (indic_plan->mask_array[PREF] && base + 1 < end) /* Otherwise there can't be any pre-base reordering Ra. */ + if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base reordering Ra. */ { unsigned int pref_len = indic_plan->config->pref_len; for (unsigned int i = base + 1; i < end; i++) diff --git a/test/shaping/fonts/sha1sum/MANIFEST b/test/shaping/fonts/sha1sum/MANIFEST new file mode 100644 index 000000000..c05a9ef18 --- /dev/null +++ b/test/shaping/fonts/sha1sum/MANIFEST @@ -0,0 +1,5 @@ +226bc2deab3846f1a682085f70c67d0421014144.ttf +4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf +d629e7fedc0b350222d7987345fe61613fa3929a.ttf +e207635780b42f898d58654b65098763e340f5c7.ttf +f499fbc23865022234775c43503bba2e63978fe1.ttf diff --git a/test/shaping/fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf b/test/shaping/fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf new file mode 100644 index 000000000..d91df5726 Binary files /dev/null and b/test/shaping/fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf differ diff --git a/test/shaping/tests/indic-pref-blocking.tests b/test/shaping/tests/indic-pref-blocking.tests index 23ef5bc0e..260980a15 100644 --- a/test/shaping/tests/indic-pref-blocking.tests +++ b/test/shaping/tests/indic-pref-blocking.tests @@ -1 +1,2 @@ -fonts/sha1sum/62927e416ab1fba8cc6222d97b2b0ba0e0eb00ea.ttf:U+0D2F,U+0D4D,U+0D30,U+0D46:[evowelsignmlym=0+1465|rapostmlym=0+499|yamlym=0+2120] +fonts/sha1sum/226bc2deab3846f1a682085f70c67d0421014144.ttf:U+0D2F,U+0D4D,U+0D30,U+0D46:[evowelsignmlym=0+1465|rapostmlym=0+499|yamlym=0+2120] +fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf:U+0D2F,U+0D4D,U+0D30,U+0D46:[yamlym=0+2120|viramamlym=0+0|evowelsignmlym=0+1465|ramlym=0+1507]