[Indic] Handle Reph when determining base consonant
authorBehdad Esfahbod <behdad@behdad.org>
Sun, 31 Jul 2011 19:07:11 +0000 (15:07 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 31 Jul 2011 19:08:40 +0000 (15:08 -0400)
src/hb-ot-shape-complex-indic.cc

index 82c247a..cfc1c4b 100644 (file)
@@ -443,6 +443,7 @@ found_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t
 
   /* -> starting from the end of the syllable, move backwards */
   i = end;
+  unsigned int limit = start + (info[start].indic_category() == OT_Ra ? 2 : 0);
   do {
     i--;
     /* -> until a consonant is found */
@@ -457,20 +458,25 @@ found_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t
        break;
       }
 
-      /* TODO: or that is not a pre-base reordering Ra, */
-
-      /* -> or arrive at the first consonant. The consonant stopped at will be the base. */
+      /* -> or that is not a pre-base reordering Ra,
+       *
+       *   o If the syllable starts with Ra + Halant (in a script that has Reph)
+       *     and has more than one consonant, Ra is excluded from candidates for
+       *     base consonants.
+       *
+       * IMPLEMENTATION NOTES:
+       *
+       * We do this by adjusting limit accordingly before entering the loop.
+       */
+
+      /* -> or arrive at the first consonant. The consonant stopped at will
+       * be the base. */
       base = i;
     }
-  } while (i > start);
+  } while (i > limit);
   if (base < start)
     base = start; /* Just in case... */
 
-  /* TODO
-   * If the syllable starts with Ra + Halant (in a script that has Reph)
-   * and has more than one consonant, Ra is excluded from candidates for
-   * base consonants. */
-
 
   /* 2. Decompose and reorder Matras:
    *