[Indic] Reorder matras
Number of failing shape-complex tests goes from 125 down to 94.
Next: Add Ra handling and it's fair to say we kinda support Indic :).
diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 8ed7a67..e2fd91c 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -147,6 +147,15 @@
decompose_current_glyph (c, FALSE);
}
+static int
+compare_combining_class (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
+{
+ unsigned int a = pa->combining_class();
+ unsigned int b = pb->combining_class();
+
+ return a < b ? -1 : a == b ? 0 : +1;
+}
+
void
_hb_ot_shape_normalize (hb_ot_shape_context_t *c)
{
@@ -216,22 +225,7 @@
continue;
}
- unsigned int k = end - i - 1;
- do {
- hb_glyph_info_t *pinfo = buffer->info + i;
- unsigned int new_k = 0;
-
- for (unsigned int j = 0; j < k; j++)
- if (pinfo[j].combining_class() > pinfo[j+1].combining_class()) {
- hb_glyph_info_t t;
- t = pinfo[j];
- pinfo[j] = pinfo[j + 1];
- pinfo[j + 1] = t;
-
- new_k = j;
- }
- k = new_k;
- } while (k);
+ hb_bubble_sort (buffer->info + i, end - i, compare_combining_class);
i = end;
}