summaryrefslogtreecommitdiff
path: root/pango2/serializer.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-07-01 09:57:35 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-07-04 11:24:16 -0400
commit8ee5fe2707db5013dc53084ec1ac44e91b863f6d (patch)
tree1535b516d1df78b14be71ee84315a3318687d25c /pango2/serializer.c
parent9954891c66a241338cc48d2c2236b12dd2368572 (diff)
downloadpango-8ee5fe2707db5013dc53084ec1ac44e91b863f6d.tar.gz
Support color palettes in fonts
Add a pango_context_set_palette to select whether we prefer the default palette, the palette for light background, or the palette for dark background. Also add a palette attribute that can be used to override this. Make the cairo renderer pick up the palette, and apply it when installing the font for a run. Predefined palette names are "default", "light", "dark", "palette0", "palette1", ... Additionally, PangoHbFace can associate custom names with palette indices. To try this, use the new --palette option of pango-view. Fonts to try this with are Amiri Quran Colored or the Bungee Color family.
Diffstat (limited to 'pango2/serializer.c')
-rw-r--r--pango2/serializer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pango2/serializer.c b/pango2/serializer.c
index 7f719a06..03ffb4cd 100644
--- a/pango2/serializer.c
+++ b/pango2/serializer.c
@@ -1053,6 +1053,12 @@ attr_for_type (GtkJsonParser *parser,
g_free (str);
break;
+ case PANGO2_ATTR_PALETTE:
+ str = gtk_json_parser_get_string (parser);
+ attr = pango2_attr_palette_new (str);
+ g_free (str);
+ break;
+
case PANGO2_ATTR_ALLOW_BREAKS:
attr = pango2_attr_allow_breaks_new (gtk_json_parser_get_boolean (parser));
break;