diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-11-29 00:09:50 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-11-29 08:12:11 -0500 |
commit | ae8297b785eacc61890b6042c0f89af6f65b3bb3 (patch) | |
tree | 2ea240fdb43f818145781910cb1116e4a1a03d17 /pango/serializer.c | |
parent | a6ed4ff80188bb0472891b08c421d3ca4c846315 (diff) | |
download | pango-ae8297b785eacc61890b6042c0f89af6f65b3bb3.tar.gz |
tabs: Add a decimal point
This is useful for PANGO_TAB_DECIMAL.
Implement this in PangoLayout, in the
serializer, and update tests.
Diffstat (limited to 'pango/serializer.c')
-rw-r--r-- | pango/serializer.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pango/serializer.c b/pango/serializer.c index 372fbd8b..fe0fc25c 100644 --- a/pango/serializer.c +++ b/pango/serializer.c @@ -226,6 +226,8 @@ add_tab_array (JsonBuilder *builder, 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); @@ -1139,7 +1141,8 @@ json_to_tab_array (JsonReader *reader, for (int i = 0; i < json_reader_count_elements (reader); i++) { int pos; - PangoTabAlign align; + PangoTabAlign align = PANGO_TAB_LEFT; + gunichar ch = 0; json_reader_read_element (reader, i); if (json_reader_is_object (reader)) @@ -1156,14 +1159,17 @@ json_to_tab_array (JsonReader *reader, 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); - align = PANGO_TAB_LEFT; } pango_tab_array_set_tab (tabs, i, align, pos); + pango_tab_array_set_decimal_point (tabs, i, ch); json_reader_end_element (reader); } } |