[hb-info List enum nicks in --list-names

This commit is contained in:
Behdad Esfahbod 2023-01-22 14:12:44 -07:00
parent def94aa8c5
commit 4ec3d2e32a
3 changed files with 22 additions and 4 deletions

View File

@ -512,9 +512,13 @@ struct info_t
{
separator ();
printf ("Name information:\n\n");
printf ("Id Text\n------------\n");
printf ("Id Text\n------------------------------------\n");
}
#ifdef HB_HAS_GOBJECT
GEnumClass *enum_class = (GEnumClass *) g_type_class_ref ((GType) HB_GOBJECT_TYPE_OT_NAME_ID_PREDEFINED);
#endif
unsigned count;
const auto *entries = hb_ot_name_list_names (face, &count);
for (unsigned i = 0; i < count; i++)
@ -525,7 +529,15 @@ struct info_t
language,
&name_len, name);
printf ("%u %s\n", entries[i].name_id, name);
#ifdef HB_HAS_GOBJECT
if (verbose)
{
GEnumValue *enum_value = g_enum_get_value (enum_class, entries[i].name_id);
printf ("%u: %-27s %s\n", entries[i].name_id, enum_value ? enum_value->value_nick : "", name);
}
else
#endif
printf ("%u %s\n", entries[i].name_id, name);
}
}

View File

@ -44,8 +44,8 @@ if conf.get('HAVE_GLIB', 0) == 1
hb_info = executable('hb-info', hb_info_sources,
cpp_args: cpp_args,
include_directories: [incconfig, incsrc],
dependencies: util_deps,
link_with: [libharfbuzz],
dependencies: [util_deps, gobject_dep],
link_with: [libharfbuzz, libharfbuzz_gobject],
install: true,
)
meson.override_find_program('hb-info', hb_info)

View File

@ -46,12 +46,18 @@
#endif
#include <hb-features.h>
#include <hb.h>
#include <hb-ot.h>
#ifdef HB_HAS_GOBJECT
#include <hb-gobject.h>
#endif
#include <glib.h>
#include <glib/gprintf.h>
static inline void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN G_GNUC_PRINTF (2, 3);
static inline void