[gtk/gtk-3-24: 1/2] Add CSS letter spacing to textview
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] Add CSS letter spacing to textview
- Date: Tue, 14 Dec 2021 18:30:46 +0000 (UTC)
commit 70ef77a4c2732f4b604f6f0371c88736f5acc0e6
Author: Melroy van den Berg <melroy melroy org>
Date: Tue Dec 14 17:04:38 2021 +0100
Add CSS letter spacing to textview
gtk/gtktextview.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 6b26a48798..9651c4a21f 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -30,6 +30,7 @@
#define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
#include "gtkadjustmentprivate.h"
#include "gtkbindings.h"
+#include "gtkcssnumbervalueprivate.h"
#include "gtkdnd.h"
#include "gtkdebug.h"
#include "gtkintl.h"
@@ -7973,10 +7974,12 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
GtkTextAttributes *values)
{
GtkStyleContext *context;
+ GtkCssStyle *style;
GdkRGBA bg_color, fg_color;
GtkStateFlags state;
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
+ style = gtk_css_node_get_style (gtk_text_view_get_text_node (text_view));
state = gtk_style_context_get_state (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@@ -7995,7 +7998,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (values->font)
pango_font_description_free (values->font);
- gtk_style_context_get (context, state, "font", &values->font, NULL);
+ gtk_style_context_get (context, state, GTK_STYLE_PROPERTY_FONT, &values->font, NULL);
+
+ values->letter_spacing = _gtk_css_number_value_get (gtk_css_style_get_value (style,
GTK_CSS_PROPERTY_LETTER_SPACING), 100) * PANGO_SCALE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]