diff options
-rw-r--r-- | e-util/ChangeLog | 4 | ||||
-rw-r--r-- | e-util/e-util.c | 51 | ||||
-rw-r--r-- | e-util/e-util.h | 1 |
3 files changed, 56 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index e3a2fffeac..863ca97098 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,7 @@ +2006-07-20 Rajeev ramanathan <rajeevramanathan_2004@yahoo.co.in> + + * e-util.[ch]: (get_font_options): Added code to get font options. + 2006-06-15 Tor Lillqvist <tml@novell.com> * e-plugin.c (ep_construct): On Win32, if the compile-time diff --git a/e-util/e-util.c b/e-util/e-util.c index 4415961c2b..7216f0e8cc 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1125,3 +1125,54 @@ e_gettext (const char *msgid) return dgettext (E_I18N_DOMAIN, msgid); } + +cairo_font_options_t * +get_font_options () +{ + char *antialiasing, *hinting, *subpixel_order; + GConfClient *gconf = gconf_client_get_default (); + cairo_font_options_t *font_options = cairo_font_options_create (); + + /* 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 + 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 + 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 + cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT); + + g_object_unref (gconf); + return font_options; +} + + diff --git a/e-util/e-util.h b/e-util/e-util.h index 559a1a1ee7..0346a9fc2f 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -27,6 +27,7 @@ #include <sys/types.h> #include <glib-object.h> #include <limits.h> +#include <gconf/gconf-client.h> #ifdef __cplusplus extern "C" { |