[PATCH] gdi32: Add the workaround for Freetype<2.8.1 v40 FT_LOAD_TARGET_MONO issue.

Byeongsik Jeon bsjeon at hanmail.net
Tue Feb 12 08:05:43 CST 2019


Freetype<2.8.1 v40 has the wrong advance width issue and wrong rendering issue.
This workaround is required for the Linux distribution that contains the old
version of Freetype.

I was trying to submit it together because it was related to other FreeType
issues. However, since this patch alone is meaningful, I submit it separately.

Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=41639
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 be0e5424f1..8d151ab397 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -170,6 +170,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>
@@ -4162,6 +4163,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");
@@ -4176,6 +4178,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 < FT_VERSION_VALUE(2, 8, 1))
+    {
+        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