summaryrefslogtreecommitdiff
path: root/gtk/gtkcssstyle.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-09-18 00:12:12 -0400
committerMatthias Clasen <mclasen@redhat.com>2017-09-18 14:26:57 -0400
commit8525afc4081e88ba4e58c7a9f90f8721d2478590 (patch)
treedaa5827c95337d391fedb0e958454fa45624f84d /gtk/gtkcssstyle.c
parent01ed84fbefcb2cec8518daef73d7621249ab05a8 (diff)
downloadgtk+-8525afc4081e88ba4e58c7a9f90f8721d2478590.tar.gz
css: Implement font-variant-caps
This gets translated to the corresponding OpenType features.
Diffstat (limited to 'gtk/gtkcssstyle.c')
-rw-r--r--gtk/gtkcssstyle.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index a0bdc8d536..8b35f0e5ce 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -228,6 +228,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
GtkCssValue *kerning;
GtkCssValue *ligatures;
GtkCssValue *position;
+ GtkCssValue *caps;
GString *s;
int i;
@@ -312,6 +313,38 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
g_string_append (s, "sups 1");
}
+ caps = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_CAPS);
+ if (strcmp (_gtk_css_ident_value_get (caps), "small-caps") == 0)
+ {
+ if (s->len > 0) g_string_append (s, ", ");
+ g_string_append (s, "smcp 1");
+ }
+ else if (strcmp (_gtk_css_ident_value_get (caps), "all-small-caps") == 0)
+ {
+ if (s->len > 0) g_string_append (s, ", ");
+ g_string_append (s, "c2sc 1, smcp 1");
+ }
+ else if (strcmp (_gtk_css_ident_value_get (caps), "petite-caps") == 0)
+ {
+ if (s->len > 0) g_string_append (s, ", ");
+ g_string_append (s, "pcap 1");
+ }
+ else if (strcmp (_gtk_css_ident_value_get (caps), "all-petite-caps") == 0)
+ {
+ if (s->len > 0) g_string_append (s, ", ");
+ g_string_append (s, "c2pc 1, pcap 1");
+ }
+ else if (strcmp (_gtk_css_ident_value_get (caps), "unicase") == 0)
+ {
+ if (s->len > 0) g_string_append (s, ", ");
+ g_string_append (s, "unic 1");
+ }
+ else if (strcmp (_gtk_css_ident_value_get (caps), "titling-caps") == 0)
+ {
+ if (s->len > 0) g_string_append (s, ", ");
+ g_string_append (s, "titl 1");
+ }
+
attrs = add_pango_attr (attrs, pango_attr_font_features_new (s->str));
g_string_free (s, TRUE);