diff options
author | Sylvain Pasche <sylvain.pasche@gmail.com> | 2008-01-23 00:00:53 +0100 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2008-08-05 16:30:36 -0400 |
commit | f64cf7fb098e8c9be8a454d4675e6a8b7fd22589 (patch) | |
tree | f1968603ec7ae4f7da2c7be1865e185b9693a948 /src/cairo-xlib-screen.c | |
parent | 28d18f3f936988483a47dd30f55ee2403bc006c3 (diff) |
[cairo-xlib] Support to retrieve the LCD filter type from the Xrm database
Diffstat (limited to 'src/cairo-xlib-screen.c')
-rw-r--r-- | src/cairo-xlib-screen.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c index d7b609a75..c3d2fd7e2 100644 --- a/src/cairo-xlib-screen.c +++ b/src/cairo-xlib-screen.c @@ -148,13 +148,22 @@ _cairo_xlib_init_screen_font_options (Display *dpy, cairo_xlib_screen_info_t *in cairo_bool_t xft_antialias; int xft_hintstyle; int xft_rgba; + int xft_lcdfilter; cairo_antialias_t antialias; cairo_subpixel_order_t subpixel_order; + cairo_lcd_filter_t lcd_filter; cairo_hint_style_t hint_style; if (!get_boolean_default (dpy, "antialias", &xft_antialias)) xft_antialias = TRUE; + if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) { + /* -1 is an non-existant Fontconfig constant used to differentiate + * the case when no lcdfilter property is available. + */ + xft_lcdfilter = -1; + } + if (!get_boolean_default (dpy, "hinting", &xft_hinting)) xft_hinting = TRUE; @@ -237,6 +246,24 @@ _cairo_xlib_init_screen_font_options (Display *dpy, cairo_xlib_screen_info_t *in subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; } + switch (xft_lcdfilter) { + case FC_LCD_NONE: + lcd_filter = CAIRO_LCD_FILTER_NONE; + break; + case FC_LCD_DEFAULT: + lcd_filter = CAIRO_LCD_FILTER_FIR5; + break; + case FC_LCD_LIGHT: + lcd_filter = CAIRO_LCD_FILTER_FIR3; + break; + case FC_LCD_LEGACY: + lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL; + break; + default: + lcd_filter = CAIRO_LCD_FILTER_DEFAULT; + break; + } + if (xft_antialias) { if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) antialias = CAIRO_ANTIALIAS_GRAY; @@ -249,6 +276,7 @@ _cairo_xlib_init_screen_font_options (Display *dpy, cairo_xlib_screen_info_t *in cairo_font_options_set_hint_style (&info->font_options, hint_style); cairo_font_options_set_antialias (&info->font_options, antialias); cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order); + cairo_font_options_set_lcd_filter (&info->font_options, lcd_filter); cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON); } |