[ot] Simplify form_clusters()
This commit is contained in:
parent
7b8b63adc5
commit
701112dad9
|
@ -189,7 +189,14 @@ struct hb_buffer_t {
|
|||
unsigned int cluster_end);
|
||||
|
||||
HB_INTERNAL void merge_clusters (unsigned int start,
|
||||
unsigned int end);
|
||||
unsigned int end)
|
||||
{
|
||||
if (end - start < 2)
|
||||
return;
|
||||
merge_clusters_impl (start, end);
|
||||
}
|
||||
HB_INTERNAL void merge_clusters_impl (unsigned int start,
|
||||
unsigned int end);
|
||||
HB_INTERNAL void merge_out_clusters (unsigned int start,
|
||||
unsigned int end);
|
||||
/* Merge clusters for deleting current glyph, and skip it. */
|
||||
|
|
|
@ -504,16 +504,13 @@ hb_buffer_t::reverse_clusters (void)
|
|||
}
|
||||
|
||||
void
|
||||
hb_buffer_t::merge_clusters (unsigned int start,
|
||||
unsigned int end)
|
||||
hb_buffer_t::merge_clusters_impl (unsigned int start,
|
||||
unsigned int end)
|
||||
{
|
||||
#ifdef HB_NO_MERGE_CLUSTERS
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (unlikely (end - start < 2))
|
||||
return;
|
||||
|
||||
unsigned int cluster = info[start].cluster;
|
||||
|
||||
for (unsigned int i = start + 1; i < end; i++)
|
||||
|
|
|
@ -264,11 +264,18 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
|
|||
static void
|
||||
hb_form_clusters (hb_buffer_t *buffer)
|
||||
{
|
||||
unsigned int base = 0;
|
||||
unsigned int count = buffer->len;
|
||||
hb_glyph_info_t *info = buffer->info;
|
||||
for (unsigned int i = 1; i < count; i++)
|
||||
if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])))
|
||||
buffer->merge_clusters (i - 1, i + 1);
|
||||
{
|
||||
if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i]))))
|
||||
{
|
||||
buffer->merge_clusters (base, i);
|
||||
base = i;
|
||||
}
|
||||
}
|
||||
buffer->merge_clusters (base, count);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue