Rewrite main normalizer loop to isolate runs of simple clusters
This commit is contained in:
parent
b5371f18ef
commit
24382debe8
|
@ -321,18 +321,32 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
|
|||
|
||||
buffer->clear_output ();
|
||||
count = buffer->len;
|
||||
for (buffer->idx = 0; buffer->idx < count && buffer->successful;)
|
||||
buffer->idx = 0;
|
||||
do
|
||||
{
|
||||
unsigned int end;
|
||||
for (end = buffer->idx + 1; end < count; end++)
|
||||
if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[end]))))
|
||||
if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[end]))))
|
||||
break;
|
||||
|
||||
if (likely (c.buffer->idx + 1 == end))
|
||||
if (end < count)
|
||||
end--; /* Leave one base for the marks to cluster with. */
|
||||
|
||||
/* From i to end are simple clusters. */
|
||||
while (buffer->idx < end && buffer->successful)
|
||||
decompose_current_character (&c, might_short_circuit);
|
||||
else
|
||||
decompose_multi_char_cluster (&c, end, always_short_circuit);
|
||||
|
||||
if (buffer->idx == count || !buffer->successful)
|
||||
break;
|
||||
|
||||
/* Find all the marks now. */
|
||||
for (end = buffer->idx + 1; end < count; end++)
|
||||
if (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[end])))
|
||||
break;
|
||||
|
||||
decompose_multi_char_cluster (&c, end, always_short_circuit);
|
||||
}
|
||||
while (buffer->idx < count && buffer->successful);
|
||||
buffer->swap_buffers ();
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue