diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 5e728b05a..b125e1cea 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -281,6 +281,16 @@ hb_buffer_t::add_info (const hb_glyph_info_t &glyph_info) } +void +hb_buffer_t::remove_output () +{ + have_output = false; + have_positions = false; + + out_len = 0; + out_info = info; +} + void hb_buffer_t::clear_output () { diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 67429df23..33d6e6c66 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -209,6 +209,7 @@ struct hb_buffer_t HB_INTERNAL void guess_segment_properties (); HB_INTERNAL void swap_buffers (); + HB_INTERNAL void remove_output (); HB_INTERNAL void clear_output (); HB_INTERNAL void clear_positions (); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 98b4aa641..97d2971be 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1857,9 +1857,8 @@ apply_string (OT::hb_ot_apply_context_t *c, if (likely (!lookup.is_reverse ())) { /* in/out forward substitution/positioning */ - if (!Proxy::inplace) + if (Proxy::table_index == 0u) buffer->clear_output (); - buffer->idx = 0; bool ret; @@ -1875,7 +1874,10 @@ apply_string (OT::hb_ot_apply_context_t *c, else { /* in-place backward substitution/positioning */ + if (Proxy::table_index == 0u) + buffer->remove_output (); buffer->idx = buffer->len - 1; + apply_backward (c, accel); } } @@ -1891,8 +1893,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, OT::hb_ot_apply_context_t c (table_index, font, buffer); c.set_recurse_func (Proxy::Lookup::apply_recurse_func); - for (unsigned int stage_index = 0; stage_index < stages[table_index].length; stage_index++) - { + for (unsigned int stage_index = 0; stage_index < stages[table_index].length; stage_index++) { const stage_map_t *stage = &stages[table_index][stage_index]; for (; i < stage->last_lookup; i++) { @@ -1914,7 +1915,10 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, } if (stage->pause_func) + { + buffer->clear_output (); stage->pause_func (plan, font, buffer); + } } } diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index e27094a1d..4fe148d67 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -551,7 +551,6 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font) info.cluster = buffer->cur().cluster; info.mask = buffer->cur().mask; (void) buffer->output_info (info); - buffer->swap_buffers (); } @@ -1128,6 +1127,8 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) _hb_buffer_allocate_unicode_vars (c->buffer); + c->buffer->clear_output (); + hb_ot_shape_initialize_masks (c); hb_set_unicode_props (c->buffer); hb_insert_dotted_circle (c->buffer, c->font);