Nikolay Sivov : dwrite: Fix outline translation before rendering.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 3 14:52:35 CDT 2015


Module: wine
Branch: master
Commit: dc75b34ddf2cc5601676dabe40f64d76cd985145
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dc75b34ddf2cc5601676dabe40f64d76cd985145

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Aug  2 23:47:24 2015 +0300

dwrite: Fix outline translation before rendering.

---

 dlls/dwrite/freetype.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c
index 711d601..2c02b26 100644
--- a/dlls/dwrite/freetype.c
+++ b/dlls/dwrite/freetype.c
@@ -70,7 +70,10 @@ MAKE_FUNCPTR(FT_Init_FreeType);
 MAKE_FUNCPTR(FT_Library_Version);
 MAKE_FUNCPTR(FT_Load_Glyph);
 MAKE_FUNCPTR(FT_New_Memory_Face);
+MAKE_FUNCPTR(FT_Outline_Copy);
+MAKE_FUNCPTR(FT_Outline_Done);
 MAKE_FUNCPTR(FT_Outline_Get_Bitmap);
+MAKE_FUNCPTR(FT_Outline_New);
 MAKE_FUNCPTR(FT_Outline_Transform);
 MAKE_FUNCPTR(FT_Outline_Translate);
 MAKE_FUNCPTR(FTC_CMapCache_Lookup);
@@ -148,7 +151,10 @@ BOOL init_freetype(void)
     LOAD_FUNCPTR(FT_Library_Version)
     LOAD_FUNCPTR(FT_Load_Glyph)
     LOAD_FUNCPTR(FT_New_Memory_Face)
+    LOAD_FUNCPTR(FT_Outline_Copy)
+    LOAD_FUNCPTR(FT_Outline_Done)
     LOAD_FUNCPTR(FT_Outline_Get_Bitmap)
+    LOAD_FUNCPTR(FT_Outline_New)
     LOAD_FUNCPTR(FT_Outline_Transform)
     LOAD_FUNCPTR(FT_Outline_Translate)
     LOAD_FUNCPTR(FTC_CMapCache_Lookup)
@@ -509,8 +515,9 @@ void freetype_get_glyph_bitmap(IDWriteFontFace2 *fontface, FLOAT emSize, UINT16
 
         if (glyph->format == FT_GLYPH_FORMAT_OUTLINE) {
             FT_OutlineGlyph outline = (FT_OutlineGlyph)glyph;
-
+            const FT_Outline *src = &outline->outline;
             FT_Bitmap ft_bitmap;
+            FT_Outline copy;
 
             ft_bitmap.width = width;
             ft_bitmap.rows = height;
@@ -518,11 +525,14 @@ void freetype_get_glyph_bitmap(IDWriteFontFace2 *fontface, FLOAT emSize, UINT16
             ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
             ft_bitmap.buffer = buf;
 
-            pFT_Outline_Translate(&outline->outline, -bbox->left, -bbox->bottom);
-
             /* Note: FreeType will only set 'black' bits for us. */
             memset(buf, 0, height*pitch);
-            pFT_Outline_Get_Bitmap(library, &outline->outline, &ft_bitmap);
+            if (pFT_Outline_New(library, src->n_points, src->n_contours, &copy) == 0) {
+                pFT_Outline_Copy(src, &copy);
+                pFT_Outline_Translate(&copy, -bbox->left << 6, bbox->bottom << 6);
+                pFT_Outline_Get_Bitmap(library, &copy, &ft_bitmap);
+                pFT_Outline_Done(library, &copy);
+            }
         }
         else if (glyph->format == FT_GLYPH_FORMAT_BITMAP) {
             FT_Bitmap *bitmap = &((FT_BitmapGlyph)glyph)->bitmap;




More information about the wine-cvs mailing list