-- v2: mlang: Only consider true type fonts in map_font().
From: Danyil Blyschak dblyschak@codeweavers.com
--- dlls/mlang/mlang.c | 2 ++ dlls/mlang/tests/mlang.c | 28 ++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index 3ff3c8b34bb..072195b8e34 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -1327,6 +1327,8 @@ static INT CALLBACK map_font_enum_proc(const LOGFONTW *lf, const TEXTMETRICW *nt UINT charset; struct map_font_enum_data *data = (struct map_font_enum_data *)lParam;
+ if (type != TRUETYPE_FONTTYPE) return 1; + data->src_lf.lfCharSet = lf->lfCharSet; wcscpy(data->src_lf.lfFaceName, lf->lfFaceName);
diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 83caaf163a6..5df66255ff6 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -2716,6 +2716,14 @@ static void test_MapFont(IMLangFontLink *font_link, IMLangFontLink2 *font_link2) HFONT font1 = NULL; HFONT font2 = NULL; DWORD codepages; + DWORD all_codepages[] = { + FS_LATIN1, FS_LATIN2, FS_CYRILLIC, FS_GREEK, FS_TURKISH, FS_HEBREW, + FS_ARABIC, FS_BALTIC, FS_VIETNAMESE, FS_THAI, FS_JISJAPAN, FS_CHINESESIMP, + FS_WANSUNG, FS_CHINESETRAD + }; + ULONG i; + DWORD Csb[2]; + CHARSETINFO ci; DWORD font_codepages; HRESULT ret; HDC hdc; @@ -2783,12 +2791,20 @@ static void test_MapFont(IMLangFontLink *font_link, IMLangFontLink2 *font_link2) ret = IMLangFontLink2_MapFont(font_link2, hdc, codepages, 0, &new_font); ok(ret == S_OK && new_font == last_font, "IMLangFontLink2_MapFont: expected S_OK/%p, got %08lx/%p\n", last_font, ret, new_font);
- /* check that the returned font can directly handle the codepage (instead of relying on a child font) */ - ret = IMLangFontLink2_MapFont(font_link2, hdc, FS_JISJAPAN, 0, &new_font); - old_font = SelectObject(hdc, new_font); - charset = GetTextCharsetInfo(hdc, &fs, 0); - SelectObject(hdc, old_font); - ok(ret == S_OK && charset == SHIFTJIS_CHARSET && !!(fs.fsCsb[0] & FS_JISJAPAN), "IMLangFontLink2_MapFont: expected S_OK/%u/1, got %08lx/%u/0\n", SHIFTJIS_CHARSET, ret, charset); + /* check that the returned font can directly handle the requested codepage (instead of relying on a child font) by checking the corresponding charset */ + for (i = 0; i < sizeof(all_codepages)/sizeof(all_codepages[0]); i++) + { + Csb[0] = all_codepages[i]; + Csb[1] = 0x0; + if(!TranslateCharsetInfo(Csb, &ci, TCI_SRCFONTSIG)) continue; + ret = IMLangFontLink2_MapFont(font_link2, hdc, all_codepages[i], 0, &new_font); + /* an appropriate font might just not exist on the system */ + if(ret != S_OK) continue; + old_font = SelectObject(hdc, new_font); + charset = GetTextCharsetInfo(hdc, &fs, 0); + SelectObject(hdc, old_font); + ok(charset == ci.ciCharset && !!(fs.fsCsb[0] & all_codepages[i]), "IMLangFontLink2_MapFont: expected %u/1, got %u/0\n", ci.ciCharset, charset); + }
ret = IMLangFontLink2_ReleaseFont(font_link2, NULL); ok(ret == E_FAIL, "IMLangFontLink2_ReleaseFont: expected E_FAIL, got %08lx\n", ret);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=149114
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w7u_adm (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w7u_el (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 161/0
=== w8 (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w8adm (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w864 (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w1064v1507 (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w1064v1809 (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w1064_tsign (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w10pro64 (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w10pro64_en_AE_u8 (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 254/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w11pro64 (32 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w7pro64 (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w864 (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w1064v1507 (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0
=== w1064v1809 (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w1064_2qxl (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w1064_adm (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w1064_tsign (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w10pro64 (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w10pro64_ar (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 178/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w10pro64_ja (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 128/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w10pro64_zh_CN (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 134/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005
=== w11pro64_amd (64 bit report) ===
mlang: mlang.c:2806: Test failed: IMLangFontLink2_MapFont: expected 0/1, got 0/0 mlang.c:2812: Test failed: IMLangFontLink2_ReleaseFont: expected S_OK, got 80004005