Commit 74ea8d8c authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Make the family replacement point to the family object.

parent d27a9d77
...@@ -517,7 +517,7 @@ struct gdi_font_family *create_family( const WCHAR *name, const WCHAR *second_na ...@@ -517,7 +517,7 @@ struct gdi_font_family *create_family( const WCHAR *name, const WCHAR *second_na
} }
else family->second_name[0] = 0; else family->second_name[0] = 0;
list_init( &family->faces ); list_init( &family->faces );
family->replacement = &family->faces; family->replacement = NULL;
list_add_tail( &font_list, &family->entry ); list_add_tail( &font_list, &family->entry );
return family; return family;
} }
...@@ -527,6 +527,7 @@ void release_family( struct gdi_font_family *family ) ...@@ -527,6 +527,7 @@ void release_family( struct gdi_font_family *family )
if (--family->refcount) return; if (--family->refcount) return;
assert( list_empty( &family->faces )); assert( list_empty( &family->faces ));
list_remove( &family->entry ); list_remove( &family->entry );
if (family->replacement) release_family( family->replacement );
HeapFree( GetProcessHeap(), 0, family ); HeapFree( GetProcessHeap(), 0, family );
} }
...@@ -564,7 +565,8 @@ static BOOL add_family_replacement( const WCHAR *new_name, const WCHAR *replace ...@@ -564,7 +565,8 @@ static BOOL add_family_replacement( const WCHAR *new_name, const WCHAR *replace
} }
if (!(new_family = create_family( new_name, NULL ))) return FALSE; if (!(new_family = create_family( new_name, NULL ))) return FALSE;
new_family->replacement = &family->faces; new_family->replacement = family;
family->refcount++;
TRACE( "mapping %s to %s\n", debugstr_w(replace), debugstr_w(new_name) ); TRACE( "mapping %s to %s\n", debugstr_w(replace), debugstr_w(new_name) );
/* also add replacement for vertical font if necessary */ /* also add replacement for vertical font if necessary */
......
...@@ -662,10 +662,8 @@ static BOOL is_subpixel_rendering_enabled( void ) ...@@ -662,10 +662,8 @@ static BOOL is_subpixel_rendering_enabled( void )
static const struct list *get_face_list_from_family(const Family *family) static const struct list *get_face_list_from_family(const Family *family)
{ {
if (!list_empty(&family->faces)) if (family->replacement) return &family->replacement->faces;
return &family->faces; return &family->faces;
else
return family->replacement;
} }
static Face *find_face_from_filename(const WCHAR *file_name, const WCHAR *face_name) static Face *find_face_from_filename(const WCHAR *file_name, const WCHAR *face_name)
......
...@@ -307,12 +307,12 @@ struct glyph_metrics; ...@@ -307,12 +307,12 @@ struct glyph_metrics;
struct gdi_font_family struct gdi_font_family
{ {
struct list entry; struct list entry;
unsigned int refcount; unsigned int refcount;
WCHAR family_name[LF_FACESIZE]; WCHAR family_name[LF_FACESIZE];
WCHAR second_name[LF_FACESIZE]; WCHAR second_name[LF_FACESIZE];
struct list faces; struct list faces;
struct list *replacement; struct gdi_font_family *replacement;
}; };
struct bitmap_font_size struct bitmap_font_size
......
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