Commit c440d874 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Implement another GetFontFamily() variant.

parent 292dff58
......@@ -3002,11 +3002,23 @@ static HRESULT WINAPI dwritefontcollection1_GetFontFamily(IDWriteFontCollection3
}
static HRESULT WINAPI dwritefontcollection2_GetFontFamily(IDWriteFontCollection3 *iface,
UINT32 index, IDWriteFontFamily2 **family)
UINT32 index, IDWriteFontFamily2 **ret)
{
FIXME("%p, %u, %p.\n", iface, index, family);
struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface);
struct dwrite_fontfamily *family;
HRESULT hr;
return E_NOTIMPL;
TRACE("%p, %u, %p.\n", iface, index, ret);
*ret = NULL;
if (index >= collection->count)
return E_FAIL;
if (SUCCEEDED(hr = create_fontfamily(collection, index, &family)))
*ret = &family->IDWriteFontFamily2_iface;
return hr;
}
static HRESULT WINAPI dwritefontcollection2_GetMatchingFonts(IDWriteFontCollection3 *iface,
......
......@@ -1521,14 +1521,15 @@ static void test_GetFontFamily(void)
{
IDWriteFontCollection *collection, *collection2;
IDWriteFontCollection *syscoll;
IDWriteFontCollection2 *coll2;
IDWriteFontFamily *family, *family2;
IDWriteFontFamily1 *family1;
IDWriteGdiInterop *interop;
IDWriteFont *font, *font2;
IDWriteFactory *factory;
LOGFONTW logfont;
ULONG ref, count;
HRESULT hr;
ULONG ref;
factory = create_factory();
......@@ -1656,6 +1657,28 @@ if (0) /* crashes on native */
else
win_skip("IDWriteFontFamily1 is not supported.\n");
/* IDWriteFontCollection2::GetFontFamily() */
if (SUCCEEDED(IDWriteFontCollection_QueryInterface(syscoll, &IID_IDWriteFontCollection2, (void **)&coll2)))
{
IDWriteFontFamily2 *family2;
count = IDWriteFontCollection2_GetFontFamilyCount(coll2);
ok(!!count, "Unexpected family count.\n");
family2 = (void *)0xdeadbeef;
hr = IDWriteFontCollection2_GetFontFamily(coll2, count, &family2);
ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr);
ok(!family2, "Unexpected pointer.\n");
hr = IDWriteFontCollection2_GetFontFamily(coll2, 0, &family2);
ok(hr == S_OK, "Failed to get family, hr %#x.\n", hr);
IDWriteFontFamily2_Release(family2);
IDWriteFontCollection2_Release(coll2);
}
else
win_skip("IDWriteFontCollection2 is not supported.\n");
IDWriteFontCollection_Release(syscoll);
IDWriteFontCollection_Release(collection2);
IDWriteFontCollection_Release(collection);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment