From 08d43d1ba188ffb99eeeb50f6bc20b2f10701318 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 12 Aug 2021 11:40:56 -0600 Subject: [PATCH] [util/hb-subset] Move add_all_unicodes inline, instead of post_parse Now that we have the font loaded, we can do it as it happens. --- util/hb-subset.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 41a61ded6..5fe322237 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -125,6 +125,13 @@ struct subset_main_t : option_parser_t, face_options_t, output_options_t return true; } + void + add_all_unicodes () + { + hb_set_t *codepoints = hb_subset_input_unicode_set (input); + hb_face_collect_unicodes (face, codepoints); + } + void add_options (); public: @@ -148,7 +155,6 @@ struct subset_main_t : option_parser_t, face_options_t, output_options_t hb_subset_input_t *input = nullptr; /* Internal, ouch. */ - bool all_unicodes = false; GString *glyph_names = nullptr; }; @@ -238,7 +244,7 @@ parse_text (const char *name G_GNUC_UNUSED, if (0 == strcmp (arg, "*")) { - subset_main->all_unicodes = true; + subset_main->add_all_unicodes (); return true; } @@ -263,7 +269,7 @@ parse_unicodes (const char *name G_GNUC_UNUSED, if (0 == strcmp (arg, "*")) { - subset_main->all_unicodes = true; + subset_main->add_all_unicodes (); return true; } @@ -730,13 +736,6 @@ subset_main_t::post_parse (GError **error) { /* This WILL get called multiple times. Oh well... */ - if (all_unicodes) - { - hb_set_t *codepoints = hb_subset_input_unicode_set (input); - hb_face_collect_unicodes (face, codepoints); - all_unicodes = false; - } - if (glyph_names) { char *p = glyph_names->str;