From: Julius Schwartzenberg Subject: [1/1] dwrite: case insensitive font search Message-Id: <5528229B.2090908@gmail.com> Date: Fri, 10 Apr 2015 21:20:59 +0200 Running the tests on MS Windows, it turns out that Nikolay Sivov was correct that it should just be a case insensitive search: https://www.winehq.org/pipermail/wine-devel/2015-April/107309.html This allows Samsung Smart View 2.0 to get further with starting up. From ef24e3a77c869ce6e1404d9d8eb32d70df695c03 Mon Sep 17 00:00:00 2001 From: Julius Schwartzenberg Date: Fri, 10 Apr 2015 21:08:31 +0200 Subject: Case insensitive font search for dwrite. Fixes crash in Samsung Smart View 2.0. --- dlls/dwrite/font.c | 2 +- dlls/dwrite/tests/font.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index fc067a5..c591f4e 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -1431,7 +1431,7 @@ static UINT32 collection_find_family(struct dwrite_fontcollection *collection, c for (j = 0; j < IDWriteLocalizedStrings_GetCount(family_name); j++) { WCHAR buffer[255]; hr = IDWriteLocalizedStrings_GetString(family_name, j, buffer, 255); - if (SUCCEEDED(hr) && !strcmpW(buffer, name)) + if (SUCCEEDED(hr) && !strcmpiW(buffer, name)) return i; } } diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 65d8bcb..126fba9 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -58,6 +58,8 @@ static inline BOOL heap_free(void *mem) static const WCHAR test_fontfile[] = {'w','i','n','e','_','t','e','s','t','_','f','o','n','t','.','t','t','f',0}; static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0}; +static const WCHAR tahomaUppercaseW[] = {'T','A','H','O','M','A',0}; +static const WCHAR tahomaStrangecaseW[] = {'t','A','h','O','m','A',0}; static const WCHAR blahW[] = {'B','l','a','h','!',0}; static IDWriteFactory *create_factory(void) @@ -1376,6 +1378,20 @@ static void test_system_fontcollection(void) ok(ret, "got %d\n", ret); ok(i != (UINT32)-1, "got %u\n", i); + ret = FALSE; + i = (UINT32)-1; + hr = IDWriteFontCollection_FindFamilyName(collection, tahomaUppercaseW, &i, &ret); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(ret, "got %d\n", ret); + ok(i != (UINT32)-1, "got %u\n", i); + + ret = FALSE; + i = (UINT32)-1; + hr = IDWriteFontCollection_FindFamilyName(collection, tahomaStrangecaseW, &i, &ret); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(ret, "got %d\n", ret); + ok(i != (UINT32)-1, "got %u\n", i); + /* get back local file loader */ hr = IDWriteFontCollection_GetFontFamily(collection, i, &family); ok(hr == S_OK, "got 0x%08x\n", hr); -- 1.9.1