aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-17 01:08:04 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-17 01:40:26 +0800
commitd88a9e736052357389f77a1e8e25221a1517ca72 (patch)
treecc62ca5424dd4b09b4859173029b1943cb7a11fa
parent58d7fa132943d72d17d26f8130c6a0e48011f8b6 (diff)
downloadgsoc2013-evolution-d88a9e736052357389f77a1e8e25221a1517ca72.tar.gz
gsoc2013-evolution-d88a9e736052357389f77a1e8e25221a1517ca72.tar.zst
gsoc2013-evolution-d88a9e736052357389f77a1e8e25221a1517ca72.zip
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.
-rw-r--r--calendar/gui/e-day-view-main-item.c8
-rw-r--r--e-util/e-util.c123
-rw-r--r--e-util/e-util.h3
-rw-r--r--widgets/table/e-cell-text.c9
-rw-r--r--widgets/text/e-text.c9
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 5f8ef0d61b..98ce4ff335 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 427f479e01..b7dd93aa15 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 e1f6c792e4..8463fd4a7b 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 1683e896f0..e3d095cc34 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 40aedfc735..3986033c75 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);
}