gdi32: Allocate the backend font data in the load_font() helper.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-10-27 14:25:32 +01:00
parent 0bf2c11d43
commit 5772b064ac
3 changed files with 6 additions and 20 deletions

View File

@ -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;
}

View File

@ -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,

View File

@ -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 );