[PATCH 1/2] gdi32: Support the subpixel rendering for FreeType >= 2.8.1 .

Nikolay Sivov nsivov at codeweavers.com
Fri Oct 5 01:39:53 CDT 2018


On 10/04/2018 03:17 PM, Byeongsik Jeon wrote:

> FreeType >= 2.8.1 support LCD-optimized rendering without LCD filters.
> It works regardless of FT_Err_Unimplemented_Feature check.
>
> Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
> ---
>   dlls/gdi32/freetype.c | 25 ++++++++++++++-----------
>   1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
> index b7e2413753..468c1951b6 100644
> --- a/dlls/gdi32/freetype.c
> +++ b/dlls/gdi32/freetype.c
> @@ -993,18 +993,22 @@ static BOOL is_hinting_enabled(void)
>   
>   static BOOL is_subpixel_rendering_enabled( void )
>   {
> -#ifdef FT_LCD_FILTER_H
>       static int enabled = -1;
>       if (enabled == -1)
>       {
> -        enabled = (pFT_Library_SetLcdFilter &&
> -                   pFT_Library_SetLcdFilter( NULL, 0 ) != FT_Err_Unimplemented_Feature);
> +        /* FreeType >= 2.8.1 offers LCD-optimezed rendering without lcd filters. */
> +        if ( FT_SimpleVersion >= ((2 << 16) | (8 << 8) | (1 << 0)))
> +            enabled = TRUE;
> +#ifdef FT_LCD_FILTER_H
> +        else if ( pFT_Library_SetLcdFilter &&
> +                  pFT_Library_SetLcdFilter( NULL, 0 ) != FT_Err_Unimplemented_Feature )
> +            enabled = TRUE;
> +#endif
> +        else enabled = FALSE;
> +
>           TRACE("subpixel rendering is %senabled\n", enabled ? "" : "NOT ");
>       }
>       return enabled;
> -#else
> -    return FALSE;
> -#endif
>   }
>   

Could you explain why does this make a difference? I'd expect 
FT_Library_SetLcdFilter to be still functional in 2.8.1+, also how is 
this new rendering mode is enabled?
>   
> @@ -7274,7 +7278,6 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
>       case WINE_GGO_HBGR_BITMAP:
>       case WINE_GGO_VRGB_BITMAP:
>       case WINE_GGO_VBGR_BITMAP:
> -#ifdef FT_LCD_FILTER_H
>         {
>           switch (ft_face->glyph->format)
>           {
> @@ -7360,8 +7363,11 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
>               if ( needsTransform )
>                   pFT_Outline_Transform (&ft_face->glyph->outline, &transMatTategaki);
>   
> -            if ( pFT_Library_SetLcdFilter )
> +#ifdef FT_LCD_FILTER_H
> +            if ( FT_SimpleVersion < ((2 << 16) | (8 << 8) | (1 << 0)) &&
> +                 pFT_Library_SetLcdFilter )
>                   pFT_Library_SetLcdFilter( library, FT_LCD_FILTER_DEFAULT );
> +#endif
>               pFT_Render_Glyph (ft_face->glyph, render_mode);
>   
>               src = ft_face->glyph->bitmap.buffer;
> @@ -7442,9 +7448,6 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
>   
>           break;
>         }
> -#else
> -      return GDI_ERROR;
> -#endif
>   
>       case GGO_NATIVE:
>         {




More information about the wine-devel mailing list