summaryrefslogtreecommitdiff
path: root/pango/serializer.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/serializer.c')
-rw-r--r--pango/serializer.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/pango/serializer.c b/pango/serializer.c
index 6e394a1c..fe0fc25c 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -218,9 +218,17 @@ add_tab_array (JsonBuilder *builder,
json_builder_begin_array (builder);
for (int i = 0; i < pango_tab_array_get_size (tabs); i++)
{
+ PangoTabAlign align;
int pos;
- pango_tab_array_get_tab (tabs, i, NULL, &pos);
+ pango_tab_array_get_tab (tabs, i, &align, &pos);
+ json_builder_begin_object (builder);
+ json_builder_set_member_name (builder, "position");
json_builder_add_int_value (builder, pos);
+ json_builder_set_member_name (builder, "alignment");
+ add_enum_value (builder, PANGO_TYPE_TAB_ALIGN, align, FALSE);
+ json_builder_set_member_name (builder, "decimal-point");
+ json_builder_add_int_value (builder, pango_tab_array_get_decimal_point (tabs, i));
+ json_builder_end_object (builder);
}
json_builder_end_array (builder);
@@ -1133,9 +1141,35 @@ json_to_tab_array (JsonReader *reader,
for (int i = 0; i < json_reader_count_elements (reader); i++)
{
int pos;
+ PangoTabAlign align = PANGO_TAB_LEFT;
+ gunichar ch = 0;
+
json_reader_read_element (reader, i);
- pos = json_reader_get_int_value (reader);
- pango_tab_array_set_tab (tabs, i, PANGO_TAB_LEFT, pos);
+ if (json_reader_is_object (reader))
+ {
+ json_reader_read_member (reader, "position");
+ pos = json_reader_get_int_value (reader);
+ json_reader_end_member (reader);
+ json_reader_read_member (reader, "alignment");
+
+ align = get_enum_value (PANGO_TYPE_TAB_ALIGN,
+ json_reader_get_string_value (reader),
+ FALSE,
+ error);
+ if (align == -1)
+ goto fail;
+ json_reader_end_member (reader);
+ json_reader_read_member (reader, "decimal-point");
+ ch = json_reader_get_int_value (reader);
+ json_reader_end_member (reader);
+ }
+ else
+ {
+ pos = json_reader_get_int_value (reader);
+ }
+
+ pango_tab_array_set_tab (tabs, i, align, pos);
+ pango_tab_array_set_decimal_point (tabs, i, ch);
json_reader_end_element (reader);
}
}