[evolution] Bug 649990 - Remove get_font_options() from e-util.c.



commit d88a9e736052357389f77a1e8e25221a1517ca72
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon May 16 13:08:04 2011 -0400

    Bug 649990 - Remove get_font_options() from e-util.c.
    
    Not only is get_font_options() no longer needed, it's actually doing the
    wrong thing by reading settings through GConfClient instead of GSettings.
    
    But it turns out, thanks to the tighter Cairo integration in GTK3, the
    widgets that call get_font_options() can be made to work correctly by
    simply removing this hack.  Love it when that happens.

 calendar/gui/e-day-view-main-item.c |    8 --
 e-util/e-util.c                     |  123 -----------------------------------
 e-util/e-util.h                     |    3 -
 widgets/table/e-cell-text.c         |    9 ---
 widgets/text/e-text.c               |    9 ---
 5 files changed, 0 insertions(+), 152 deletions(-)
---
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 5f8ef0d..98ce4ff 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -187,7 +187,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
 	gboolean draw_attach_icon;
 	ECalComponentTransparency transparency;
 	cairo_pattern_t *pat;
-	cairo_font_options_t *font_options;
 	guint16 red, green, blue;
 	gint i;
 	gdouble radius, x0, y0, rect_height, rect_width, text_x_offset = 0.0;
@@ -232,8 +231,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
 	gdk_cairo_set_source_color (cr,
 			&day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]);
 
-	font_options = get_font_options ();
-
 	if (!is_array_index_in_bounds (day_view->events[day], event_num))
 		return;
 
@@ -553,7 +550,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
 				cairo_set_source_rgb (cr, 0, 0, 0);
 			else
 				cairo_set_source_rgb (cr, 1, 1, 1);
-			cairo_set_font_options (cr, font_options);
 			cairo_show_text (cr, end_regsizeime);
 			cairo_close_path (cr);
 			cairo_restore (cr);
@@ -789,15 +785,11 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
 		else
 			cairo_set_source_rgb (cr, 1, 1, 1);
 		cairo_set_font_size (cr, 14.0);
-		cairo_set_font_options (cr, font_options);
 		cairo_show_text (cr, text);
 		cairo_close_path (cr);
 		cairo_restore (cr);
 	}
 
-	if (font_options)
-		cairo_font_options_destroy (font_options);
-
 	g_free (text);
 	g_object_unref (comp);
 }
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 427f479..b7dd93a 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -1204,129 +1204,6 @@ e_ascii_dtostr (gchar *buffer, gint buf_len, const gchar *format, gdouble d)
 	return buffer;
 }
 
