[subset] add num-iterations flag to util/hb-subset.
This commit is contained in:
parent
9e5738a86a
commit
1bb00cd54b
@ -98,7 +98,11 @@ struct subset_consumer_t
|
|||||||
{
|
{
|
||||||
hb_face_t *face = hb_font_get_face (font);
|
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);
|
hb_blob_t *result = hb_face_reference_blob (new_face);
|
||||||
|
|
||||||
failed = !hb_blob_get_length (result);
|
failed = !hb_blob_get_length (result);
|
||||||
|
@ -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."},
|
{"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}
|
{nullptr}
|
||||||
};
|
};
|
||||||
|
@ -679,6 +679,7 @@ struct subset_options_t : option_group_t
|
|||||||
subset_options_t (option_parser_t *parser)
|
subset_options_t (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
input = hb_subset_input_create_or_fail ();
|
input = hb_subset_input_create_or_fail ();
|
||||||
|
num_iterations = 1;
|
||||||
add_options (parser);
|
add_options (parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,6 +690,7 @@ struct subset_options_t : option_group_t
|
|||||||
|
|
||||||
void add_options (option_parser_t *parser) override;
|
void add_options (option_parser_t *parser) override;
|
||||||
|
|
||||||
|
unsigned num_iterations;
|
||||||
hb_subset_input_t *input;
|
hb_subset_input_t *input;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user