[PATCH 2/3] gdi32: Add the workaround for Freetype<2.8.1 V40 FT_LOAD_TARGET_MONO problem.

Byeongsik Jeon bsjeon at hanmail.net
Fri Jan 25 02:13:38 CST 2019


Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=41639
--
Freetype<2.8.1 V40 has the wrong advance width issue, the wrong rendering issue.
This workaround is required for the Linux distribution that contains the old
version of Freetype.

These two patches help Wine resolve issues caused by fragmentation of Freetype
version and build option.

I didn't mean to, but this patch also solves the wine-bug#41639.
This is the patch on the init_freetype(). It's not relevant to my old patch
using the gasp table.

Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
---
 dlls/gdi32/freetype.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 85cff28c22..3786b5dbdf 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -169,6 +169,7 @@ static FT_TrueTypeEngineType (*pFT_Get_TrueType_Engine_Type)(FT_Library);
 #ifdef FT_LCD_FILTER_H
 static FT_Error (*pFT_Library_SetLcdFilter)(FT_Library, FT_LcdFilter);
 #endif
+static FT_Error (*pFT_Property_Set)(FT_Library, const FT_String *, const FT_String *, const void *);
 
 #ifdef SONAME_LIBFONTCONFIG
 #include <fontconfig/fontconfig.h>
@@ -4161,6 +4162,7 @@ static BOOL init_freetype(void)
 #ifdef FT_LCD_FILTER_H
     pFT_Library_SetLcdFilter = wine_dlsym(ft_handle, "FT_Library_SetLcdFilter", NULL, 0);
 #endif
+    pFT_Property_Set = wine_dlsym(ft_handle, "FT_Property_Set", NULL, 0);
 
     if(pFT_Init_FreeType(&library) != 0) {
         ERR("Can't init FreeType library\n");
@@ -4175,6 +4177,13 @@ static BOOL init_freetype(void)
                        ((FT_Version.minor <<  8) & 0x00ff00) |
                        ((FT_Version.patch      ) & 0x0000ff);
 
+    /* Freetype(<2.8.1) V40's FT_LOAD_TARGET_MONO is not compatible with advance width. */
+    if (pFT_Property_Set && FT_SimpleVersion < ((2 << 16) | (8 << 8) | (1 << 0)))
+    {
+        FT_UInt interpreter_version = 35;
+        pFT_Property_Set( library, "truetype", "interpreter-version", &interpreter_version );
+    }
+
     font_driver = &freetype_funcs;
     return TRUE;
 
-- 
2.20.1




More information about the wine-devel mailing list