Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=47726 Signed-off-by: Myah Caron qsniyg@protonmail.com --- dlls/gdi32/font.c | 32 ++++++++++++++++++++++++-------- dlls/gdi32/tests/font.c | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index e099bec5e8..395141e575 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -117,6 +117,8 @@ struct font_enum FONTENUMPROCW lpEnumFunc; LPARAM lpData; BOOL unicode; + BOOL singleCharset; + WCHAR lastFaceName[LF_FACESIZE]; HDC hdc; INT retval; }; @@ -927,6 +929,14 @@ static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *p ENUMLOGFONTEXA logfont; NEWTEXTMETRICEXA tmA;
+ if (pfe->singleCharset) { + if (!strncmpW(plf->lfFaceName, pfe->lastFaceName, LF_FACESIZE)) { + return ret; + } + + lstrcpynW(pfe->lastFaceName, plf->lfFaceName, LF_FACESIZE); + } + if (!pfe->unicode) { FONT_EnumLogFontExWToA( (const ENUMLOGFONTEXW *)plf, &logfont); @@ -944,7 +954,7 @@ static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *p * FONT_EnumFontFamiliesEx */ static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCW efproc, - LPARAM lParam, BOOL unicode ) + LPARAM lParam, BOOL unicode, BOOL singleCharset ) { INT ret = 0; DC *dc = get_dc_ptr( hDC ); @@ -959,6 +969,8 @@ static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCW efpro fe.lpEnumFunc = efproc; fe.lpData = lParam; fe.unicode = unicode; + fe.lastFaceName[0] = 0; + fe.singleCharset = singleCharset; fe.hdc = hDC; fe.retval = 1; ret = physdev->funcs->pEnumFonts( physdev, plf, FONT_EnumInstance, (LPARAM)&fe ); @@ -974,7 +986,7 @@ INT WINAPI EnumFontFamiliesExW( HDC hDC, LPLOGFONTW plf, FONTENUMPROCW efproc, LPARAM lParam, DWORD dwFlags ) { - return FONT_EnumFontFamiliesEx( hDC, plf, efproc, lParam, TRUE ); + return FONT_EnumFontFamiliesEx( hDC, plf, efproc, lParam, TRUE, FALSE ); }
/*********************************************************************** @@ -993,7 +1005,7 @@ INT WINAPI EnumFontFamiliesExA( HDC hDC, LPLOGFONTA plf, } else plfW = NULL;
- return FONT_EnumFontFamiliesEx( hDC, plfW, (FONTENUMPROCW)efproc, lParam, FALSE ); + return FONT_EnumFontFamiliesEx( hDC, plfW, (FONTENUMPROCW)efproc, lParam, FALSE, FALSE ); }
/*********************************************************************** @@ -1003,6 +1015,7 @@ INT WINAPI EnumFontFamiliesA( HDC hDC, LPCSTR lpFamily, FONTENUMPROCA efproc, LPARAM lpData ) { LOGFONTA lf, *plf; + LOGFONTW lfW, *plfW;
if (lpFamily) { @@ -1011,10 +1024,13 @@ INT WINAPI EnumFontFamiliesA( HDC hDC, LPCSTR lpFamily, lf.lfCharSet = DEFAULT_CHARSET; lf.lfPitchAndFamily = 0; plf = &lf; + + FONT_LogFontAToW( plf, &lfW ); + plfW = &lfW; } - else plf = NULL; + else plfW = NULL;
- return EnumFontFamiliesExA( hDC, plf, efproc, lpData, 0 ); + return FONT_EnumFontFamiliesEx( hDC, plfW, (FONTENUMPROCW)efproc, lpData, FALSE, TRUE ); }
/*********************************************************************** @@ -1035,7 +1051,7 @@ INT WINAPI EnumFontFamiliesW( HDC hDC, LPCWSTR lpFamily, } else plf = NULL;
- return EnumFontFamiliesExW( hDC, plf, efproc, lpData, 0 ); + return FONT_EnumFontFamiliesEx( hDC, plf, efproc, lpData, TRUE, TRUE ); }
/*********************************************************************** @@ -2207,8 +2223,8 @@ static inline int get_line_width( DC *dc, int metric_size ) * ExtTextOutW (GDI32.@) * * Draws text using the currently selected font, background color, and text color. - * - * + * + * * PARAMS * x,y [I] coordinates of string * flags [I] diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 9949abdfe4..5f6bf4d6e6 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -2907,7 +2907,7 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset) /* EnumFontFamilies should only enumerate a single charset (the first one found) for a font face */ for (i = 1; i < efdw.total; i++) { ret = lstrcmpW(efdw.lf[i - 1].lfFaceName, efdw.lf[i].lfFaceName); - todo_wine ok(ret != 0, "old font family (%s) == new font family(%s)\n", + ok(ret != 0, "old font family (%s) == new font family(%s)\n", wine_dbgstr_w(efdw.lf[i - 1].lfFaceName), wine_dbgstr_w(efdw.lf[i].lfFaceName)); } } -- 2.27.0
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76059
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/gdi32/tests/font.c:257 error: patch failed: dlls/gdi32/font.c:2207 error: patch failed: dlls/gdi32/tests/font.c:2907 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/gdi32/tests/font.c:257 error: patch failed: dlls/gdi32/font.c:2207 error: patch failed: dlls/gdi32/tests/font.c:2907 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/gdi32/tests/font.c:257 error: patch failed: dlls/gdi32/font.c:2207 error: patch failed: dlls/gdi32/tests/font.c:2907 Task: Patch failed to apply