From 2df26bc7b73e93b6de4b6a6ab0c9a52cafb9bd83 Mon Sep 17 00:00:00 2001 From: Harish Krishnaswamy Date: Sat, 22 Jul 2006 13:04:55 +0000 Subject: Handle cases when the props are undefined. This bug is currently causing 2006-07-22 Harish Krishnaswamy * e-util.c: (get_font_options): Handle cases when the props are undefined. This bug is currently causing Evo to crash as soon as it comes up. svn path=/trunk/; revision=32389 --- e-util/e-util.c | 65 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 28 deletions(-) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 7216f0e8cc..b2c111589d 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1136,41 +1136,50 @@ get_font_options () /* Antialiasing */ antialiasing = gconf_client_get_string (gconf, "/desktop/gnome/font_rendering/antialiasing", NULL); - if (strcmp (antialiasing, "grayscale") == 0) - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY); - else if (strcmp (antialiasing, "rgba") == 0) - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_SUBPIXEL); - else if (strcmp (antialiasing, "none") == 0) - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_NONE); - else + if (antialiasing == NULL) cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_DEFAULT); - + else { + if (strcmp (antialiasing, "grayscale") == 0) + cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY); + else if (strcmp (antialiasing, "rgba") == 0) + cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_SUBPIXEL); + else if (strcmp (antialiasing, "none") == 0) + cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_NONE); + else + cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_DEFAULT); + } hinting = gconf_client_get_string (gconf, "/desktop/gnome/font_rendering/hinting", NULL); - if (strcmp (hinting, "full") == 0) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_FULL); - else if (strcmp (hinting, "medium") == 0) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_MEDIUM); - else if (strcmp (hinting, "slight") == 0) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_SLIGHT); - else if (strcmp (hinting, "none") == 0) - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); - else + if (hinting == NULL) cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_DEFAULT); - + else { + if (strcmp (hinting, "full") == 0) + cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_FULL); + else if (strcmp (hinting, "medium") == 0) + cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_MEDIUM); + else if (strcmp (hinting, "slight") == 0) + cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_SLIGHT); + else if (strcmp (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); + } subpixel_order = gconf_client_get_string (gconf, "/desktop/gnome/font_rendering/rgba_order", NULL); - if (strcmp (subpixel_order, "rgb") == 0) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_RGB); - else if (strcmp (subpixel_order, "bgr") == 0) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_BGR); - else if (strcmp (subpixel_order, "vrgb") == 0) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_VRGB); - else if (strcmp (subpixel_order, "vbgr") == 0) - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_VBGR); - else + if (subpixel_order == NULL) cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT); - + else { + if (strcmp (subpixel_order, "rgb") == 0) + cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_RGB); + else if (strcmp (subpixel_order, "bgr") == 0) + cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_BGR); + else if (strcmp (subpixel_order, "vrgb") == 0) + cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_VRGB); + else if (strcmp (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_object_unref (gconf); return font_options; } -- cgit