From 262bfa025fb163b6739aae02435b34b161ddf42b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 15 Jan 2023 21:47:50 -0500 Subject: [PATCH] hb-shape: Print table version where relevant When listing tables with --list-tables, show the version for CPAL and COLR tables. --- util/face-options.hh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/util/face-options.hh b/util/face-options.hh index e193b0000..2e015b1c2 100644 --- a/util/face-options.hh +++ b/util/face-options.hh @@ -28,6 +28,7 @@ #define FACE_OPTIONS_HH #include "options.hh" +#include "hb-open-type.hh" struct face_options_t { @@ -141,7 +142,15 @@ static G_GNUC_NORETURN void _list_tables (hb_face_t *face) hb_blob_t *blob = hb_face_reference_table (face, tag); - printf ("%c%c%c%c: %8u bytes\n", HB_UNTAG (tag), hb_blob_get_length (blob)); + int version = 0; + + if (tag == HB_TAG('C','P','A','L') || + tag == HB_TAG('C','O','L','R')) + { + version = (int) *(OT::HBUINT16 *) hb_blob_get_data (blob, NULL); + } + + printf ("%c%c%c%c%s %8u bytes\n", HB_UNTAG (tag), version == 1 ? "v1:" : ": ", hb_blob_get_length (blob)); hb_blob_destroy (blob); }