[hb-info] Add --get-name

This commit is contained in:
Behdad Esfahbod 2023-01-22 09:27:05 -07:00
parent 7a47a369d3
commit 9b499a48bb
1 changed files with 12 additions and 0 deletions

View File

@ -71,6 +71,7 @@ struct info_t
{"show-upem", 0, 0, G_OPTION_ARG_NONE, &this->show_upem, "Show Units-Per-EM", nullptr},
{"show-extents", 0, 0, G_OPTION_ARG_NONE, &this->show_extents, "Show extents", nullptr},
{"get-name", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_name, "Get name", "name id; eg. '13'"},
{"get-metric", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_metric, "Get metric", "metric tag; eg. 'hasc'"},
{"get-baseline", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_baseline, "Get baseline", "baseline tag; eg. 'hang'"},
@ -131,6 +132,7 @@ struct info_t
hb_bool_t show_upem = false;
hb_bool_t show_extents = false;
char **get_name = nullptr;
char **get_metric = nullptr;
char **get_baseline = nullptr;
@ -218,6 +220,7 @@ struct info_t
if (show_upem) _show_upem ();
if (show_extents) _show_extents ();
if (get_name) _get_name ();
if (get_metric) _get_metric ();
if (get_baseline) _get_baseline ();
@ -389,6 +392,15 @@ struct info_t
printf ("%d\n", extents.line_gap);
}
void _get_name ()
{
for (char **p = get_name; *p; p++)
{
hb_ot_name_id_t name_id = (hb_ot_name_id_t) atoi (*p);
_show_name (*p, name_id);
}
}
void _get_metric ()
{
bool fallback = false;