From 3495a602a3fbe7c40d4057996a6dc6e0914d84fe Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 6 Aug 2006 03:15:52 +0000 Subject: [PATCH] Create new PangoContexts and set them on the layout, to catch changes in 2006-08-05 Matthias Clasen * gtk/gtktextview.c (gtk_text_view_style_set): Create new PangoContexts and set them on the layout, to catch changes in font options. (#348278, Behdad Esfahbod) --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ gtk/gtktextview.c | 14 +++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cfee20ec5f..782c5926cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-08-05 Matthias Clasen + * gtk/gtktextview.c (gtk_text_view_style_set): Create new + PangoContexts and set them on the layout, to catch changes in + font options. (#348278, Behdad Esfahbod) + * gtk/gtkstyle.c (gtk_default_draw_flat_box): Add a missing initialization. (#349863, Benjamin Berg) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cfee20ec5f..782c5926cb 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,9 @@ 2006-08-05 Matthias Clasen + * gtk/gtktextview.c (gtk_text_view_style_set): Create new + PangoContexts and set them on the layout, to catch changes in + font options. (#348278, Behdad Esfahbod) + * gtk/gtkstyle.c (gtk_default_draw_flat_box): Add a missing initialization. (#349863, Benjamin Berg) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 66232ca4da..fa2986eeb1 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -3584,6 +3584,7 @@ gtk_text_view_style_set (GtkWidget *widget, GtkStyle *previous_style) { GtkTextView *text_view = GTK_TEXT_VIEW (widget); + PangoContext *ltr_context, *rtl_context; if (GTK_WIDGET_REALIZED (widget)) { @@ -3595,7 +3596,17 @@ gtk_text_view_style_set (GtkWidget *widget, gtk_text_view_set_attributes_from_style (text_view, text_view->layout->default_style, widget->style); - gtk_text_layout_default_style_changed (text_view->layout); + + + ltr_context = gtk_widget_create_pango_context (widget); + pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR); + rtl_context = gtk_widget_create_pango_context (widget); + pango_context_set_base_dir (rtl_context, PANGO_DIRECTION_RTL); + + gtk_text_layout_set_contexts (text_view->layout, ltr_context, rtl_context); + + g_object_unref (ltr_context); + g_object_unref (rtl_context); } } @@ -3608,6 +3619,7 @@ gtk_text_view_direction_changed (GtkWidget *widget, if (text_view->layout) { text_view->layout->default_style->direction = gtk_widget_get_direction (widget); + gtk_text_layout_default_style_changed (text_view->layout); } }