[util] Simplify shape-consumer by removing buffer arg

This commit is contained in:
Behdad Esfahbod 2021-08-05 13:35:46 -06:00
parent e014c6fa2d
commit fc0339eef0
4 changed files with 6 additions and 11 deletions

View File

@ -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,

View File

@ -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 ());

View File

@ -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;

View File

@ -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);
}