From a224b4d502d026fa642ee4098bf7bc0b4ba7ce27 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 2 Jun 2010 22:24:54 -0400 Subject: [PATCH] Fix skipping variation-selectors --- src/hb-ot-shape.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 705d1f530..77724ce43 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -474,16 +474,18 @@ hb_map_glyphs (hb_font_t *font, if (unlikely (!buffer->len)) return; + buffer->clear_output (); unsigned int count = buffer->len - 1; - for (unsigned int i = 0; i < count; i++) { - if (unlikely (is_variation_selector (buffer->info[i + 1].codepoint))) { - buffer->info[i].codepoint = hb_font_get_glyph (font, face, buffer->info[i].codepoint, buffer->info[i + 1].codepoint); - i++; + for (buffer->i = 0; buffer->i < count;) { + if (unlikely (is_variation_selector (buffer->info[buffer->i + 1].codepoint))) { + buffer->add_output_glyph (hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, buffer->info[buffer->i + 1].codepoint)); + buffer->i++; } else { - buffer->info[i].codepoint = hb_font_get_glyph (font, face, buffer->info[i].codepoint, 0); + buffer->add_output_glyph (hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0)); } } - buffer->info[count].codepoint = hb_font_get_glyph (font, face, buffer->info[count].codepoint, 0); + buffer->add_output_glyph (hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0)); + buffer->swap (); } static void