-/* font options cache */
-static gchar *fo_antialiasing = NULL;
-static gchar *fo_hinting = NULL;
-static gchar *fo_subpixel_order = NULL;
-static GStaticMutex fo_lock = G_STATIC_MUTEX_INIT;
-
-static void
-fo_option_changed (GConfClient *client,
-                   guint cnxn_id,
-                   GConfEntry *entry,
-                   gpointer user_data)
-{
-	const gchar *key;
-
-	g_static_mutex_lock (&fo_lock);
-
-	g_free (fo_antialiasing);
-	key = "/desktop/gnome/font_rendering/antialiasing";
-	fo_antialiasing = gconf_client_get_string (client, key, NULL);
-
-	g_free (fo_hinting);
-	key = "/desktop/gnome/font_rendering/hinting";
-	fo_hinting = gconf_client_get_string (client, key, NULL);
-
-	g_free (fo_subpixel_order);
-	key = "/desktop/gnome/font_rendering/rgba_order";
-	fo_subpixel_order = gconf_client_get_string (client, key, NULL);
-
-	g_static_mutex_unlock (&fo_lock);
-}
-
-cairo_font_options_t *
-get_font_options (void)
-{
-	static GConfClient *fo_gconf = NULL;
-	cairo_font_options_t *font_options = cairo_font_options_create ();
-
-	if (fo_gconf == NULL) {
-		const gchar *key;
-
-		fo_gconf = gconf_client_get_default ();
-
-		key = "/desktop/gnome/font_rendering";
-		gconf_client_add_dir (
-			fo_gconf, key, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
-		key = "/desktop/gnome/font_rendering/antialiasing";
-		gconf_client_notify_add (
-			fo_gconf, key, fo_option_changed, NULL, NULL, NULL);
-
-		key = "/desktop/gnome/font_rendering/hinting";
-		gconf_client_notify_add (
-			fo_gconf, key, fo_option_changed, NULL, NULL, NULL);
-
-		key = "/desktop/gnome/font_rendering/rgba_order";
-		gconf_client_notify_add (
-			fo_gconf, key, fo_option_changed, NULL, NULL, NULL);
-
-		fo_option_changed (fo_gconf, 0, NULL, NULL);
-	}
-
-	g_static_mutex_lock (&fo_lock);
-
-	/* Antialiasing */
-	if (fo_antialiasing == NULL)
-		cairo_font_options_set_antialias (
-			font_options, CAIRO_ANTIALIAS_DEFAULT);
-	else if (strcmp (fo_antialiasing, "grayscale") == 0)
-		cairo_font_options_set_antialias (
-			font_options, CAIRO_ANTIALIAS_GRAY);
-	else if (strcmp (fo_antialiasing, "rgba") == 0)
-		cairo_font_options_set_antialias (
-			font_options, CAIRO_ANTIALIAS_SUBPIXEL);
-	else if (strcmp (fo_antialiasing, "none") == 0)
-		cairo_font_options_set_antialias (
-			font_options, CAIRO_ANTIALIAS_NONE);
-	else
-		cairo_font_options_set_antialias (
-			font_options, CAIRO_ANTIALIAS_DEFAULT);
-
-	if (fo_hinting == NULL)
-		cairo_font_options_set_hint_style (
-			font_options, CAIRO_HINT_STYLE_DEFAULT);
-	else if (strcmp (fo_hinting, "full") == 0)
-		cairo_font_options_set_hint_style (
-			font_options, CAIRO_HINT_STYLE_FULL);
-	else if (strcmp (fo_hinting, "medium") == 0)
-		cairo_font_options_set_hint_style (
-			font_options, CAIRO_HINT_STYLE_MEDIUM);
-	else if (strcmp (fo_hinting, "slight") == 0)
-		cairo_font_options_set_hint_style (
-			font_options, CAIRO_HINT_STYLE_SLIGHT);
-	else if (strcmp (fo_hinting, "none") == 0)
-		cairo_font_options_set_hint_style (
-			font_options, CAIRO_HINT_STYLE_NONE);
-	else
-		cairo_font_options_set_hint_style (
-			font_options, CAIRO_HINT_STYLE_DEFAULT);
-
-	if (fo_subpixel_order == NULL)
-		cairo_font_options_set_subpixel_order (
-			font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT);
-	else if (strcmp (fo_subpixel_order, "rgb") == 0)
-		cairo_font_options_set_subpixel_order (
-			font_options, CAIRO_SUBPIXEL_ORDER_RGB);
-	else if (strcmp (fo_subpixel_order, "bgr") == 0)
-		cairo_font_options_set_subpixel_order (
-			font_options, CAIRO_SUBPIXEL_ORDER_BGR);
-	else if (strcmp (fo_subpixel_order, "vrgb") == 0)
-		cairo_font_options_set_subpixel_order (
-			font_options, CAIRO_SUBPIXEL_ORDER_VRGB);
-	else if (strcmp (fo_subpixel_order, "vbgr") == 0)
-		cairo_font_options_set_subpixel_order (
-			font_options, CAIRO_SUBPIXEL_ORDER_VBGR);
-	else
-		cairo_font_options_set_subpixel_order (
-			font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT);
-
-	g_static_mutex_unlock (&fo_lock);
-
-	return font_options;
-}
-
 /* Evolution Locks for crash recovery */
 
 static const gchar *
diff --git a/e-util/e-util.h b/e-util/e-util.h
index e1f6c79..8463fd4 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -127,9 +127,6 @@ gchar *		e_ascii_dtostr			(gchar *buffer,
 						 const gchar *format,
 						 gdouble d);
 
-cairo_font_options_t *
-		get_font_options		(void);
-
 gboolean	e_file_lock_create		(void);
 void		e_file_lock_destroy		(void);
 gboolean	e_file_lock_exists		(void);
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 1683e89..e3d095c 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -499,8 +499,6 @@ build_layout (ECellTextView *text_view, gint row, const gchar *text, gint width)
 	ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
 	PangoAttrList *attrs;
 	PangoLayout *layout;
-	PangoContext *context;
-	cairo_font_options_t *font_options;
 
 	layout = gtk_widget_create_pango_layout (GTK_WIDGET (((GnomeCanvasItem *) ecell_view->e_table_item_view)->canvas), text);
 
@@ -512,13 +510,6 @@ build_layout (ECellTextView *text_view, gint row, const gchar *text, gint width)
 	if (text_view->edit || width <= 0)
 		return layout;
 
-	context = pango_layout_get_context (layout);
-
-	font_options = get_font_options ();
-	pango_cairo_context_set_font_options (context, font_options);
-	cairo_font_options_destroy (font_options);
-	pango_layout_context_changed (layout);
-
 	if (ect->font_name)
 	{
 		PangoFontDescription *desc = NULL, *fixed_desc = NULL;
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 40aedfc..3986033 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -416,8 +416,6 @@ static void
 reset_layout (EText *text)
 {
 	GnomeCanvasItem *item = GNOME_CANVAS_ITEM (text);
-	cairo_font_options_t *font_options;
-	PangoContext *context;
 
 	if (text->layout == NULL) {
 		create_layout (text);
@@ -427,13 +425,6 @@ reset_layout (EText *text)
 
 		style = gtk_widget_get_style (GTK_WIDGET (item->canvas));
 
-		context = pango_layout_get_context (text->layout);
-
-		font_options = get_font_options ();
-		pango_cairo_context_set_font_options (context, font_options);
-		cairo_font_options_destroy (font_options);
-		pango_layout_context_changed (text->layout);
-
 		if (text->font_desc) {
 			pango_font_description_free (text->font_desc);
 		}



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