From 0722b627f4461ec618544f4fb22739a790dd6d62 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 24 Jul 2022 17:35:44 -0600 Subject: [PATCH] [buffer] Return delta from sync_so_far --- src/hb-buffer.cc | 5 ++++- src/hb-buffer.hh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 83cd3dca8..d2211d7bf 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -416,12 +416,13 @@ reset: return ret; } -void +int hb_buffer_t::sync_so_far () { bool had_output = have_output; unsigned out_i = out_len; unsigned i = idx; + unsigned old_idx = idx; if (sync ()) idx = out_i; @@ -435,6 +436,8 @@ hb_buffer_t::sync_so_far () } assert (idx <= len); + + return idx - old_idx; } bool diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 1b89a32db..a05f1662e 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -289,7 +289,7 @@ struct hb_buffer_t HB_INTERNAL void guess_segment_properties (); HB_INTERNAL bool sync (); - HB_INTERNAL void sync_so_far (); + HB_INTERNAL int sync_so_far (); HB_INTERNAL void clear_output (); HB_INTERNAL void clear_positions ();