From 0bc7a38463bfb37f12efeb1b8cb2024cf4a347bc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 29 Oct 2012 22:02:45 -0700 Subject: [PATCH] [OT] Fix ReverseChainingSubst We should make it clear that we don't want output buffer in this case, otherwise buffer->backtrack_len() would be wrong. --- src/hb-buffer-private.hh | 1 + src/hb-buffer.cc | 13 +++++++++++++ src/hb-ot-layout-gsub-table.hh | 1 + 3 files changed, 15 insertions(+) diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh index 67a2752c0..c1acffd30 100644 --- a/src/hb-buffer-private.hh +++ b/src/hb-buffer-private.hh @@ -153,6 +153,7 @@ struct hb_buffer_t { HB_INTERNAL void guess_properties (void); HB_INTERNAL void swap_buffers (void); + HB_INTERNAL void remove_output (void); HB_INTERNAL void clear_output (void); HB_INTERNAL void clear_positions (void); diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index b65beff96..1eb513c7f 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -182,6 +182,19 @@ hb_buffer_t::add (hb_codepoint_t codepoint, len++; } +void +hb_buffer_t::remove_output (void) +{ + if (unlikely (hb_object_is_inert (this))) + return; + + have_output = false; + have_positions = false; + + out_len = 0; + out_info = info; +} + void hb_buffer_t::clear_output (void) { diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 90faa79c6..05b18cc3e 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1343,6 +1343,7 @@ struct SubstLookup : Lookup else { /* in-place backward substitution */ + c->buffer->remove_output (); c->buffer->idx = c->buffer->len - 1; do {