[indic] Add syllable recognition state machine
Using an incredible tool called Ragel.
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index c79d0fc..c52c5f7 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -30,16 +30,18 @@
/* buffer var allocations */
-#define indic_categories() var2.u32 /* indic shaping action */
+#define indic_category() var2.u8[0] /* indic_category_t */
+#define indic_position() var2.u8[1] /* indic_matra_category_t */
#define INDIC_TABLE_ELEMENT_TYPE uint8_t
/* Cateories used in the OpenType spec:
* https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx
*/
-enum {
+enum indic_category_t {
OT_X = 0,
OT_C,
+ OT_Ra,
OT_V,
OT_N,
OT_H,
@@ -147,9 +149,8 @@
};
-
void
-_hb_ot_shape_complex_collect_features_indic (hb_ot_shape_planner_t *planner, const hb_segment_properties_t *props HB_UNUSED)
+_hb_ot_shape_complex_collect_features_indic (hb_ot_shape_planner_t *planner, const hb_segment_properties_t *props HB_UNUSED)
{
for (unsigned int i = 0; i < ARRAY_LENGTH (indic_basic_features); i++)
planner->map.add_bool_feature (indic_basic_features[i], false);
@@ -158,6 +159,11 @@
planner->map.add_bool_feature (indic_other_features[i], true);
}
+
+
+#include "hb-ot-shape-complex-indic-machine.hh"
+
+
void
_hb_ot_shape_complex_setup_masks_indic (hb_ot_shape_context_t *c)
{
@@ -165,11 +171,14 @@
for (unsigned int i = 0; i < count; i++)
{
- unsigned int this_type = get_indic_categories (c->buffer->info[i].codepoint);
+ unsigned int type = get_indic_categories (c->buffer->info[i].codepoint);
- c->buffer->info[i].indic_categories() = this_type;
+ c->buffer->info[i].indic_category() = type & 0x0F;
+ c->buffer->info[i].indic_position() = type >> 4;
}
+ find_syllables (c);
+
hb_mask_t mask_array[ARRAY_LENGTH (indic_basic_features)] = {0};
unsigned int num_masks = ARRAY_LENGTH (indic_basic_features);
for (unsigned int i = 0; i < num_masks; i++)