Commit 32760d33d0ebc3ba756d2bc0cce1defdafe51299

Alexei Podtelezhnikov 2016-01-14T23:31:08

[base] Empower `FT_Library_SetLcdFilterWeights'. * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): Enable filter in addition to setting weights. (FT_Library_SetLcdFilter): Clean out FT_FORCE_LIGHT_LCD_FILTER and FT_FORCE_LEGACY_LCD_FILTER. * include/freetype/ftlcdfil.h: Documentation update.

diff --git a/ChangeLog b/ChangeLog
index efa9c75..2f83095 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-01-14  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[base] Empower `FT_Library_SetLcdFilterWeights'.
+
+	* src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): Enable filter
+	in addition to setting weights.
+	(FT_Library_SetLcdFilter): Clean out FT_FORCE_LIGHT_LCD_FILTER and
+	FT_FORCE_LEGACY_LCD_FILTER.
+	* include/freetype/ftlcdfil.h: Documentation update.
+
 2016-01-12  Werner Lemberg  <wl@gnu.org>
 
 	Don't use macro names that start with `_[A-Z]' [3/3].
diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h
index 3e9f580..95d4023 100644
--- a/include/freetype/ftlcdfil.h
+++ b/include/freetype/ftlcdfil.h
@@ -250,8 +250,8 @@ FT_BEGIN_HEADER
    *   FT_Library_SetLcdFilterWeights
    *
    * @description:
-   *   Use this function to override default or light filter weights
-   *   selected by @FT_Library_SetLcdFilter.
+   *   This function can be used to enable LCD filter with custom weights,
+   *   instead of using presets in @FT_Library_SetLcdFilter.
    *
    * @input:
    *   library ::
@@ -271,9 +271,6 @@ FT_BEGIN_HEADER
    *   defined in your build of the library, which should correspond to all
    *   default builds of FreeType.
    *
-   *   This function must be called after @FT_Library_SetLcdFilter to have
-   *   any effect on default or light filter.
-   *
    * @since:
    *   2.4.0
    */
diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c
index b2f35dc..8bcbed7 100644
--- a/src/base/ftlcdfil.c
+++ b/src/base/ftlcdfil.c
@@ -296,6 +296,8 @@
       return FT_THROW( Invalid_Argument );
 
     ft_memcpy( library->lcd_weights, weights, 5 );
+    library->lcd_filter_func = _ft_lcd_filter_fir;
+    library->lcd_extra       = 2;
 
     return FT_Err_Ok;
   }
@@ -322,25 +324,9 @@
       break;
 
     case FT_LCD_FILTER_DEFAULT:
-#if defined( FT_FORCE_LEGACY_LCD_FILTER )
-
-      library->lcd_filter_func = _ft_lcd_filter_legacy;
-      library->lcd_extra       = 0;
-
-#elif defined( FT_FORCE_LIGHT_LCD_FILTER )
-
-      ft_memcpy( library->lcd_weights, light_filter, 5 );
-      library->lcd_filter_func = _ft_lcd_filter_fir;
-      library->lcd_extra       = 2;
-
-#else
-
       ft_memcpy( library->lcd_weights, default_filter, 5 );
       library->lcd_filter_func = _ft_lcd_filter_fir;
       library->lcd_extra       = 2;
-
-#endif
-
       break;
 
     case FT_LCD_FILTER_LIGHT: