[hb-info] Add --get-meta

This commit is contained in:
Behdad Esfahbod 2023-01-25 12:51:53 -07:00
parent 42ed6abb6a
commit 4e2267b729
1 changed files with 22 additions and 0 deletions

View File

@ -107,6 +107,7 @@ struct info_t :
{"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-baseline", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_baseline, "Get baseline", "baseline tag; eg. 'hang'"},
{"get-meta", 0, 0, G_OPTION_ARG_STRING_ARRAY,&this->get_meta, "Get meta information", "tag tag; eg. 'dlng'"},
{"get-table", 0, 0, G_OPTION_ARG_STRING, &this->get_table, "Get font table", "table tag; eg. 'cmap'"},
{"list-all", 0, 0, G_OPTION_ARG_NONE, &this->list_all, "List all long information", nullptr},
@ -202,6 +203,7 @@ struct info_t :
char **get_style = nullptr;
char **get_metric = nullptr;
char **get_baseline = nullptr;
char **get_meta = nullptr;
char *get_table = nullptr;
hb_bool_t list_all = false;
@ -309,6 +311,7 @@ struct info_t :
if (get_style) _get_style ();
if (get_metric) _get_metric ();
if (get_baseline) _get_baseline ();
if (get_meta) _get_meta ();
if (get_table) _get_table ();
if (list_names) _list_names ();
@ -576,6 +579,25 @@ struct info_t :
}
}
void _get_meta ()
{
for (char **p = get_meta; *p; p++)
{
hb_ot_meta_tag_t tag = (hb_ot_meta_tag_t) hb_tag_from_string (*p, -1);
hb_blob_t *blob = hb_ot_meta_reference_entry (face, tag);
if (verbose)
printf ("Meta %c%c%c%c: ", HB_UNTAG (tag));
printf ("%.*s\n",
(int) hb_blob_get_length (blob),
hb_blob_get_data (blob, nullptr));
hb_blob_destroy (blob);
}
}
void
_get_table ()
{