[pango/simple-fontmap] Improve serialization for PangoHbFont
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap] Improve serialization for PangoHbFont
- Date: Mon, 27 Dec 2021 18:16:07 +0000 (UTC)
commit 738c6b897031f8d49d63bc17ac4e153f15c8efb0
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 | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/pango/serializer.c b/pango/serializer.c
index 2dab93b4..78fba783 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"
@@ -549,6 +550,8 @@ add_font (GtkJsonPrinter *printer,
const int *coords;
hb_feature_t features[32];
PangoMatrix matrix;
+ unsigned int index;
+ int instance_id;
gtk_json_printer_start_object (printer, member);
@@ -567,6 +570,25 @@ add_font (GtkJsonPrinter *printer,
gtk_json_printer_add_string (printer, "checksum", str);
+ if (PANGO_IS_HB_FACE (pango_font_get_face (font)))
+ {
+ PangoHbFace *hbface = PANGO_HB_FACE (pango_font_get_face (font));
+
+ index = hbface->index;
+ instance_id = hbface->instance_id;
+ }
+ else
+ {
+ index = hb_face_get_index (face);
+ instance_id = (index >> 16) - 1;
+ index = index & 0xffff;
+ }
+
+ if (index != 0)
+ gtk_json_printer_add_integer (printer, "index", index);
+ if (instance_id != -1)
+ gtk_json_printer_add_integer (printer, "instance-id", instance_id);
+
g_free (str);
hb_blob_destroy (blob);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]