From f22b7e77783fa2f44365e0fe6413c4474c07048d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 13 Feb 2013 07:32:46 -0500 Subject: [PATCH] [Indic] Track base position when reordering things Ouch, how did things ever work without this?! The added test that has a dot-reph as well as a pre-base reordering Ra perfectly demonstrates the bug (tested with Nirmala font from Win8 for example). Testing suggests that Win8 shaper has the *exact* same bug / behavior that we used to have. Odd. --- src/hb-ot-shape-complex-indic.cc | 6 ++++++ .../shaper-indic/indic/script-malayalam/misc/dot-reph.txt | 1 + 2 files changed, 7 insertions(+) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 5b0d875fa..9304dde2e 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -1237,6 +1237,8 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, hb_glyph_info_t tmp = info[old_pos]; memmove (&info[old_pos], &info[old_pos + 1], (new_pos - old_pos) * sizeof (info[0])); info[new_pos] = tmp; + if (old_pos < base && base <= new_pos) /* Shouldn't actually happen. */ + base--; new_pos--; } buffer->merge_clusters (new_pos, MIN (end, base + 1)); @@ -1389,6 +1391,8 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, hb_glyph_info_t reph = info[start]; memmove (&info[start], &info[start + 1], (new_reph_pos - start) * sizeof (info[0])); info[new_reph_pos] = reph; + if (start < base && base <= new_reph_pos) + base--; } } @@ -1454,6 +1458,8 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, hb_glyph_info_t tmp = info[old_pos]; memmove (&info[new_pos + 1], &info[new_pos], (old_pos - new_pos) * sizeof (info[0])); info[new_pos] = tmp; + if (new_pos <= base && base < old_pos) + base++; } } diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/dot-reph.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/dot-reph.txt index fc17a9b31..01b28dccb 100644 --- a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/dot-reph.txt +++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/dot-reph.txt @@ -1 +1,2 @@ ൎക +ൎക്ക്ര