[Indic] Position pre-base reordering Ra after Chillus in Malayalam

The logic for pre-base reordering follows the left matra logic.
We had an exception for Malayalam/Tamil in the left matra repositioning
which was not reflected in pre-base reordering.

Malayalam failures down from 337 to 323.

BENGALI: 353996 out of 354285 tests passed. 289 failed (0.0815727%)
DEVANAGARI: 707339 out of 707394 tests passed. 55 failed (0.00777502%)
GUJARATI: 366489 out of 366506 tests passed. 17 failed (0.0046384%)
GURMUKHI: 60769 out of 60809 tests passed. 40 failed (0.0657797%)
KANNADA: 951086 out of 951913 tests passed. 827 failed (0.0868777%)
KHMER: 299106 out of 299124 tests passed. 18 failed (0.00601757%)
LAO: 53611 out of 53644 tests passed. 33 failed (0.0615167%)
MALAYALAM: 1048011 out of 1048334 tests passed. 323 failed (0.0308108%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271726 out of 271847 tests passed. 121 failed (0.0445103%)
TAMIL: 1091837 out of 1091837 tests passed. 0 failed (0%)
TELUGU: 970558 out of 970573 tests passed. 15 failed (0.00154548%)
TIBETAN: 208469 out of 208469 tests passed. 0 failed (0%)
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 6a87c1e..30a9a1f 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -1157,21 +1157,28 @@
 	   */
 
 	  unsigned int new_pos = base;
-	  while (new_pos > start &&
-		 !(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_FLAGS)))
-	    new_pos--;
-
-	  /* In Khmer coeng model, a V,Ra can go *after* matras.  If it goes after a
-	   * split matra, it should be reordered to *before* the left part of such matra. */
-	  if (new_pos > start && info[new_pos - 1].indic_category() == OT_M)
+	  /* Malayalam / Tamil do not have "half" forms or explicit virama forms.
+	   * The glyphs formed by 'half' are Chillus or ligated explicit viramas.
+	   * We want to position matra after them.
+	   */
+	  if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL)
 	  {
-	    unsigned int old_pos = i;
-	    for (unsigned int i = base + 1; i < old_pos; i++)
-	      if (info[i].indic_category() == OT_M)
-	      {
-		new_pos--;
-		break;
-	      }
+	    while (new_pos > start &&
+		   !(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_FLAGS)))
+	      new_pos--;
+
+	    /* In Khmer coeng model, a V,Ra can go *after* matras.  If it goes after a
+	     * split matra, it should be reordered to *before* the left part of such matra. */
+	    if (new_pos > start && info[new_pos - 1].indic_category() == OT_M)
+	    {
+	      unsigned int old_pos = i;
+	      for (unsigned int i = base + 1; i < old_pos; i++)
+		if (info[i].indic_category() == OT_M)
+		{
+		  new_pos--;
+		  break;
+		}
+	    }
 	  }
 
 	  if (new_pos > start && is_halant_or_coeng (info[new_pos - 1]))