[indic] Followup fix for Malayalam context matching
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 18 Dec 2015 13:47:16 +0000 (13:47 +0000)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 18 Dec 2015 13:47:16 +0000 (13:47 +0000)
We regeressed Malayalam in 508cc3d3cfcfb0383df0fe795cc28db4e0fd5729
This brings down the failures to 198 (from 750).

BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%)
GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%)
GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%)
KANNADA: 951190 out of 951913 tests passed. 723 failed (0.0759523%)
KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%)
MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
MYANMAR: 1123865 out of 1123883 tests passed. 18 failed (0.00160159%)

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

index aaa83c2..880aa91 100644 (file)
@@ -1336,6 +1336,25 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
            break;
          }
       }
+      /* For Malayalam, skip over unformed below- (but NOT post-) forms. */
+      if (buffer->props.script == HB_SCRIPT_MALAYALAM)
+      {
+       for (unsigned int i = base + 1; i < end; i++)
+       {
+         while (i < end && is_joiner (info[i]))
+           i++;
+         if (i == end || !is_halant_or_coeng (info[i]))
+           break;
+         i++; /* Skip halant. */
+         while (i < end && is_joiner (info[i]))
+           i++;
+         if (i < end && is_consonant (info[i]) && info[i].indic_position() == POS_BELOW_C)
+         {
+           base = i;
+           info[base].indic_position() = POS_BASE_C;
+         }
+       }
+      }
 
       if (start < base && info[base].indic_position() > POS_BASE_C)
         base--;