Module: wine Branch: master Commit: 5772b064ac0194f784640f79701e384a1ffbeb3a URL: https://source.winehq.org/git/wine.git/?a=commit;h=5772b064ac0194f784640f797...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Oct 27 14:25:32 2020 +0100
gdi32: Allocate the backend font data in the load_font() helper.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdi32/font.c | 5 ----- dlls/gdi32/freetype.c | 20 ++++++-------------- dlls/gdi32/gdi_private.h | 1 - 3 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 4e1c69d886e..02cd618f956 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -487,11 +487,6 @@ struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_ HeapFree( GetProcessHeap(), 0, font ); return NULL; } - if (font_funcs && !font_funcs->alloc_font( font )) - { - free_gdi_font( font ); - return NULL; - } return font; }
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index b4764d1e8c9..d941fb18bf6 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -3666,18 +3666,6 @@ static UINT get_nearest_charset(const WCHAR *family_name, Face *face, UINT *cp) return DEFAULT_CHARSET; }
-/************************************************************* - * freetype_alloc_font - */ -static BOOL CDECL freetype_alloc_font( struct gdi_font *font ) -{ - GdiFont *ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)); - list_init(&ret->child_fonts); - ret->gdi_font = font; - font->private = ret; - return TRUE; -} - /************************************************************* * freetype_destroy_font */ @@ -4325,12 +4313,17 @@ static DWORD get_ttc_offset( FT_Face ft_face, UINT face_index )
static BOOL load_font( struct gdi_font *gdi_font ) { - GdiFont *font = get_font_ptr( gdi_font ); + GdiFont *font; INT width = 0, height; FT_Face ft_face; void *data_ptr; SIZE_T data_size;
+ if (!(font = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*font) ))) return FALSE; + gdi_font->private = font; + font->gdi_font = gdi_font; + list_init( &font->child_fonts ); + if (gdi_font->file[0]) { char *filename = wine_get_unix_file_name( gdi_font->file ); @@ -7294,7 +7287,6 @@ static const struct font_backend_funcs font_funcs = freetype_add_font, freetype_add_mem_font, freetype_remove_font, - freetype_alloc_font, freetype_get_font_data, freetype_get_glyph_index, freetype_get_default_glyph, diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index aa6e6ddcaa9..32d50935308 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -376,7 +376,6 @@ struct font_backend_funcs INT (CDECL *add_mem_font)( void *ptr, SIZE_T size, DWORD flags ); BOOL (CDECL *remove_font)( const WCHAR *file, DWORD flags );
- BOOL (CDECL *alloc_font)( struct gdi_font *font ); DWORD (CDECL *get_font_data)( struct gdi_font *gdi_font, DWORD table, DWORD offset, void *buf, DWORD count ); BOOL (CDECL *get_glyph_index)( struct gdi_font *gdi_font, UINT *glyph );