summaryrefslogtreecommitdiff
path: root/gtk/gtkcssstyle.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-09-18 00:01:39 -0400
committerMatthias Clasen <mclasen@redhat.com>2017-09-18 14:26:57 -0400
commit01ed84fbefcb2cec8518daef73d7621249ab05a8 (patch)
tree72687255f5361c0acc3d6888d6b732b77f45efd8 /gtk/gtkcssstyle.c
parentc4cbe5fecafcd2b244981769086081d4fbfb1fc2 (diff)
downloadgtk+-01ed84fbefcb2cec8518daef73d7621249ab05a8.tar.gz
css: Implement font-variant-position
This gets translated to the corresponding OpenType features.
Diffstat (limited to 'gtk/gtkcssstyle.c')
-rw-r--r--gtk/gtkcssstyle.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index 44a9f1c972..a0bdc8d536 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -227,6 +227,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
gint letter_spacing;
GtkCssValue *kerning;
GtkCssValue *ligatures;
+ GtkCssValue *position;
GString *s;
int i;
@@ -265,6 +266,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
}
/* OpenType features */
+
s = g_string_new ("");
kerning = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_KERNING);
@@ -298,6 +300,18 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
g_string_append (s, "calt 0");
}
+ position = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_POSITION);
+ if (strcmp (_gtk_css_ident_value_get (position), "sub") == 0)
+ {
+ if (s->len > 0) g_string_append (s, ", ");
+ g_string_append (s, "subs 1");
+ }
+ else if (strcmp (_gtk_css_ident_value_get (kerning), "super") == 0)
+ {
+ if (s->len > 0) g_string_append (s, ", ");
+ g_string_append (s, "sups 1");
+ }
+
attrs = add_pango_attr (attrs, pango_attr_font_features_new (s->str));
g_string_free (s, TRUE);