diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-07 11:17:54 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-22 15:15:50 -0400 |
commit | ae767dc5bf19894cbd3392b98d5b6dc4d3e62b3e (patch) | |
tree | eae5d574e97767417e03f10a7c8ef70c3a52e6f7 | |
parent | d9234029345610d74b1ab0c9f7d860b9acf3dad3 (diff) | |
download | gtk+-ae767dc5bf19894cbd3392b98d5b6dc4d3e62b3e.tar.gz |
css: Translate line-height to a Pango
Pango 1.50 introduces a line-height attribute. Use it.
This is enough to make line-height work for labels
and entries.
-rw-r--r-- | gtk/gtkcssstyle.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c index 54aa0e7d23..01e7467a10 100644 --- a/gtk/gtkcssstyle.c +++ b/gtk/gtkcssstyle.c @@ -33,6 +33,7 @@ #include "gtkcssstringvalueprivate.h" #include "gtkcssfontvariationsvalueprivate.h" #include "gtkcssfontfeaturesvalueprivate.h" +#include "gtkcsslineheightvalueprivate.h" #include "gtkcssstylepropertyprivate.h" #include "gtkcsstransitionprivate.h" #include "gtkstyleanimationprivate.h" @@ -485,6 +486,20 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style) attrs = add_pango_attr (attrs, pango_attr_letter_spacing_new (letter_spacing * PANGO_SCALE)); } +#if PANGO_VERSION_CHECK(1, 49, 0) + /* line-height */ + { + double height = gtk_css_line_height_value_get (style->font->line_height); + if (height != 0.0) + { + if (gtk_css_number_value_get_dimension (style->font->line_height) == GTK_CSS_DIMENSION_LENGTH) + attrs = add_pango_attr (attrs, pango_attr_line_height_new_absolute (height * PANGO_SCALE)); + else + attrs = add_pango_attr (attrs, pango_attr_line_height_new (height)); + } + } +#endif + /* OpenType features */ s = NULL; |