On Fri, May 14, 2021 at 07:17:41PM +0800, Jiangyi Chen wrote:
From 570f2a9cf61f74978ee0da5915028f6c9a457dfb Mon Sep 17 00:00:00 2001 From: Jiangyi Chen chenjiangyi@uniontech.com Date: Fri, 7 May 2021 14:01:13 +0800 Subject: [PATCH v2] gdi32: Match second_name during font search.
For example, there is a substituting MS Shell Dlg -> SimSun.the first parameter of GdipCreateFontFamilyFromName is MS Shell Dlg,then second_name is needed to find SimSun.Otherwise, it may cause GdipDrawString to crash indirectly.
Signed-off-by: Jiangyi Chen chenjiangyi@uniontech.com
dlls/gdi32/font.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 2d2831ec725..24e6d82c100 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -2772,6 +2772,7 @@ static BOOL family_matches( struct gdi_font_family *family, const WCHAR *face_na struct gdi_font_face *face;
if (!facename_compare( face_name, family->family_name, LF_FACESIZE - 1 )) return TRUE;
- if (!facename_compare( face_name, family->second_name, LF_FACESIZE - 1 )) return TRUE; LIST_FOR_EACH_ENTRY( face, get_family_face_list(family), struct gdi_font_face, entry ) if (!facename_compare( face_name, face->full_name, LF_FACESIZE - 1 )) return TRUE; return FALSE;
@@ -2879,7 +2880,7 @@ static BOOL CDECL font_EnumFonts( PHYSDEV dev, LOGFONTW *lf, FONTENUMPROCW proc, if (!family_matches(family, face_name)) continue; LIST_FOR_EACH_ENTRY( face, get_family_face_list(family), struct gdi_font_face, entry ) {
if (!face_matches( family->family_name, face, face_name )) continue;
if (!face_matches( family->family_name, face, face_name ) && !face_matches( family->second_name, face, face_name )) continue; if (!enum_face_charsets( family, face, enum_charsets, count, proc, lparam, orig_name )) return FALSE; }
A test for this would be nice (based on the gdi32 api, not gdiplus).
Also, if gdiplus is crashing, this suggests there is a bug there too.
Huw.