[OTLayout] Make MultipleSubst in-place for sequences of len=1

This commit is contained in:
Behdad Esfahbod 2013-05-02 14:44:45 -04:00
parent 54f84a6b85
commit 5d59f99920
1 changed files with 11 additions and 4 deletions

View File

@ -275,11 +275,18 @@ struct Sequence
unsigned int klass = c->buffer->cur().glyph_props() & unsigned int klass = c->buffer->cur().glyph_props() &
HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE ? HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0; HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE ? HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0;
unsigned int count = substitute.len; unsigned int count = substitute.len;
if (count == 1) /* Special-case to make it in-place. */
{
c->replace_glyph (substitute.array[0]);
}
else
{
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
set_lig_props_for_component (c->buffer->cur(), i); set_lig_props_for_component (c->buffer->cur(), i);
c->output_glyph (substitute.array[i], klass); c->output_glyph (substitute.array[i], klass);
} }
c->buffer->skip_glyph (); c->buffer->skip_glyph ();
}
return TRACE_RETURN (true); return TRACE_RETURN (true);
} }