[hb-info] Add --show-upem --show-all --all

This commit is contained in:
Behdad Esfahbod 2023-01-19 14:19:05 -07:00
parent aee7454d05
commit 38c71cebd0
1 changed files with 37 additions and 1 deletions

View File

@ -38,7 +38,12 @@ struct info_t
{ {
GOptionEntry entries[] = GOptionEntry entries[] =
{ {
{"list-all", 0, 0, G_OPTION_ARG_NONE, &this->list_all, "List everything", nullptr}, {"all", 0, 0, G_OPTION_ARG_NONE, &this->show_all, "Show everything", nullptr},
{"show-all", 0, 0, G_OPTION_ARG_NONE, &this->show_all, "Show all short information", nullptr},
{"show-upem", 0, 0, G_OPTION_ARG_NONE, &this->show_upem, "List everything", nullptr},
{"list-all", 0, 0, G_OPTION_ARG_NONE, &this->list_all, "List all long list", nullptr},
{"list-tables", 0, 0, G_OPTION_ARG_NONE, &this->list_tables, "List tables", nullptr}, {"list-tables", 0, 0, G_OPTION_ARG_NONE, &this->list_tables, "List tables", nullptr},
{"list-unicodes", 0, 0, G_OPTION_ARG_NONE, &this->list_unicodes, "List characters", nullptr}, {"list-unicodes", 0, 0, G_OPTION_ARG_NONE, &this->list_unicodes, "List characters", nullptr},
{"list-glyphs", 0, 0, G_OPTION_ARG_NONE, &this->list_glyphs, "List glyphs", nullptr}, {"list-glyphs", 0, 0, G_OPTION_ARG_NONE, &this->list_glyphs, "List glyphs", nullptr},
@ -64,6 +69,11 @@ struct info_t
hb_bool_t verbose = true; hb_bool_t verbose = true;
hb_bool_t first_item = true; hb_bool_t first_item = true;
hb_bool_t all = false;
hb_bool_t show_all = false;
hb_bool_t show_upem = false;
hb_bool_t list_all = false; hb_bool_t list_all = false;
hb_bool_t list_tables = false; hb_bool_t list_tables = false;
hb_bool_t list_unicodes = false; hb_bool_t list_unicodes = false;
@ -83,6 +93,19 @@ struct info_t
font = hb_font_reference (((font_options_t *) app)->font); font = hb_font_reference (((font_options_t *) app)->font);
verbose = !app->quiet; verbose = !app->quiet;
if (all)
{
show_all =
list_all =
true;
}
if (show_all)
{
show_upem =
true;
}
if (list_all) if (list_all)
{ {
list_tables = list_tables =
@ -96,6 +119,8 @@ struct info_t
true; true;
} }
if (show_upem) _show_upem ();
if (list_tables) _list_tables (); if (list_tables) _list_tables ();
if (list_unicodes) _list_unicodes (); if (list_unicodes) _list_unicodes ();
if (list_glyphs) _list_glyphs (); if (list_glyphs) _list_glyphs ();
@ -121,6 +146,17 @@ struct info_t
printf ("\n---\n\n"); printf ("\n---\n\n");
} }
void _show_upem ()
{
if (verbose)
{
separator ();
printf ("Font Units-Per-EM: ");
}
printf ("%u\n", hb_face_get_upem (face));
}
void _list_tables () void _list_tables ()
{ {
if (verbose) if (verbose)