[hb-info] Write fallback metrics in --list-metrics

This commit is contained in:
Behdad Esfahbod 2023-01-22 14:39:26 -07:00
parent 7ba3d0c419
commit b839f53cde
1 changed files with 19 additions and 2 deletions

View File

@ -565,15 +565,32 @@ struct info_t
GEnumClass *enum_class = (GEnumClass *) g_type_class_ref ((GType) HB_GOBJECT_TYPE_OT_METRICS_TAG); GEnumClass *enum_class = (GEnumClass *) g_type_class_ref ((GType) HB_GOBJECT_TYPE_OT_METRICS_TAG);
bool any_fallback = false;
unsigned count = enum_class->n_values; unsigned count = enum_class->n_values;
const auto *entries = enum_class->values; const auto *entries = enum_class->values;
for (unsigned i = 0; i < count; i++) for (unsigned i = 0; i < count; i++)
{ {
bool fallback = false;
hb_position_t v; hb_position_t v;
if (hb_ot_metrics_get_position (font, if (!hb_ot_metrics_get_position (font,
(hb_ot_metrics_tag_t) entries[i].value, (hb_ot_metrics_tag_t) entries[i].value,
&v)) &v))
printf ("%c%c%c%c: %-33s %d\n", HB_UNTAG(entries[i].value), entries[i].value_nick, v); {
hb_ot_metrics_get_position_with_fallback (font,
(hb_ot_metrics_tag_t) entries[i].value,
&v);
any_fallback = fallback = true;
}
printf ("%c%c%c%c: %-33s %d", HB_UNTAG(entries[i].value), entries[i].value_nick, v);
if (fallback)
printf (" *");
printf ("\n");
}
if (verbose && any_fallback)
{
printf ("\n[*] Fallback value\n");
} }
} }
#endif #endif