From 26e632e54958e42dcafedd5b26be1cd150eecb4b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 3 Sep 2021 13:55:39 -0400 Subject: widget: Redraw when font options change Its the right thing to do, even if it is a rare event. --- gtk/gtkwidget.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 6ef2add082..4d95822fc9 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -6427,7 +6427,7 @@ gtk_widget_get_effective_font_map (GtkWidget *widget) return pango_cairo_font_map_get_default (); } -static void +static gboolean update_pango_context (GtkWidget *widget, PangoContext *context) { @@ -6436,6 +6436,9 @@ update_pango_context (GtkWidget *widget, PangoFontDescription *font_desc; GtkSettings *settings; cairo_font_options_t *font_options; + guint old_serial; + + old_serial = pango_context_get_serial (context); font_desc = gtk_css_style_get_pango_font (style); pango_context_set_font_description (context, font_desc); @@ -6475,6 +6478,8 @@ update_pango_context (GtkWidget *widget, } pango_context_set_font_map (context, gtk_widget_get_effective_font_map (widget)); + + return old_serial != pango_context_get_serial (context); } static void @@ -6482,8 +6487,11 @@ gtk_widget_update_pango_context (GtkWidget *widget) { PangoContext *context = gtk_widget_peek_pango_context (widget); - if (context) - update_pango_context (widget, context); + if (!context) + return; + + if (update_pango_context (widget, context)) + gtk_widget_queue_draw (widget); } /** -- cgit v1.2.1