diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-07-20 15:51:51 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-07-20 15:51:51 +0800 |
commit | 35a3b3e69964df852a4a649336fe473a42da491c (patch) | |
tree | 8d2dfcd0de4dedf7e393aae546c8755eb4f77d76 /e-util | |
parent | 281a1b94af981d5cb9a69d3b6e2e616e031f9a73 (diff) | |
download | gsoc2013-evolution-35a3b3e69964df852a4a649336fe473a42da491c.tar gsoc2013-evolution-35a3b3e69964df852a4a649336fe473a42da491c.tar.gz gsoc2013-evolution-35a3b3e69964df852a4a649336fe473a42da491c.tar.bz2 gsoc2013-evolution-35a3b3e69964df852a4a649336fe473a42da491c.tar.lz gsoc2013-evolution-35a3b3e69964df852a4a649336fe473a42da491c.tar.xz gsoc2013-evolution-35a3b3e69964df852a4a649336fe473a42da491c.tar.zst gsoc2013-evolution-35a3b3e69964df852a4a649336fe473a42da491c.zip |
Added code to read font options.
svn path=/trunk/; revision=32358
Diffstat (limited to 'e-util')
-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" { |