[evolution/gnome-3-0] Bug 649990 - Remove get_font_options() from e-util.c.



commit 036ba497a3804e53c59773a46e32f836295f67df
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 5e247a2..e343898 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 5fdfed9..ad8b3c5 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -1235,129 +1235,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 554c930..b7ba6c5 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -128,9 +128,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 310b36c..1445f2a 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 9801132..59d244f 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -413,8 +413,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);
@@ -424,13 +422,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]