[subset] add num-iterations flag to util/hb-subset.
diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 97a3a2f..4f95578 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc
@@ -98,7 +98,11 @@ { 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 f1406c0..ed23bcd 100644 --- a/util/options-subset.cc +++ b/util/options-subset.cc
@@ -252,6 +252,9 @@ {"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 30b8f5b..69465d0 100644 --- a/util/options.hh +++ b/util/options.hh
@@ -679,6 +679,7 @@ subset_options_t (option_parser_t *parser) { input = hb_subset_input_create_or_fail (); + num_iterations = 1; add_options (parser); } @@ -689,6 +690,7 @@ void add_options (option_parser_t *parser) override; + unsigned num_iterations; hb_subset_input_t *input; };