dwrite: Fix outline translation before rendering
Nikolay Sivov
nsivov at codeweavers.com
Sun Aug 2 15:55:20 CDT 2015
https://bugs.winehq.org/show_bug.cgi?id=39015
-------------- next part --------------
>From 2049fdf9ae526d6196b3e71096a03908007e4fee Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun, 2 Aug 2015 23:47:24 +0300
Subject: [PATCH] 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, ©) == 0) {
+ pFT_Outline_Copy(src, ©);
+ pFT_Outline_Translate(©, -bbox->left << 6, bbox->bottom << 6);
+ pFT_Outline_Get_Bitmap(library, ©, &ft_bitmap);
+ pFT_Outline_Done(library, ©);
+ }
}
else if (glyph->format == FT_GLYPH_FORMAT_BITMAP) {
FT_Bitmap *bitmap = &((FT_BitmapGlyph)glyph)->bitmap;
--
2.1.4
More information about the wine-patches
mailing list