mirror of
https://gitlab.freedesktop.org/freetype/freetype.git
synced 2026-05-02 01:38:06 +02:00
[base, smooth] Remove LCD filter from face properties.
This removes the internal face property that sets the filtering weights. The global filtering algorithms and weights are now optimized to work well under all conditions. * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Do it. * include/freetype/freetype.h (FT_Face_Properties): Revised docs. * include/freetype/ftparams.h (FT_PARAM_TAG_LCD_FILTER_WEIGHTS): Ditto. * src/base/ftlcdfil.c (ft_lcd_padding): Updated. * src/base/ftobjs.c (ft_open_face_internal, FT_Face_Properties): Ditto. * src/smooth/ftsmooth.c (ft_smooth_render): Ditto. * docs/CHANGES: Updated.
This commit is contained in:
parent
084bf2898b
commit
e8f0969dcf
7 changed files with 17 additions and 68 deletions
|
|
@ -5,6 +5,10 @@ CHANGES BETWEEN 2.14.1 and 2.14.2 (2026-Mmm-DD)
|
|||
- Several changes related to LCD filtering are implemented to
|
||||
achieve better performance and encourage sound practices.
|
||||
|
||||
. Setting the filter weights with FT_Face_Properties is no longer
|
||||
supported. The default and light filters are optimized to work
|
||||
with any face.
|
||||
|
||||
. The legacy libXft LCD filter algorithm is no longer provided.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4318,14 +4318,13 @@ FT_BEGIN_HEADER
|
|||
* property `no-stem-darkening` provided by the 'autofit', 'cff',
|
||||
* 'type1', and 't1cid' modules; see @no-stem-darkening).
|
||||
*
|
||||
* * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding
|
||||
* to function @FT_Library_SetLcdFilterWeights).
|
||||
*
|
||||
* * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID
|
||||
* 'random' operator, corresponding to the `random-seed` property
|
||||
* provided by the 'cff', 'type1', and 't1cid' modules; see
|
||||
* @random-seed).
|
||||
*
|
||||
* * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (no longer supported).
|
||||
*
|
||||
* Pass `NULL` as `data` in @FT_Parameter for a given tag to reset the
|
||||
* option and use the library or module default again.
|
||||
*
|
||||
|
|
@ -4352,25 +4351,17 @@ FT_BEGIN_HEADER
|
|||
* FT_Bool darken_stems = 1;
|
||||
*
|
||||
* FT_Parameter property2;
|
||||
* FT_LcdFiveTapFilter custom_weight =
|
||||
* { 0x11, 0x44, 0x56, 0x44, 0x11 };
|
||||
*
|
||||
* FT_Parameter property3;
|
||||
* FT_Int32 random_seed = 314159265;
|
||||
*
|
||||
* FT_Parameter properties[3] = { property1,
|
||||
* property2,
|
||||
* property3 };
|
||||
* FT_Parameter properties[2] = { property1,
|
||||
* property2 };
|
||||
*
|
||||
*
|
||||
* property1.tag = FT_PARAM_TAG_STEM_DARKENING;
|
||||
* property1.data = &darken_stems;
|
||||
*
|
||||
* property2.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS;
|
||||
* property2.data = custom_weight;
|
||||
*
|
||||
* property3.tag = FT_PARAM_TAG_RANDOM_SEED;
|
||||
* property3.data = &random_seed;
|
||||
* property2.tag = FT_PARAM_TAG_RANDOM_SEED;
|
||||
* property2.data = &random_seed;
|
||||
*
|
||||
* FT_Face_Properties( face, 3, properties );
|
||||
* ```
|
||||
|
|
@ -4381,7 +4372,7 @@ FT_BEGIN_HEADER
|
|||
* FT_Parameter property;
|
||||
*
|
||||
*
|
||||
* property.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS;
|
||||
* property.tag = FT_PARAM_TAG_STEM_DARKENING;
|
||||
* property.data = NULL;
|
||||
*
|
||||
* FT_Face_Properties( face, 1, &property );
|
||||
|
|
|
|||
|
|
@ -133,11 +133,8 @@ FT_BEGIN_HEADER
|
|||
* FT_PARAM_TAG_LCD_FILTER_WEIGHTS
|
||||
*
|
||||
* @description:
|
||||
* An @FT_Parameter tag to be used with @FT_Face_Properties. The
|
||||
* corresponding argument specifies the five LCD filter weights for a
|
||||
* given face (if using @FT_LOAD_TARGET_LCD, for example), overriding the
|
||||
* global default values or the values set up with
|
||||
* @FT_Library_SetLcdFilterWeights.
|
||||
* Overriding global LCD filter weights with custom values for a given
|
||||
* face is no longer supported and ignored.
|
||||
*
|
||||
* @since:
|
||||
* 2.8
|
||||
|
|
|
|||
|
|
@ -365,11 +365,6 @@ FT_BEGIN_HEADER
|
|||
* Value~0 means to use the font's value. Value~-1 means to use the
|
||||
* CFF driver's default.
|
||||
*
|
||||
* lcd_weights ::
|
||||
* lcd_filter_func ::
|
||||
* These fields specify the LCD filtering weights and callback function
|
||||
* for ClearType-style subpixel rendering.
|
||||
*
|
||||
* refcount ::
|
||||
* A counter initialized to~1 at the time an @FT_Face structure is
|
||||
* created. @FT_Reference_Face increments this counter, and
|
||||
|
|
@ -391,11 +386,6 @@ FT_BEGIN_HEADER
|
|||
FT_Char no_stem_darkening;
|
||||
FT_Int32 random_seed;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||
FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
|
||||
FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
|
||||
#endif
|
||||
|
||||
FT_Int refcount;
|
||||
|
||||
} FT_Face_InternalRec;
|
||||
|
|
|
|||
|
|
@ -38,17 +38,8 @@
|
|||
FT_Bitmap_LcdFilterFunc lcd_filter_func;
|
||||
|
||||
|
||||
/* Per-face LCD filtering takes priority if set up. */
|
||||
if ( slot->face && slot->face->internal->lcd_filter_func )
|
||||
{
|
||||
lcd_weights = slot->face->internal->lcd_weights;
|
||||
lcd_filter_func = slot->face->internal->lcd_filter_func;
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_weights = slot->library->lcd_weights;
|
||||
lcd_filter_func = slot->library->lcd_filter_func;
|
||||
}
|
||||
lcd_weights = slot->library->lcd_weights;
|
||||
lcd_filter_func = slot->library->lcd_filter_func;
|
||||
|
||||
if ( lcd_filter_func == ft_lcd_filter_fir )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2817,11 +2817,6 @@
|
|||
internal->refcount = 1;
|
||||
|
||||
internal->no_stem_darkening = -1;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||
/* Per-face filtering can only be set up by FT_Face_Properties */
|
||||
internal->lcd_filter_func = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( aface )
|
||||
|
|
@ -4051,18 +4046,8 @@
|
|||
}
|
||||
else if ( properties->tag == FT_PARAM_TAG_LCD_FILTER_WEIGHTS )
|
||||
{
|
||||
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||
if ( properties->data )
|
||||
{
|
||||
ft_memcpy( face->internal->lcd_weights,
|
||||
properties->data,
|
||||
FT_LCD_FILTER_FIVE_TAPS );
|
||||
face->internal->lcd_filter_func = ft_lcd_filter_fir;
|
||||
}
|
||||
#else
|
||||
error = FT_THROW( Unimplemented_Feature );
|
||||
goto Exit;
|
||||
#endif
|
||||
}
|
||||
else if ( properties->tag == FT_PARAM_TAG_RANDOM_SEED )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -530,17 +530,8 @@
|
|||
FT_Bitmap_LcdFilterFunc lcd_filter_func;
|
||||
|
||||
|
||||
/* Per-face LCD filtering takes priority if set up. */
|
||||
if ( slot->face && slot->face->internal->lcd_filter_func )
|
||||
{
|
||||
lcd_weights = slot->face->internal->lcd_weights;
|
||||
lcd_filter_func = slot->face->internal->lcd_filter_func;
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_weights = slot->library->lcd_weights;
|
||||
lcd_filter_func = slot->library->lcd_filter_func;
|
||||
}
|
||||
lcd_weights = slot->library->lcd_weights;
|
||||
lcd_filter_func = slot->library->lcd_filter_func;
|
||||
|
||||
if ( lcd_filter_func )
|
||||
lcd_filter_func( bitmap, lcd_weights );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue