[gtk/css-line-height] textview fixes



commit d47392487fb4fb44d15db63dec45025ea72880a6
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 6 16:41:16 2021 -0400

    textview fixes

 gtk/gtktexttag.c  | 18 +++++++++++++-----
 gtk/gtktextview.c |  6 ++----
 2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c
index 273f8c0c78..498379cab4 100644
--- a/gtk/gtktexttag.c
+++ b/gtk/gtktexttag.c
@@ -601,7 +601,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                                      GTK_PARAM_READWRITE));
 
   /**
-   * GtkTextag:line-spacing:
+   * GtkTexTag:line-spacing:
    *
    * The line spacing factor that is applied between consecutive lines.
    *
@@ -610,10 +610,10 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
   g_object_class_install_property (object_class,
                                    PROP_LINE_SPACING,
                                    g_param_spec_float ("line-spacing",
-                                                     P_("Linespacing"),
-                                                     P_("The factor for spacing between lines"),
-                                                     0.0, 10.0, 0.0,
-                                                     GTK_PARAM_READWRITE));
+                                                       P_("Line spacing"),
+                                                       P_("The factor for spacing between lines"),
+                                                       0.0, 10.0, 0.0,
+                                                       GTK_PARAM_READWRITE));
 
   /**
    * GtkTextTag:strikethrough:
@@ -2052,6 +2052,10 @@ gtk_text_tag_get_property (GObject      *object,
       g_value_set_int (value,  priv->values->pixels_inside_wrap);
       break;
 
+    case PROP_LINE_SPACING:
+      g_value_set_float (value,  priv->values->line_spacing);
+      break;
+
     case PROP_EDITABLE:
       g_value_set_boolean (value, priv->values->editable);
       break;
@@ -2199,6 +2203,10 @@ gtk_text_tag_get_property (GObject      *object,
       g_value_set_boolean (value, priv->pixels_inside_wrap_set);
       break;
 
+    case PROP_LINE_SPACING_SET:
+      g_value_set_boolean (value, priv->line_spacing_set);
+      break;
+
     case PROP_EDITABLE_SET:
       g_value_set_boolean (value, priv->editable_set);
       break;
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 6a77e9542d..776db9902e 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -58,6 +58,7 @@
 #include "gtkwidgetprivate.h"
 #include "gtkjoinedmenuprivate.h"
 #include "gtkcssstylepropertyprivate.h"
+#include "gtkcssstringvalueprivate.h"
 
 /**
  * GtkTextView:
@@ -7641,7 +7642,6 @@ gtk_text_view_set_attributes_from_style (GtkTextView        *text_view,
                                          GtkTextAttributes  *values)
 {
   GtkCssStyle *style;
-  GtkCssStyleProperty *prop;
   const GdkRGBA black = { 0, };
   const GdkRGBA *color;
 
@@ -7662,9 +7662,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView        *text_view,
 
   values->font = gtk_css_style_get_pango_font (style);
 
-  prop = _gtk_css_style_property_lookup_by_id (GTK_CSS_PROPERTY_LINE_HEIGHT);
-
-  if (style->font->line_height == _gtk_css_style_property_get_initial_value (prop))
+  if (_gtk_css_value_equal (style->font->line_height, gtk_css_line_height_value_get_default ()))
     values->line_spacing = 0.0;
   else
     values->line_spacing = _gtk_css_number_value_get (style->font->line_height, 1.0);


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