diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 9c874f293d3..bf794127351 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -1695,10 +1695,21 @@ static HRESULT WINAPI dwritefontlist1_GetFontFaceReference(IDWriteFontList1 *ifa IDWriteFontFaceReference **reference) { struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); + IDWriteFont3 *font; + HRESULT hr; - FIXME("(%p)->(%u %p): stub\n", This, index, reference); + TRACE("(%p)->(%u %p)\n", This, index, reference); - return E_NOTIMPL; + *reference = NULL; + + hr = IDWriteFontList1_GetFont(iface, index, &font); + if (FAILED(hr)) + return hr; + + hr = IDWriteFont3_GetFontFaceReference(font, reference); + IDWriteFont3_Release(font); + + return hr; } static const IDWriteFontList1Vtbl dwritefontlistvtbl = { diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 3ffe97f82c1..baef6376cd6 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -2941,7 +2941,12 @@ static void test_GetMatchingFonts(void) hr = IDWriteFontList_QueryInterface(fontlist, &IID_IDWriteFontList1, (void**)&fontlist1); if (hr == S_OK) { + IDWriteFontFaceReference *ref, *ref1; IDWriteFont3 *font; + UINT32 count; + + count = IDWriteFontList1_GetFontCount(fontlist1); + ok(count > 0, "got %u\n", count); font = (void*)0xdeadbeef; hr = IDWriteFontList1_GetFont(fontlist1, ~0u, &font); @@ -2949,7 +2954,7 @@ static void test_GetMatchingFonts(void) ok(font == NULL, "got %p\n", font); font = (void*)0xdeadbeef; - hr = IDWriteFontList1_GetFont(fontlist1, IDWriteFontList1_GetFontCount(fontlist1), &font); + hr = IDWriteFontList1_GetFont(fontlist1, count, &font); ok(hr == E_FAIL, "got 0x%08x\n", hr); ok(font == NULL, "got %p\n", font); @@ -2957,6 +2962,15 @@ static void test_GetMatchingFonts(void) ok(hr == S_OK, "got 0x%08x\n", hr); IDWriteFont3_Release(font); + hr = IDWriteFontList1_GetFontFaceReference(fontlist1, 0, &ref); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteFontList1_GetFontFaceReference(fontlist1, 0, &ref1); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(ref != ref1, "got %p, %p\n", ref, ref1); + + IDWriteFontFaceReference_Release(ref1); + IDWriteFontFaceReference_Release(ref); IDWriteFontList1_Release(fontlist1); } else