Unfortunately, this patch can't solve bug #41639. FT_LOAD_TARGET_MONO works correctly only in Freetype 2.8.1+, but bug #41639 is about Freetype 2.7. http://lists.nongnu.org/archive/html/freetype/2017-09/msg00032.html
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/truetype/tt...
In Freetype's truetype interpreter version 40, The hdmx table and modifications to phantom points are ignored. Only FT_LOAD_TARGET_MONO applies v35 internally (Freetype 2.8.1+).
If bug 41639 is not 'WONTFIX', there is no solution other than how to use v35( with FT_Property_Set). In my old patch, I used v35 selectively using the gasp table version. Another solution is to decide by the presence of the hdmx table. This seems to be a better way to determine the problematic font in v40.
http://lists.nongnu.org/archive/html/freetype/2018-11/msg00012.html Without FT_Property_Set, adding some flag to FT_Load_Glyph seems to be a good solution. But it can't solve bug #41639.
Even if we do not consider bug # 41639, now Wine GDI has a problem using the wrong advance value for MS legacy fonts( with hdmx table) at the v40.
Please comment.
PS. The v35 can be misunderstood by its name, but it is a separate hinting engine with different purposes. http://lists.nongnu.org/archive/html/freetype/2017-09/msg00036.html
On Tue, 13 Nov 2018 15:01:57 -0600, Alexandre Julliard julliard@winehq.org wrote:
Module: wine Branch: master Commit: 7da7930a10f22cf186e9454fec2807d75f239fad URL: https://source.winehq.org/git/wine.git/?a=commit;h=7da7930a10f22cf186e9454fe...
Author: Byeongsik Jeon bsjeon@hanmail.net Date: Tue Nov 13 09:27:09 2018 +0000
gdi32: Specify the suitable hinting flags explicitly.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41639 Signed-off-by: Byeongsik Jeon bsjeon@hanmail.net Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
dlls/gdi32/freetype.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index b62288c..99b7d8c 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -6801,6 +6801,37 @@ static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int b return needed; }
+static FT_Int get_load_flags( UINT format ) +{
- FT_Int load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
- if (format & GGO_UNHINTED)
return load_flags | FT_LOAD_NO_HINTING;
- switch (format & ~GGO_GLYPH_INDEX)
- {
- case GGO_BITMAP:
load_flags |= FT_LOAD_TARGET_MONO;
break;
- case GGO_GRAY2_BITMAP:
- case GGO_GRAY4_BITMAP:
- case GGO_GRAY8_BITMAP:
- case WINE_GGO_GRAY16_BITMAP:
load_flags |= FT_LOAD_TARGET_NORMAL;
break;
- case WINE_GGO_HRGB_BITMAP:
- case WINE_GGO_HBGR_BITMAP:
load_flags |= FT_LOAD_TARGET_LCD;
break;
- case WINE_GGO_VRGB_BITMAP:
- case WINE_GGO_VBGR_BITMAP:
load_flags |= FT_LOAD_TARGET_LCD_V;
break;
- }
- return load_flags;
+}
static const BYTE masks[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, @@ -6820,7 +6851,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, FT_Vector adv; INT origin_x = 0, origin_y = 0; FT_Angle angle = 0;
- FT_Int load_flags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
- FT_Int load_flags = get_load_flags(format); double widthRatio = 1.0; FT_Matrix transMat = identityMat; FT_Matrix transMatUnrotated;
@@ -6859,10 +6890,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, tategaki = check_unicode_tategaki(glyph); }
- if(format & GGO_UNHINTED) {
load_flags |= FT_LOAD_NO_HINTING;
format &= ~GGO_UNHINTED;
- }
format &= ~GGO_UNHINTED;
if(original_index >= font->gmsize * GM_BLOCK_SIZE) { font->gmsize = (original_index / GM_BLOCK_SIZE + 1);