[PATCH v4] gdi32: Specify the suitable hinting flags explicitly.

Byeongsik Jeon bsjeon at hanmail.net
Tue Nov 13 02:47:50 CST 2018


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41639
Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
---
v4: make a helper function.
Because of the GGO_UNHINTED bit, slightly changed from the comment.

 dlls/gdi32/freetype.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index b62288c453..415aabedf1 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6801,6 +6801,34 @@ static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int b
     return needed;
 }
 
+static FT_Int get_hinting_flags( UINT format )
+{
+    FT_Int hinting_flags = 0;
+
+    switch (format)
+    {
+    case GGO_BITMAP:
+        hinting_flags = FT_LOAD_TARGET_MONO;
+        break;
+    case GGO_GRAY2_BITMAP:
+    case GGO_GRAY4_BITMAP:
+    case GGO_GRAY8_BITMAP:
+    case WINE_GGO_GRAY16_BITMAP:
+        hinting_flags = FT_LOAD_TARGET_NORMAL;
+        break;
+    case WINE_GGO_HRGB_BITMAP:
+    case WINE_GGO_HBGR_BITMAP:
+        hinting_flags = FT_LOAD_TARGET_LCD;
+        break;
+    case WINE_GGO_VRGB_BITMAP:
+    case WINE_GGO_VBGR_BITMAP:
+        hinting_flags = FT_LOAD_TARGET_LCD_V;
+        break;
+    }
+
+    return hinting_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,
@@ -6863,6 +6891,8 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
         load_flags |= FT_LOAD_NO_HINTING;
         format &= ~GGO_UNHINTED;
     }
+    else
+        load_flags |= get_hinting_flags( format );
 
     if(original_index >= font->gmsize * GM_BLOCK_SIZE) {
 	font->gmsize = (original_index / GM_BLOCK_SIZE + 1);
-- 
2.19.1




More information about the wine-devel mailing list