shithub: freetype+ttf2subf

Download patch

ref: 32760d33d0ebc3ba756d2bc0cce1defdafe51299
parent: 441506656fbc070234fd1de08629d13a3e60737c
author: Alexei Podtelezhnikov <apodtele@gmail.com>
date: Thu Jan 14 18:31:08 EST 2016

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- 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].
--- a/include/freetype/ftlcdfil.h
+++ b/include/freetype/ftlcdfil.h
@@ -250,8 +250,8 @@
    *   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 ::
@@ -270,9 +270,6 @@
    *   configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
    *   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
--- 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:
--