[hb-info] Add --dump-table

This commit is contained in:
Behdad Esfahbod 2023-01-19 15:51:46 -07:00
parent 148ee3e0c7
commit 1302a88b25
1 changed files with 17 additions and 0 deletions

View File

@ -61,6 +61,9 @@ struct info_t
#ifndef HB_NO_VAR #ifndef HB_NO_VAR
{"list-variations",0, 0, G_OPTION_ARG_NONE, &this->list_variations, "List variations", nullptr}, {"list-variations",0, 0, G_OPTION_ARG_NONE, &this->list_variations, "List variations", nullptr},
#endif #endif
{"dump-table", 0, 0, G_OPTION_ARG_STRING, &this->dump_table, "Dump font table", "TABLE-TAG"},
{nullptr} {nullptr}
}; };
parser->add_group (entries, parser->add_group (entries,
@ -102,6 +105,8 @@ struct info_t
hb_bool_t list_variations = false; hb_bool_t list_variations = false;
#endif #endif
char *dump_table = nullptr;
public: public:
template <typename app_t> template <typename app_t>
@ -167,6 +172,8 @@ struct info_t
if (list_variations) _list_variations (); if (list_variations) _list_variations ();
#endif #endif
if (dump_table) _dump_table ();
hb_font_destroy (font); hb_font_destroy (font);
hb_face_destroy (face); hb_face_destroy (face);
} }
@ -606,6 +613,16 @@ struct info_t
} }
} }
#endif #endif
void
_dump_table ()
{
hb_blob_t *blob = hb_face_reference_table (face, hb_tag_from_string (dump_table, -1));
unsigned count = 0;
const char *data = hb_blob_get_data (blob, &count);
fwrite (data, 1, count, stdout);
hb_blob_destroy (blob);
}
}; };