[hb-info] Add --list-meta
This commit is contained in:
parent
2fec4f1c3d
commit
42ed6abb6a
|
@ -125,6 +125,7 @@ struct info_t :
|
|||
{"list-variations",0, 0, G_OPTION_ARG_NONE, &this->list_variations, "List variations", nullptr},
|
||||
#endif
|
||||
{"list-palettes", 0, 0, G_OPTION_ARG_NONE, &this->list_palettes, "List color palettes", nullptr},
|
||||
{"list-meta", 0, 0, G_OPTION_ARG_NONE, &this->list_meta, "List meta information", nullptr},
|
||||
|
||||
{nullptr}
|
||||
};
|
||||
|
@ -219,6 +220,7 @@ struct info_t :
|
|||
hb_bool_t list_variations = false;
|
||||
#endif
|
||||
hb_bool_t list_palettes = false;
|
||||
hb_bool_t list_meta = false;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -286,6 +288,7 @@ struct info_t :
|
|||
list_variations =
|
||||
#endif
|
||||
list_palettes =
|
||||
list_meta =
|
||||
true;
|
||||
}
|
||||
|
||||
|
@ -323,6 +326,7 @@ struct info_t :
|
|||
if (list_variations) _list_variations ();
|
||||
#endif
|
||||
if (list_palettes) _list_palettes ();
|
||||
if (list_meta) _list_meta ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1359,6 +1363,39 @@ struct info_t :
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_list_meta ()
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
separator ();
|
||||
printf ("Meta information:\n");
|
||||
}
|
||||
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
printf ("Tag Data\n------------\n");
|
||||
}
|
||||
unsigned count = hb_ot_meta_get_entry_tags (face, 0, nullptr, nullptr);
|
||||
for (unsigned i = 0; i < count; i++)
|
||||
{
|
||||
hb_ot_meta_tag_t tag;
|
||||
unsigned len = 1;
|
||||
hb_ot_meta_get_entry_tags (face, i, &len, &tag);
|
||||
|
||||
hb_blob_t *blob = hb_ot_meta_reference_entry (face, tag);
|
||||
|
||||
printf ("%c%c%c%c %.*s\n", HB_UNTAG (tag),
|
||||
(int) hb_blob_get_length (blob),
|
||||
hb_blob_get_data (blob, nullptr));
|
||||
|
||||
hb_blob_destroy (blob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue