[evolution/webkit-composer: 98/150] Force monospace font in plain text mode



commit aa386b2bbef3344dc68321fc506d6f993f74f9c5
Author: Dan VrÃtil <dvratil redhat com>
Date:   Sun Dec 9 20:07:09 2012 +0100

    Force monospace font in plain text mode

 e-util/e-editor-widget.c |   37 +++++++++++++++----------------------
 1 files changed, 15 insertions(+), 22 deletions(-)
---
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 1d431ed..9f00be0 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -1254,6 +1254,9 @@ e_editor_widget_set_html_mode (EEditorWidget *widget,
 
 	widget->priv->html_mode = html_mode;
 
+	/* Update fonts - in plain text we only want monospace */
+	e_editor_widget_update_fonts (widget);
+
 	if (widget->priv->html_mode) {
 		gchar *plain_text, *html;
 
@@ -1282,7 +1285,7 @@ e_editor_widget_set_html_mode (EEditorWidget *widget,
 
 		g_free (plain);
 	}
-
+	
 	g_object_notify (G_OBJECT (widget), "html-mode");
 }
 
@@ -1674,35 +1677,25 @@ e_editor_widget_update_fonts (EEditorWidget *widget)
 	GtkStyleContext *context;
 	GdkColor *link = NULL;
 	GdkColor *visited = NULL;
+	gchar *font;
 
-	ms = NULL;
-	vw = NULL;
-
-
-	if (ms == NULL) {
-		gchar *font;
-
-		font = g_settings_get_string (
-				widget->priv->font_settings,
-				"monospace-font-name");
-
-		ms = pango_font_description_from_string (
-				font ? font : "monospace 10");
-
-		g_free (font);
-	}
-
-	if (vw == NULL) {
-		gchar *font;
+	font = g_settings_get_string (
+		widget->priv->font_settings,
+		"monospace-font-name");
+	ms = pango_font_description_from_string (
+		font ? font : "monospace 10");
+	g_free (font);
 
+	if (widget->priv->html_mode) {
 		font = g_settings_get_string (
 				widget->priv->font_settings,
 				"font-name");
-
 		vw = pango_font_description_from_string (
 				font ? font : "serif 10");
-
 		g_free (font);
+	} else {
+		/* When in plain text mode, force monospace font */
+		vw = pango_font_description_copy (ms);
 	}
 
 	if (pango_font_description_get_size (ms) < pango_font_description_get_size (vw)) {



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