diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 97a3a2f32..4f9557869 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -98,7 +98,11 @@ struct subset_consumer_t { hb_face_t *face = hb_font_get_face (font); - hb_face_t *new_face = hb_subset (face, input); + hb_face_t *new_face = nullptr; + for (unsigned i = 0; i < subset_options.num_iterations; i++) { + hb_face_destroy (new_face); + new_face = hb_subset (face, input); + } hb_blob_t *result = hb_face_reference_blob (new_face); failed = !hb_blob_get_length (result); diff --git a/util/options-subset.cc b/util/options-subset.cc index f1406c025..ed23bcd64 100644 --- a/util/options-subset.cc +++ b/util/options-subset.cc @@ -252,6 +252,9 @@ subset_options_t::add_options (option_parser_t *parser) {"drop-tables", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_drop_tables, "Drop the specified tables.", "list of string table tags."}, {"drop-tables+", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_drop_tables, "Drop the specified tables.", "list of string table tags."}, {"drop-tables-", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_drop_tables, "Drop the specified tables.", "list of string table tags."}, + {"num-iterations", 'n', 0, G_OPTION_ARG_INT, + &this->num_iterations, + "Run subsetter N times (default: 1)", "N"}, {nullptr} }; diff --git a/util/options.hh b/util/options.hh index 30b8f5b00..69465d0ce 100644 --- a/util/options.hh +++ b/util/options.hh @@ -679,6 +679,7 @@ struct subset_options_t : option_group_t subset_options_t (option_parser_t *parser) { input = hb_subset_input_create_or_fail (); + num_iterations = 1; add_options (parser); } @@ -689,6 +690,7 @@ struct subset_options_t : option_group_t void add_options (option_parser_t *parser) override; + unsigned num_iterations; hb_subset_input_t *input; };