[Indic] In old-spec shaping, don't move viramas around if seq ends with one
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 9 Jan 2013 00:09:46 +0000 (18:09 -0600)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 9 Jan 2013 00:09:46 +0000 (18:09 -0600)
For example: u0c9a u0ccd u0c9a u0ccd with Lohit.  See:

https://bugs.freedesktop.org/show_bug.cgi?id=59118

src/hb-ot-shape-complex-indic.cc
test/shaping/texts/in-tree/shaper-indic/indic/script-kannada/misc/misc.txt

index 1bc8a77..5afede0 100644 (file)
@@ -644,15 +644,16 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
     info[start].indic_position() = POS_RA_TO_BECOME_REPH;
 
   /* For old-style Indic script tags, move the first post-base Halant after
-   * last consonant. */
+   * last consonant.  Only do this if there is *not* a Halant after last
+   * consonant.  Otherwise it becomes messy. */
   if (indic_plan->is_old_spec) {
     for (unsigned int i = base + 1; i < end; i++)
       if (info[i].indic_category() == OT_H) {
         unsigned int j;
         for (j = end - 1; j > i; j--)
-         if (is_consonant (info[j]))
+         if (is_consonant (info[j]) || info[j].indic_category() == OT_H)
            break;
-       if (j > i) {
+       if (info[j].indic_category() != OT_H && j > i) {
          /* Move Halant to after last consonant. */
          hb_glyph_info_t t = info[i];
          memmove (&info[i], &info[i + 1], (j - i) * sizeof (info[0]));