dwrite: Implement GetFontSet() for families.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-03-04 18:39:38 +03:00 committed by Alexandre Julliard
parent f40c2a19e2
commit 3049c94753
2 changed files with 14 additions and 16 deletions

View File

@ -2725,9 +2725,12 @@ static HRESULT WINAPI dwritefontfamily2_GetMatchingFonts(IDWriteFontFamily2 *ifa
static HRESULT WINAPI dwritefontfamily2_GetFontSet(IDWriteFontFamily2 *iface, IDWriteFontSet1 **fontset) static HRESULT WINAPI dwritefontfamily2_GetFontSet(IDWriteFontFamily2 *iface, IDWriteFontSet1 **fontset)
{ {
FIXME("%p, %p.\n", iface, fontset); struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface);
return E_NOTIMPL; TRACE("%p, %p.\n", iface, fontset);
return fontset_create_from_font_data(family->collection->factory, family->data->fonts,
family->data->count, fontset);
} }
static const IDWriteFontFamily2Vtbl fontfamilyvtbl = static const IDWriteFontFamily2Vtbl fontfamilyvtbl =
@ -2806,9 +2809,12 @@ static HRESULT WINAPI dwritefontfamilylist1_GetFontFaceReference(IDWriteFontList
static HRESULT WINAPI dwritefontfamilylist2_GetFontSet(IDWriteFontList2 *iface, IDWriteFontSet1 **fontset) static HRESULT WINAPI dwritefontfamilylist2_GetFontSet(IDWriteFontList2 *iface, IDWriteFontSet1 **fontset)
{ {
FIXME("%p, %p.\n", iface, fontset); struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface);
return E_NOTIMPL; TRACE("%p, %p.\n", iface, fontset);
return fontset_create_from_font_data(family->collection->factory, family->data->fonts,
family->data->count, fontset);
} }
static const IDWriteFontList2Vtbl fontfamilylistvtbl = static const IDWriteFontList2Vtbl fontfamilylistvtbl =

View File

@ -1631,18 +1631,14 @@ if (0) /* crashes on native */
ok(fontlist == (IDWriteFontList *)fontlist2, "Unexpected interface pointer.\n"); ok(fontlist == (IDWriteFontList *)fontlist2, "Unexpected interface pointer.\n");
hr = IDWriteFontList2_GetFontSet(fontlist2, &fontset); hr = IDWriteFontList2_GetFontSet(fontlist2, &fontset);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IDWriteFontList2_GetFontSet(fontlist2, &fontset2); hr = IDWriteFontList2_GetFontSet(fontlist2, &fontset2);
todo_wine {
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(fontset != fontset2, "Unexpected instance.\n"); ok(fontset != fontset2, "Unexpected instance.\n");
}
if (fontset2) IDWriteFontSet1_Release(fontset2);
IDWriteFontSet1_Release(fontset2); IDWriteFontSet1_Release(fontset);
if (fontset)
IDWriteFontSet1_Release(fontset);
IDWriteFontList2_Release(fontlist2); IDWriteFontList2_Release(fontlist2);
} }
@ -9959,17 +9955,13 @@ static void test_family_font_set(void)
if (SUCCEEDED(IDWriteFontFamily_QueryInterface(family, &IID_IDWriteFontFamily2, (void **)&family2))) if (SUCCEEDED(IDWriteFontFamily_QueryInterface(family, &IID_IDWriteFontFamily2, (void **)&family2)))
{ {
hr = IDWriteFontFamily2_GetFontSet(family2, &fontset); hr = IDWriteFontFamily2_GetFontSet(family2, &fontset);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IDWriteFontFamily2_GetFontSet(family2, &fontset2); hr = IDWriteFontFamily2_GetFontSet(family2, &fontset2);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
if (SUCCEEDED(hr))
{
ok(fontset != fontset2, "Unexpected fontset instance.\n"); ok(fontset != fontset2, "Unexpected fontset instance.\n");
IDWriteFontSet1_Release(fontset2); IDWriteFontSet1_Release(fontset2);
IDWriteFontSet1_Release(fontset); IDWriteFontSet1_Release(fontset);
}
IDWriteFontFamily2_Release(family2); IDWriteFontFamily2_Release(family2);
} }
else else