[hb-info] Add --get-style

This commit is contained in:
Behdad Esfahbod 2023-01-22 14:56:25 -07:00
parent 5b291d49e8
commit 090a6d0dde
1 changed files with 17 additions and 0 deletions

View File

@ -97,6 +97,7 @@ struct info_t
{"show-extents", 0, 0, G_OPTION_ARG_NONE, &this->show_extents, "Show extents", 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-name", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_name, "Get name", "name id; eg. '13'"},
{"get-style", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_style, "Get style", "style tag; eg. 'wght'"},
{"get-metric", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_metric, "Get metric", "metric tag; eg. 'hasc'"}, {"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'"}, {"get-baseline", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_baseline, "Get baseline", "baseline tag; eg. 'hang'"},
{"get-table", 0, 0, G_OPTION_ARG_STRING, &this->get_table, "Get font table", "table tag; eg. 'cmap'"}, {"get-table", 0, 0, G_OPTION_ARG_STRING, &this->get_table, "Get font table", "table tag; eg. 'cmap'"},
@ -160,6 +161,7 @@ struct info_t
hb_bool_t show_extents = false; hb_bool_t show_extents = false;
char **get_name = nullptr; char **get_name = nullptr;
char **get_style = nullptr;
char **get_metric = nullptr; char **get_metric = nullptr;
char **get_baseline = nullptr; char **get_baseline = nullptr;
char *get_table = nullptr; char *get_table = nullptr;
@ -258,6 +260,7 @@ struct info_t
if (show_extents) _show_extents (); if (show_extents) _show_extents ();
if (get_name) _get_name (); if (get_name) _get_name ();
if (get_style) _get_style ();
if (get_metric) _get_metric (); if (get_metric) _get_metric ();
if (get_baseline) _get_baseline (); if (get_baseline) _get_baseline ();
if (get_table) _get_table (); if (get_table) _get_table ();
@ -440,6 +443,20 @@ struct info_t
} }
} }
void _get_style ()
{
for (char **p = get_style; *p; p++)
{
hb_style_tag_t tag = (hb_style_tag_t) hb_tag_from_string (*p, -1);
if (verbose)
printf ("Style %c%c%c%c: ", HB_UNTAG (tag));
float v = hb_style_get_value (font, tag);
printf ("%g\n", (double) v);
}
}
void _get_metric () void _get_metric ()
{ {
bool fallback = false; bool fallback = false;