From fc0339eef0fa302f74ca9a3b90430288dac29df3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 5 Aug 2021 13:35:46 -0600 Subject: [PATCH] [util] Simplify shape-consumer by removing buffer arg --- util/hb-ot-shape-closure.cc | 5 ++--- util/hb-subset.cc | 3 +-- util/main-font-text.hh | 4 +--- util/shape-consumer.hh | 5 ++--- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/util/hb-ot-shape-closure.cc b/util/hb-ot-shape-closure.cc index 14c4663ac..9886bdad5 100644 --- a/util/hb-ot-shape-closure.cc +++ b/util/hb-ot-shape-closure.cc @@ -48,13 +48,12 @@ struct shape_closure_consumer_t this); } - void init (hb_buffer_t *buffer_, - const font_options_t *font_opts) + void init (const font_options_t *font_opts) { glyphs = hb_set_create (); font = hb_font_reference (font_opts->get_font ()); failed = false; - buffer = hb_buffer_reference (buffer_); + buffer = hb_buffer_create (); } void consume_line (const char *text, unsigned int text_len, diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 1420785ac..b88f5c415 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -42,8 +42,7 @@ struct subset_consumer_t subset_options.add_options (parser); } - void init (hb_buffer_t *buffer_, - const font_options_t *font_opts) + void init (const font_options_t *font_opts) { face = hb_face_reference (hb_font_get_face (font_opts->get_font ())); input = hb_subset_input_reference (subset_options.get_input ()); diff --git a/util/main-font-text.hh b/util/main-font-text.hh index bbd6c28db..8e012d288 100644 --- a/util/main-font-text.hh +++ b/util/main-font-text.hh @@ -78,9 +78,7 @@ struct main_font_text_t if (!input.text && !input.text_file) input.text_file = g_strdup ("-"); - hb_buffer_t *buffer = hb_buffer_create (); - consumer.init (buffer, &font_opts); - hb_buffer_destroy (buffer); + consumer.init (&font_opts); unsigned int text_len; const char *text; diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh index 1d1dbdfde..6a0d767c0 100644 --- a/util/shape-consumer.hh +++ b/util/shape-consumer.hh @@ -40,12 +40,11 @@ struct shape_consumer_t output.add_options (parser); } - void init (hb_buffer_t *buffer_, - const font_options_t *font_opts) + void init (const font_options_t *font_opts) { font = hb_font_reference (font_opts->get_font ()); failed = false; - buffer = hb_buffer_reference (buffer_); + buffer = hb_buffer_create (); output.init (buffer, font_opts); }