consonant_syllable => { found_syllable (consonant_syllable); };
vowel_syllable => { found_syllable (vowel_syllable); };
standalone_cluster => { found_syllable (standalone_cluster); };
- broken_cluster => { found_syllable (broken_cluster); *had_broken_cluster = true; };
+ broken_cluster => { found_syllable (broken_cluster); };
other => { found_syllable (non_indic_cluster); };
*|;
} HB_STMT_END
static void
-find_syllables (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer, bool *had_broken_cluster)
+find_syllables (hb_buffer_t *buffer)
{
unsigned int p, pe, eof, ts, te, act;
int cs;
};
static void
+setup_syllables (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer);
+static void
initial_reordering (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
{
hb_ot_map_builder_t *map = &plan->map;
+ /* Do this before any lookups have been applied. */
+ map->add_gsub_pause (setup_syllables);
+
map->add_bool_feature (HB_TAG('l','o','c','l'));
/* The Indic specs do not require ccmp, but we apply it here since if
* there is a use of it, it's typically at the beginning. */
}
+enum syllable_type_t {
+ consonant_syllable,
+ vowel_syllable,
+ standalone_cluster,
+ broken_cluster,
+ non_indic_cluster,
+};
+
+#include "hb-ot-shape-complex-indic-machine.hh"
+
+
static void
setup_masks_indic (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_buffer_t *buffer,
set_indic_properties (buffer->info[i]);
}
+static void
+setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED,
+ hb_font_t *font HB_UNUSED,
+ hb_buffer_t *buffer)
+{
+ find_syllables (buffer);
+}
+
static int
compare_indic_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
{
}
-enum syllable_type_t {
- consonant_syllable,
- vowel_syllable,
- standalone_cluster,
- broken_cluster,
- non_indic_cluster,
-};
-
-#include "hb-ot-shape-complex-indic-machine.hh"
-
static void
initial_reordering_syllable (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
}
}
-static void
+static inline void
insert_dotted_circles (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
+ /* Note: This loop is extra overhead, but should not be measurable. */
+ bool has_broken_syllables = false;
+ unsigned int count = buffer->len;
+ for (unsigned int i = 0; i < count; i++)
+ if ((buffer->info[i].syllable() & 0x0F) == broken_cluster) {
+ has_broken_syllables = true;
+ break;
+ }
+ if (likely (!has_broken_syllables))
+ return;
+
+
hb_codepoint_t dottedcircle_glyph;
if (!font->get_glyph (0x25CC, 0, &dottedcircle_glyph))
return;
hb_buffer_t *buffer)
{
update_consonant_positions (plan, font, buffer);
-
- bool had_broken_clusters = false;
- find_syllables (plan, buffer, &had_broken_clusters);
- if (unlikely (had_broken_clusters))
- insert_dotted_circles (plan, font, buffer);
+ insert_dotted_circles (plan, font, buffer);
hb_glyph_info_t *info = buffer->info;
unsigned int count = buffer->len;