st: Apply css foreground color to text as a PangoAttribute

Rely on the Pango renderer handling this properly, instead of tinting
the full ClutterText in the color specified through css.

Also set the caret color explicitly, since it used to be set as a side
effect of clutter_text_set_color(), but no longer is.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/850
This commit is contained in:
Carlos Garnacho 2020-03-25 00:34:58 +01:00 committed by Carlos Garnacho
parent 11daf14e80
commit 66c4b1a8b6

View File

@ -115,18 +115,23 @@ _st_set_text_from_style (ClutterText *text,
StTextDecoration decoration; StTextDecoration decoration;
PangoAttrList *attribs = NULL; PangoAttrList *attribs = NULL;
const PangoFontDescription *font; const PangoFontDescription *font;
PangoAttribute *foreground;
StTextAlign align; StTextAlign align;
gdouble spacing; gdouble spacing;
gchar *font_features; gchar *font_features;
st_theme_node_get_foreground_color (theme_node, &color);
clutter_text_set_color (text, &color);
font = st_theme_node_get_font (theme_node); font = st_theme_node_get_font (theme_node);
clutter_text_set_font_description (text, (PangoFontDescription *) font); clutter_text_set_font_description (text, (PangoFontDescription *) font);
attribs = pango_attr_list_new (); attribs = pango_attr_list_new ();
st_theme_node_get_foreground_color (theme_node, &color);
clutter_text_set_cursor_color (text, &color);
foreground = pango_attr_foreground_new (color.red * 255,
color.green * 255,
color.blue * 255);
pango_attr_list_insert (attribs, foreground);
decoration = st_theme_node_get_text_decoration (theme_node); decoration = st_theme_node_get_text_decoration (theme_node);
if (decoration) if (decoration)
{ {