[gtk/css-line-height2: 3/5] css: Translate line-height to a pango attribute




commit 532b48779aa9e643c5769f0104d0f7d893377a21
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 7 11:17:54 2021 -0400

    css: Translate line-height to a pango attribute
    
    Pango 1.50 introduces a line-height attribute. Use it.
    This is enough to make line-height work for labels.

 gtk/gtkcssstyle.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index 54aa0e7d23..f5926e1fd0 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -439,6 +439,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
   const GdkRGBA *color;
   const GdkRGBA *decoration_color;
   int letter_spacing;
+  double line_height;
   GtkCssFontVariantLigature ligatures;
   GtkCssFontVariantNumeric numeric;
   GtkCssFontVariantEastAsian east_asian;
@@ -485,6 +486,13 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
       attrs = add_pango_attr (attrs, pango_attr_letter_spacing_new (letter_spacing * PANGO_SCALE));
     }
 
+  /* line-height */
+  line_height = _gtk_css_number_value_get (style->font->line_height, 1);
+  if (line_height != 0)
+    {
+      attrs = add_pango_attr (attrs, pango_attr_line_height_new (line_height));
+    }
+
   /* OpenType features */
 
   s = NULL;


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