Commit 54bdbd3c authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Store child font objects directly on the child font list.

parent 86315062
......@@ -473,6 +473,7 @@ struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_
font->matrix.eM11 = font->matrix.eM22 = 1.0;
font->scale_y = 1.0;
font->kern_count = -1;
list_init( &font->child_fonts );
if (file)
{
......@@ -501,9 +502,15 @@ struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_
void free_gdi_font( struct gdi_font *font )
{
DWORD i;
struct gdi_font *child, *child_next;
if (font->private) font_funcs->destroy_font( font );
free_font_handle( font->handle );
LIST_FOR_EACH_ENTRY_SAFE( child, child_next, &font->child_fonts, struct gdi_font, entry )
{
list_remove( &child->entry );
free_gdi_font( child );
}
for (i = 0; i < font->gm_size; i++) HeapFree( GetProcessHeap(), 0, font->gm[i] );
HeapFree( GetProcessHeap(), 0, font->otm.otmpFamilyName );
HeapFree( GetProcessHeap(), 0, font->otm.otmpStyleName );
......@@ -1282,17 +1289,13 @@ static BOOL CDECL font_EnumFonts( PHYSDEV dev, LOGFONTW *lf, FONTENUMPROCW proc,
static BOOL CDECL font_FontIsLinked( PHYSDEV dev )
{
struct font_physdev *physdev = get_font_dev( dev );
BOOL ret;
if (!physdev->font)
{
dev = GET_NEXT_PHYSDEV( dev, pFontIsLinked );
return dev->funcs->pFontIsLinked( dev );
}
EnterCriticalSection( &font_cs );
ret = font_funcs->pFontIsLinked( physdev->font );
LeaveCriticalSection( &font_cs );
return ret;
return !list_empty( &physdev->font->child_fonts );
}
......
......@@ -317,6 +317,7 @@ struct gdi_font
int kern_count;
/* the following members can be accessed without locking, they are never modified after creation */
void *private; /* font backend private data */
struct list child_fonts;
DWORD handle;
DWORD cache_num;
DWORD hash;
......@@ -368,7 +369,6 @@ struct gdi_font
struct font_backend_funcs
{
BOOL (CDECL *pEnumFonts)( LOGFONTW *lf, FONTENUMPROCW proc, LPARAM lparam );
BOOL (CDECL *pFontIsLinked)( struct gdi_font *font );
struct gdi_font * (CDECL *pSelectFont)( DC *dc, HFONT hfont, UINT *aa_flags, UINT default_aa_flags );
INT (CDECL *add_font)( const WCHAR *file, DWORD flags );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment