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

dwrite: Implement IDWriteFontList1::GetFontFaceReference().

parent 51154acb
...@@ -1695,10 +1695,21 @@ static HRESULT WINAPI dwritefontlist1_GetFontFaceReference(IDWriteFontList1 *ifa ...@@ -1695,10 +1695,21 @@ static HRESULT WINAPI dwritefontlist1_GetFontFaceReference(IDWriteFontList1 *ifa
IDWriteFontFaceReference **reference) IDWriteFontFaceReference **reference)
{ {
struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); 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 = { static const IDWriteFontList1Vtbl dwritefontlistvtbl = {
......
...@@ -2941,7 +2941,12 @@ static void test_GetMatchingFonts(void) ...@@ -2941,7 +2941,12 @@ static void test_GetMatchingFonts(void)
hr = IDWriteFontList_QueryInterface(fontlist, &IID_IDWriteFontList1, (void**)&fontlist1); hr = IDWriteFontList_QueryInterface(fontlist, &IID_IDWriteFontList1, (void**)&fontlist1);
if (hr == S_OK) { if (hr == S_OK) {
IDWriteFontFaceReference *ref, *ref1;
IDWriteFont3 *font; IDWriteFont3 *font;
UINT32 count;
count = IDWriteFontList1_GetFontCount(fontlist1);
ok(count > 0, "got %u\n", count);
font = (void*)0xdeadbeef; font = (void*)0xdeadbeef;
hr = IDWriteFontList1_GetFont(fontlist1, ~0u, &font); hr = IDWriteFontList1_GetFont(fontlist1, ~0u, &font);
...@@ -2949,7 +2954,7 @@ static void test_GetMatchingFonts(void) ...@@ -2949,7 +2954,7 @@ static void test_GetMatchingFonts(void)
ok(font == NULL, "got %p\n", font); ok(font == NULL, "got %p\n", font);
font = (void*)0xdeadbeef; 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(hr == E_FAIL, "got 0x%08x\n", hr);
ok(font == NULL, "got %p\n", font); ok(font == NULL, "got %p\n", font);
...@@ -2957,6 +2962,15 @@ static void test_GetMatchingFonts(void) ...@@ -2957,6 +2962,15 @@ static void test_GetMatchingFonts(void)
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
IDWriteFont3_Release(font); 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); IDWriteFontList1_Release(fontlist1);
} }
else else
......
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