[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.
This commit is contained in:
Behdad Esfahbod 2021-08-12 11:40:56 -06:00
parent 11b0b68853
commit 08d43d1ba1
1 changed files with 9 additions and 10 deletions

View File

@ -125,6 +125,13 @@ struct subset_main_t : option_parser_t, face_options_t, output_options_t<false>
return true; 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 (); void add_options ();
public: public:
@ -148,7 +155,6 @@ struct subset_main_t : option_parser_t, face_options_t, output_options_t<false>
hb_subset_input_t *input = nullptr; hb_subset_input_t *input = nullptr;
/* Internal, ouch. */ /* Internal, ouch. */
bool all_unicodes = false;
GString *glyph_names = nullptr; GString *glyph_names = nullptr;
}; };
@ -238,7 +244,7 @@ parse_text (const char *name G_GNUC_UNUSED,
if (0 == strcmp (arg, "*")) if (0 == strcmp (arg, "*"))
{ {
subset_main->all_unicodes = true; subset_main->add_all_unicodes ();
return true; return true;
} }
@ -263,7 +269,7 @@ parse_unicodes (const char *name G_GNUC_UNUSED,
if (0 == strcmp (arg, "*")) if (0 == strcmp (arg, "*"))
{ {
subset_main->all_unicodes = true; subset_main->add_all_unicodes ();
return true; return true;
} }
@ -730,13 +736,6 @@ subset_main_t::post_parse (GError **error)
{ {
/* This WILL get called multiple times. Oh well... */ /* 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) if (glyph_names)
{ {
char *p = glyph_names->str; char *p = glyph_names->str;