From e565138d643f192e7cfa8a38da9e7699ea3c7b22 Mon Sep 17 00:00:00 2001 Message-Id: From: Eric Rannaud Date: Fri, 18 Nov 2011 21:17:29 -0800 Subject: [PATCH 1/1] * include/freetype/ftlcdfil.h, src/base/ftlcdfilt.c: Introduce new LCD filter configuration FT_LCD_FILTER_HEAVY. --- include/freetype/ftlcdfil.h | 12 +++++++++++- src/base/ftlcdfil.c | 10 +++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index 0b55ebe..bf9d25b 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -78,6 +78,14 @@ FT_BEGIN_HEADER * cost of slightly more color fringes than the default one. It might * be better, depending on taste, your monitor, or your personal vision. * + * FT_LCD_FILTER_HEAVY :: + * The heavy filter is a variant that produces a bolder (or "fat") result + * with a little more bluriness than the default filter. It + * sort of corresponds to an important gamma correction and may depart + * significantly from the intended weight of the font. However, you + * may like it better, especially if you want a higher contrast or + * find white text on a dark background to be rendered too lightly. + * * FT_LCD_FILTER_LEGACY :: * This filter corresponds to the original libXft color filter. It * provides high contrast output but can exhibit really bad color @@ -96,6 +104,7 @@ FT_BEGIN_HEADER FT_LCD_FILTER_NONE = 0, FT_LCD_FILTER_DEFAULT = 1, FT_LCD_FILTER_LIGHT = 2, + FT_LCD_FILTER_HEAVY = 3, FT_LCD_FILTER_LEGACY = 16, FT_LCD_FILTER_MAX /* do not remove */ @@ -172,7 +181,8 @@ FT_BEGIN_HEADER * @FT_Library_SetLcdFilter. By default, FreeType uses the quintuple * (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10, * 0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and - * FT_LCD_FILTER_LEGACY. + * FT_LCD_FILTER_LEGACY, and (0x40, 0x80, 0x90, 0x80, 0x40) for + * FT_LCD_FILTER_HEAVY. * * @input: * library :: diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 0da4ba1..872961b 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -289,7 +289,9 @@ /* providing a cheap gamma correction */ static const FT_Byte default_filter[5] = { 0x10, 0x40, 0x70, 0x40, 0x10 }; - + /* idem */ + static const FT_Byte heavy_filter[5] = + { 0x40, 0x80, 0x90, 0x80, 0x40 }; if ( !library ) return FT_Err_Invalid_Argument; @@ -323,6 +325,12 @@ break; + case FT_LCD_FILTER_HEAVY: + ft_memcpy( library->lcd_weights, heavy_filter, 5 ); + library->lcd_filter_func = _ft_lcd_filter_fir; + library->lcd_extra = 2; + break; + case FT_LCD_FILTER_LIGHT: ft_memcpy( library->lcd_weights, light_filter, 5 ); library->lcd_filter_func = _ft_lcd_filter_fir; -- 1.7.6.4