...
 
Commits (2)
......@@ -733,6 +733,7 @@ StScrollBar {
transition-duration: 500ms;
font-weight: bold;
height: 1.86em;
font-feature-settings: "tnum";
&.unlock-screen,
&.login-screen,
......@@ -958,6 +959,7 @@ StScrollBar {
padding: 0.1em;
margin: 2px;
border-radius: 1.4em;
font-feature-settings: "tnum";
&:hover,&:focus { background-color: lighten($bg_color,5%); }
&:active,&:selected {
color: lighten($selected_fg_color,5%);
......@@ -1867,6 +1869,7 @@ StScrollBar {
.screen-shield-clock-time {
font-size: 72pt;
text-shadow: 0px 2px 2px rgba(0,0,0,0.4);
font-feature-settings: "tnum";
}
.screen-shield-clock-date {
......
......@@ -117,6 +117,7 @@ _st_set_text_from_style (ClutterText *text,
const PangoFontDescription *font;
StTextAlign align;
gdouble spacing;
gchar *font_features;
st_theme_node_get_foreground_color (theme_node, &color);
clutter_text_set_color (text, &color);
......@@ -151,6 +152,13 @@ _st_set_text_from_style (ClutterText *text,
pango_attr_list_insert (attribs, letter_spacing);
}
font_features = st_theme_node_get_font_features (theme_node);
if (font_features)
{
pango_attr_list_insert (attribs, pango_attr_font_features_new (font_features));
g_free (font_features);
}
clutter_text_set_attributes (text, attribs);
if (attribs)
......
......@@ -3019,6 +3019,39 @@ st_theme_node_get_font (StThemeNode *node)
return node->font_desc;
}
gchar *
st_theme_node_get_font_features (StThemeNode *node)
{
int i;
ensure_properties (node);
for (i = node->n_properties - 1; i >= 0; i--)
{
CRDeclaration *decl = node->properties[i];
if (strcmp (decl->property->stryng->str, "font-feature-settings") == 0)
{
CRTerm *term = decl->value;
if (!term->next && term->type == TERM_IDENT)
{
gchar *ident = term->content.str->stryng->str;
if (strcmp (ident, "inherit") == 0)
break;
if (strcmp (ident, "normal") == 0)
return NULL;
}
return (gchar *)cr_term_to_string (term);
}
}
return node->parent_node ? st_theme_node_get_font_features (node->parent_node) : NULL;
}
/**
* st_theme_node_get_border_image:
* @node: a #StThemeNode
......
......@@ -232,6 +232,8 @@ double st_theme_node_get_letter_spacing (StThemeNode *node);
*/
const PangoFontDescription *st_theme_node_get_font (StThemeNode *node);
gchar *st_theme_node_get_font_features (StThemeNode *node);
StBorderImage *st_theme_node_get_border_image (StThemeNode *node);
StShadow *st_theme_node_get_box_shadow (StThemeNode *node);
StShadow *st_theme_node_get_text_shadow (StThemeNode *node);
......
......@@ -59,6 +59,24 @@ assert_font (StThemeNode *node,
g_free (value);
}
static void
assert_font_features (StThemeNode *node,
const char *node_description,
const char *expected)
{
char *value = st_theme_node_get_font_features (node);
if (g_strcmp0 (expected, value) != 0)
{
g_print ("%s: %s.font-feature-settings: expected: %s, got: %s\n",
test, node_description, expected, value);
fail = TRUE;
}
if (value)
g_free (value);
}
static char *
text_decoration_to_string (StTextDecoration decoration)
{
......@@ -413,6 +431,22 @@ test_font (void)
assert_font (text3, "text3", "serif Bold Oblique Small-Caps 24px");
}
static void
test_font_features (void)
{
test = "font_features";
/* group1 has font-feature-settings: "tnum" */
assert_font_features (group1, "group1", "\"tnum\"");
/* text2 should inherit from group1 */
assert_font_features (text2, "text2", "\"tnum\"");
/* group2 has font-feature-settings: "tnum", "zero" */
assert_font_features (group2, "group2", "\"tnum\", \"zero\"");
/* text3 should inherit from group2 using the inherit keyword */
assert_font_features (text3, "text3", "\"tnum\", \"zero\"");
/* text4 has font-feature-settings: normal */
assert_font_features (text4, "text4", NULL);
}
static void
test_pseudo_class (void)
{
......@@ -554,6 +588,7 @@ main (int argc, char **argv)
test_border ();
test_background ();
test_font ();
test_font_features ();
test_pseudo_class ();
test_inline_style ();
......
......@@ -13,6 +13,8 @@ stage {
margin-left: 1in;
background: #ff0000 url('some-background.png');
font-feature-settings: "tnum";
}
#text1 {
......@@ -35,6 +37,7 @@ ClutterTexture.special-text {
#group2 {
font: italic 12px serif;
font-feature-settings: "tnum", "zero";
}
#text3 {
......@@ -42,6 +45,11 @@ ClutterTexture.special-text {
font-weight: bold;
font-style: oblique;
font-size: 200%;
font-feature-settings: "pnum";
}
#text4 {
font-feature-settings: normal;
}
ClutterTexture {
......@@ -60,6 +68,10 @@ stage > #text2 {
color: #ff0000;
}
#group2 > #text3 {
font-feature-settings: inherit;
}
#group2 {
background-image: url('other-background.png');
padding: 1px 2px 3px 4px;
......