[gnome-shell/issue154: 5/6] st-private: Add support for letter-spacing in ClutterText based StWidgets



commit 376d696b8b073fe9dfad821f8f4d324296533e98
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Fri Mar 23 21:11:52 2018 +0000

    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.

 src/st/st-private.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index 2bdc29b6c..a0100e094 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -116,6 +116,7 @@ _st_set_text_from_style (ClutterText *text,
   PangoAttrList *attribs = NULL;
   const PangoFontDescription *font;
   StTextAlign align;
+  gdouble spacing;
 
   st_theme_node_get_foreground_color (theme_node, &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);
   clutter_text_set_font_description (text, (PangoFontDescription *) font);
 
+  attribs = pango_attr_list_new ();
+
   decoration = st_theme_node_get_text_decoration (theme_node);
   if (decoration)
     {
-      attribs = pango_attr_list_new ();
-
       if (decoration & ST_TEXT_DECORATION_UNDERLINE)
         {
           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);
 
   if (attribs)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]