[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.
This commit is contained in:
Matthias Clasen 2023-01-20 22:06:47 -05:00
parent fcb5111cc6
commit c574eda74b
1 changed files with 13 additions and 6 deletions

View File

@ -964,19 +964,26 @@ struct info_t
char name[64]; char name[64];
unsigned name_len = sizeof name; unsigned name_len = sizeof name;
hb_ot_name_get_utf8 (face, name_id, hb_ot_name_get_utf8 (face, name_id,
language, language,
&name_len, name); &name_len, name);
const char *type = "";
printf ("%u ", i);
if (flags) if (flags)
{ {
if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND) if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND)
printf ("Light"); {
if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND) if (flags & HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND)
printf ("Dark"); type = "Both";
else
type = "Light";
} }
printf ("%s\n", name); else {
type = "Dark";
}
}
printf ("%u %-*s %s\n", i, (int)strlen ("Light"), type, name);
} }
} }