{
/* If it ligated, all bets are off. */
if (_hb_glyph_info_ligated (&info)) return false;
- return !!(FLAG_SAFE (info.myanmar_category()) & flags);
+ return !!(FLAG (info.myanmar_category()) & flags);
}
static inline bool
cat = (indic_category_t) OT_A;
break;
- case 0x1039u:
- cat = (indic_category_t) OT_H;
- break;
-
case 0x103Au:
cat = (indic_category_t) OT_As;
break;
* http://www.microsoft.com/typography/OpenTypeDev/myanmar/intro.htm */
static void
-initial_reordering_consonant_syllable (hb_buffer_t *buffer,
+initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
+ hb_face_t *face,
+ hb_buffer_t *buffer,
unsigned int start, unsigned int end)
{
hb_glyph_info_t *info = buffer->info;
}
}
+ buffer->merge_clusters (start, end);
/* Sit tight, rock 'n roll! */
- buffer->sort (start, end, compare_myanmar_order);
+ hb_bubble_sort (info + start, end - start, compare_myanmar_order);
+}
+
+static void
+initial_reordering_broken_cluster (const hb_ot_shape_plan_t *plan,
+ hb_face_t *face,
+ hb_buffer_t *buffer,
+ unsigned int start, unsigned int end)
+{
+ /* We already inserted dotted-circles, so just call the consonant_syllable. */
+ initial_reordering_consonant_syllable (plan, face, buffer, start, end);
+}
+
+static void
+initial_reordering_punctuation_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED,
+ hb_face_t *face HB_UNUSED,
+ hb_buffer_t *buffer HB_UNUSED,
+ unsigned int start HB_UNUSED, unsigned int end HB_UNUSED)
+{
+ /* Nothing to do right now. If we ever switch to using the output
+ * buffer in the reordering process, we'd need to next_glyph() here. */
+}
+
+static void
+initial_reordering_non_myanmar_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED,
+ hb_face_t *face HB_UNUSED,
+ hb_buffer_t *buffer HB_UNUSED,
+ unsigned int start HB_UNUSED, unsigned int end HB_UNUSED)
+{
+ /* Nothing to do right now. If we ever switch to using the output
+ * buffer in the reordering process, we'd need to next_glyph() here. */
}
+
static void
initial_reordering_syllable (const hb_ot_shape_plan_t *plan,
hb_face_t *face,
{
syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F);
switch (syllable_type) {
-
- case broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */
- case consonant_syllable:
- initial_reordering_consonant_syllable (buffer, start, end);
- break;
-
- case punctuation_cluster:
- case non_myanmar_cluster:
- break;
+ case consonant_syllable: initial_reordering_consonant_syllable (plan, face, buffer, start, end); return;
+ case punctuation_cluster: initial_reordering_punctuation_cluster (plan, face, buffer, start, end); return;
+ case broken_cluster: initial_reordering_broken_cluster (plan, face, buffer, start, end); return;
+ case non_myanmar_cluster: initial_reordering_non_myanmar_cluster (plan, face, buffer, start, end); return;
}
}
hb_codepoint_t dottedcircle_glyph;
- if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph))
+ if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
return;
hb_glyph_info_t dottedcircle = {0};
buffer->idx = 0;
unsigned int last_syllable = 0;
- while (buffer->idx < buffer->len && !buffer->in_error)
+ while (buffer->idx < buffer->len)
{
unsigned int syllable = buffer->cur().syllable();
syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F);
{
last_syllable = syllable;
- hb_glyph_info_t ginfo = dottedcircle;
- ginfo.cluster = buffer->cur().cluster;
- ginfo.mask = buffer->cur().mask;
- ginfo.syllable() = buffer->cur().syllable();
+ hb_glyph_info_t info = dottedcircle;
+ info.cluster = buffer->cur().cluster;
+ info.mask = buffer->cur().mask;
+ info.syllable() = buffer->cur().syllable();
- buffer->output_info (ginfo);
+ buffer->output_info (info);
}
else
buffer->next_glyph ();
{
insert_dotted_circles (plan, font, buffer);
- foreach_syllable (buffer, start, end)
- initial_reordering_syllable (plan, font->face, buffer, start, end);
+ hb_glyph_info_t *info = buffer->info;
+ unsigned int count = buffer->len;
+ if (unlikely (!count)) return;
+ unsigned int last = 0;
+ unsigned int last_syllable = info[0].syllable();
+ for (unsigned int i = 1; i < count; i++)
+ if (last_syllable != info[i].syllable()) {
+ initial_reordering_syllable (plan, font->face, buffer, last, i);
+ last = i;
+ last_syllable = info[last].syllable();
+ }
+ initial_reordering_syllable (plan, font->face, buffer, last, count);
}
static void
NULL, /* data_create */
NULL, /* data_destroy */
NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
NULL, /* decompose */
NULL, /* compose */
NULL, /* data_create */
NULL, /* data_destroy */
NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
NULL, /* decompose */
NULL, /* compose */