diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-01-04 23:31:11 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-01-28 09:03:03 -0500 |
commit | dbefcf25f8cb7c5728c6f952a4e6e8d6302313c3 (patch) | |
tree | f7b4a0ed3fc3f96cfcf2c8608d04a63197e06509 /pango | |
parent | e1da783fe5a70e3f93c779f258b2ba46c5277695 (diff) | |
download | pango-dbefcf25f8cb7c5728c6f952a4e6e8d6302313c3.tar.gz |
serializer: Leave out faceid for now
The serializer has its own checksum to guarantee
font matches, and including the faceid in serialized
font descriptions would make the serialization
backend-dependent.
We can add it later when all our fontmaps are hb.
Diffstat (limited to 'pango')
-rw-r--r-- | pango/serializer.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/pango/serializer.c b/pango/serializer.c index 37969e1b..99352c0d 100644 --- a/pango/serializer.c +++ b/pango/serializer.c @@ -265,6 +265,23 @@ static const char *ellipsize_names[] = { /* }}} */ /* {{{ Serialization */ +static char * +font_description_to_string (PangoFontDescription *desc) +{ + PangoFontDescription *copy; + char *s; + + /* Leave out the faceid for now, since it would make serialization + * backend-dependent. + */ + copy = pango_font_description_copy_static (desc); + pango_font_description_unset_fields (copy, PANGO_FONT_MASK_FACEID); + s = pango_font_description_to_string (copy); + pango_font_description_free (copy); + + return s; +} + static void add_attribute (GtkJsonPrinter *printer, PangoAttribute *attr) @@ -356,7 +373,7 @@ add_attribute (GtkJsonPrinter *printer, break; case PANGO_ATTR_FONT_DESC: - str = pango_font_description_to_string (((PangoAttrFontDesc*)attr)->desc); + str = font_description_to_string (((PangoAttrFontDesc*)attr)->desc); gtk_json_printer_add_string (printer, "value", str); g_free (str); break; @@ -458,7 +475,7 @@ add_context (GtkJsonPrinter *printer, * context gets updated as expected. */ - str = pango_font_description_to_string (context->font_desc); + str = font_description_to_string (context->font_desc); gtk_json_printer_add_string (printer, "font", str); g_free (str); @@ -557,7 +574,7 @@ add_font (GtkJsonPrinter *printer, gtk_json_printer_start_object (printer, member); desc = pango_font_describe (font); - str = pango_font_description_to_string (desc); + str = font_description_to_string (desc); gtk_json_printer_add_string (printer, "description", str); g_free (str); pango_font_description_free (desc); @@ -806,9 +823,9 @@ layout_to_json (GtkJsonPrinter *printer, if (layout->font_desc) { - char *str = pango_font_description_to_string (layout->font_desc); - gtk_json_printer_add_string (printer, "font", str); - g_free (str); + char *s = font_description_to_string (layout->font_desc); + gtk_json_printer_add_string (printer, "font", s); + g_free (s); } add_tab_array (printer, layout->tabs); |