[pango/simple-fontmap: 8/8] Improve serialization for PangoHbFont




commit b8755afa7968d232a629a0db2dfee70187c80b0c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Dec 26 12:42:30 2021 -0500

    Improve serialization for PangoHbFont
    
    Include index and instance_id in the output.

 pango/serializer.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/pango/serializer.c b/pango/serializer.c
index 2dab93b4..ee30a01d 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -26,6 +26,7 @@
 #include <pango/pango-context-private.h>
 #include <pango/pango-enum-types.h>
 #include <pango/pango-font-private.h>
+#include <pango/pango-hbface-private.h>
 
 #include <hb-ot.h>
 #include "pango/json/gtkjsonparserprivate.h"
@@ -566,6 +567,16 @@ add_font (GtkJsonPrinter *printer,
   str = g_compute_checksum_for_data (G_CHECKSUM_SHA256, (const guchar *)data, length);
 
   gtk_json_printer_add_string (printer, "checksum", str);
+  if (hb_face_get_index (face) != 0)
+    gtk_json_printer_add_integer (printer, "index", hb_face_get_index (face));
+
+  if (PANGO_IS_HB_FACE (pango_font_get_face (font)))
+    {
+      PangoHbFace *hbface = PANGO_HB_FACE (pango_font_get_face (font));
+
+      if (hbface->instance_id != -1)
+        gtk_json_printer_add_integer (printer, "instance-id", hbface->instance_id);
+    }
 
   g_free (str);
   hb_blob_destroy (blob);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]