widget: Redraw when font options change

Its the right thing to do, even if it is a rare event.
This commit is contained in:
Matthias Clasen 2021-09-03 13:55:39 -04:00
parent 64d2d7074f
commit 26e632e549

View File

@ -6427,7 +6427,7 @@ gtk_widget_get_effective_font_map (GtkWidget *widget)
return pango_cairo_font_map_get_default (); return pango_cairo_font_map_get_default ();
} }
static void static gboolean
update_pango_context (GtkWidget *widget, update_pango_context (GtkWidget *widget,
PangoContext *context) PangoContext *context)
{ {
@ -6436,6 +6436,9 @@ update_pango_context (GtkWidget *widget,
PangoFontDescription *font_desc; PangoFontDescription *font_desc;
GtkSettings *settings; GtkSettings *settings;
cairo_font_options_t *font_options; 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); font_desc = gtk_css_style_get_pango_font (style);
pango_context_set_font_description (context, font_desc); 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)); pango_context_set_font_map (context, gtk_widget_get_effective_font_map (widget));
return old_serial != pango_context_get_serial (context);
} }
static void static void
@ -6482,8 +6487,11 @@ gtk_widget_update_pango_context (GtkWidget *widget)
{ {
PangoContext *context = gtk_widget_peek_pango_context (widget); PangoContext *context = gtk_widget_peek_pango_context (widget);
if (context) if (!context)
update_pango_context (widget, context); return;
if (update_pango_context (widget, context))
gtk_widget_queue_draw (widget);
} }
/** /**