Alexandre Julliard : gdi32: Make the family replacement point to the family object.
Alexandre Julliard
julliard at winehq.org
Fri Oct 30 16:18:44 CDT 2020
Module: wine
Branch: master
Commit: 74ea8d8c427e1885d00a9e3c68f402b3748a87e6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=74ea8d8c427e1885d00a9e3c68f402b3748a87e6
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Oct 30 14:39:07 2020 +0100
gdi32: Make the family replacement point to the family object.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/font.c | 6 ++++--
dlls/gdi32/freetype.c | 6 ++----
dlls/gdi32/gdi_private.h | 12 ++++++------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 806ff0d1d91..c49186efb94 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -517,7 +517,7 @@ struct gdi_font_family *create_family( const WCHAR *name, const WCHAR *second_na
}
else family->second_name[0] = 0;
list_init( &family->faces );
- family->replacement = &family->faces;
+ family->replacement = NULL;
list_add_tail( &font_list, &family->entry );
return family;
}
@@ -527,6 +527,7 @@ void release_family( struct gdi_font_family *family )
if (--family->refcount) return;
assert( list_empty( &family->faces ));
list_remove( &family->entry );
+ if (family->replacement) release_family( family->replacement );
HeapFree( GetProcessHeap(), 0, family );
}
@@ -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;
- new_family->replacement = &family->faces;
+ new_family->replacement = family;
+ family->refcount++;
TRACE( "mapping %s to %s\n", debugstr_w(replace), debugstr_w(new_name) );
/* also add replacement for vertical font if necessary */
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index afc9add629c..d4e593b1211 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -662,10 +662,8 @@ static BOOL is_subpixel_rendering_enabled( void )
static const struct list *get_face_list_from_family(const Family *family)
{
- if (!list_empty(&family->faces))
- return &family->faces;
- else
- return family->replacement;
+ if (family->replacement) return &family->replacement->faces;
+ return &family->faces;
}
static Face *find_face_from_filename(const WCHAR *file_name, const WCHAR *face_name)
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 63e76e4df69..ab1b66b591c 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -307,12 +307,12 @@ struct glyph_metrics;
struct gdi_font_family
{
- struct list entry;
- unsigned int refcount;
- WCHAR family_name[LF_FACESIZE];
- WCHAR second_name[LF_FACESIZE];
- struct list faces;
- struct list *replacement;
+ struct list entry;
+ unsigned int refcount;
+ WCHAR family_name[LF_FACESIZE];
+ WCHAR second_name[LF_FACESIZE];
+ struct list faces;
+ struct gdi_font_family *replacement;
};
struct bitmap_font_size
More information about the wine-cvs
mailing list