From c574eda74b027b514665c978d32cef0aa284bee5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 20 Jan 2023 22:06:47 -0500 Subject: [PATCH] [hb-info] Fix output for CPAL The output for palette names was mangled. This commit makes things come out ok. For flags, we use "Both" when both LIGHT and DARK are set. --- util/hb-info.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/util/hb-info.cc b/util/hb-info.cc index a88063a26..7d5684635 100644 --- a/util/hb-info.cc +++ b/util/hb-info.cc @@ -964,19 +964,26 @@ struct info_t char name[64]; unsigned name_len = sizeof name; + hb_ot_name_get_utf8 (face, name_id, language, &name_len, name); - - printf ("%u ", i); + const char *type = ""; if (flags) { if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND) - printf ("Light"); - if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND) - printf ("Dark"); + { + if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND) + type = "Both"; + else + type = "Light"; + } + else { + type = "Dark"; + } } - printf ("%s\n", name); + + printf ("%u %-*s %s\n", i, (int)strlen ("Light"), type, name); } }