[vowel-constraints] Simplify generated code

Fixes https://github.com/harfbuzz/harfbuzz/issues/2385
This commit is contained in:
Behdad Esfahbod 2020-04-29 11:15:25 -07:00 committed by David Corbett
parent 665483c979
commit 28633b1979
2 changed files with 4 additions and 6 deletions

View File

@ -103,9 +103,9 @@ class ConstraintSet (object):
s.append ('{}0x{:04X}u == buffer->cur ({}).codepoint{}\n'.format (
self._indent (depth + 2), cp, index + i, ')' if i == len (self._c) - 1 else ' &&'))
s.append ('{}{{\n'.format (indent))
for i in range (index + 1):
for i in range (index):
s.append ('{}buffer->next_glyph ();\n'.format (self._indent (depth + 1)))
s.append ('{}_output_dotted_circle (buffer);\n'.format (self._indent (depth + 1)))
s.append ('{}matched = true;\n'.format (self._indent (depth + 1)))
s.append ('{}}}\n'.format (indent))
else:
s.append ('{}switch (buffer->cur ({}).codepoint)\n'.format(indent, index or ''))

View File

@ -98,8 +98,7 @@ _hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan HB_UNUSED,
0x0907u == buffer->cur (2).codepoint)
{
buffer->next_glyph ();
buffer->next_glyph ();
_output_dotted_circle (buffer);
matched = true;
}
break;
}
@ -219,8 +218,7 @@ _hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan HB_UNUSED,
if (0x0B85u == buffer->cur ().codepoint &&
0x0BC2u == buffer->cur (1).codepoint)
{
buffer->next_glyph ();
_output_dotted_circle (buffer);
matched = true;
}
buffer->next_glyph ();
if (matched) _output_with_dotted_circle (buffer);