st-private: Add support for letter-spacing in ClutterText based StWidgets
Add support in _st_set_text_from_style(), so that this CSS property can be used from any StWidget holding an internal ClutterText.
This commit is contained in:
parent
695d61968d
commit
376d696b8b
@ -116,6 +116,7 @@ _st_set_text_from_style (ClutterText *text,
|
|||||||
PangoAttrList *attribs = NULL;
|
PangoAttrList *attribs = NULL;
|
||||||
const PangoFontDescription *font;
|
const PangoFontDescription *font;
|
||||||
StTextAlign align;
|
StTextAlign align;
|
||||||
|
gdouble spacing;
|
||||||
|
|
||||||
st_theme_node_get_foreground_color (theme_node, &color);
|
st_theme_node_get_foreground_color (theme_node, &color);
|
||||||
clutter_text_set_color (text, &color);
|
clutter_text_set_color (text, &color);
|
||||||
@ -123,11 +124,11 @@ _st_set_text_from_style (ClutterText *text,
|
|||||||
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 ();
|
||||||
|
|
||||||
decoration = st_theme_node_get_text_decoration (theme_node);
|
decoration = st_theme_node_get_text_decoration (theme_node);
|
||||||
if (decoration)
|
if (decoration)
|
||||||
{
|
{
|
||||||
attribs = pango_attr_list_new ();
|
|
||||||
|
|
||||||
if (decoration & ST_TEXT_DECORATION_UNDERLINE)
|
if (decoration & ST_TEXT_DECORATION_UNDERLINE)
|
||||||
{
|
{
|
||||||
PangoAttribute *underline = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
|
PangoAttribute *underline = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
|
||||||
@ -143,6 +144,13 @@ _st_set_text_from_style (ClutterText *text,
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spacing = st_theme_node_get_letter_spacing (theme_node);
|
||||||
|
if (spacing)
|
||||||
|
{
|
||||||
|
PangoAttribute *letter_spacing = pango_attr_letter_spacing_new ((int)(.5 + spacing) * PANGO_SCALE);
|
||||||
|
pango_attr_list_insert (attribs, letter_spacing);
|
||||||
|
}
|
||||||
|
|
||||||
clutter_text_set_attributes (text, attribs);
|
clutter_text_set_attributes (text, attribs);
|
||||||
|
|
||||||
if (attribs)
|
if (attribs)
|
||||||
|
Loading…
Reference in New Issue
Block a user