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

dwrite: Implement IDWriteFontFamily1::GetFont().

parent 05e42a55
......@@ -1541,7 +1541,7 @@ static const IDWriteFont3Vtbl dwritefontvtbl = {
dwritefont3_GetLocality
};
static HRESULT create_font(struct dwrite_font_data *data, IDWriteFontFamily1 *family, IDWriteFont **font)
static HRESULT create_font(struct dwrite_font_data *data, IDWriteFontFamily1 *family, IDWriteFont3 **font)
{
struct dwrite_font *This;
*font = NULL;
......@@ -1557,7 +1557,7 @@ static HRESULT create_font(struct dwrite_font_data *data, IDWriteFontFamily1 *fa
This->data = data;
InterlockedIncrement(&This->data->ref);
*font = (IDWriteFont*)&This->IDWriteFont3_iface;
*font = &This->IDWriteFont3_iface;
return S_OK;
}
......@@ -1635,7 +1635,7 @@ static HRESULT WINAPI dwritefontlist_GetFont(IDWriteFontList *iface, UINT32 inde
if (index >= This->font_count)
return E_INVALIDARG;
return create_font(This->fonts[index], This->family, font);
return create_font(This->fonts[index], This->family, (IDWriteFont3**)font);
}
static const IDWriteFontListVtbl dwritefontlistvtbl = {
......@@ -1723,7 +1723,7 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily1 *iface, UINT32
if (index >= This->data->font_count)
return E_INVALIDARG;
return create_font(This->data->fonts[index], iface, font);
return create_font(This->data->fonts[index], iface, (IDWriteFont3**)font);
}
static HRESULT WINAPI dwritefontfamily_GetFamilyNames(IDWriteFontFamily1 *iface, IDWriteLocalizedStrings **names)
......@@ -1796,7 +1796,7 @@ static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily1 *
match = This->data->fonts[i];
}
return create_font(match, iface, font);
return create_font(match, iface, (IDWriteFont3**)font);
}
typedef BOOL (*matching_filter_func)(const struct dwrite_font_data*);
......@@ -1902,9 +1902,17 @@ static HRESULT WINAPI dwritefontfamily1_GetFont(IDWriteFontFamily1 *iface, UINT3
{
struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily1(iface);
FIXME("(%p)->(%u %p): stub\n", This, index, font);
TRACE("(%p)->(%u %p)\n", This, index, font);
return E_NOTIMPL;
*font = NULL;
if (This->data->font_count == 0)
return S_FALSE;
if (index >= This->data->font_count)
return E_FAIL;
return create_font(This->data->fonts[index], iface, font);
}
static HRESULT WINAPI dwritefontfamily1_GetFontFaceReference(IDWriteFontFamily1 *iface, UINT32 index,
......@@ -2121,7 +2129,7 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec
if (FAILED(hr))
return hr;
hr = create_font(found_font, family, font);
hr = create_font(found_font, family, (IDWriteFont3**)font);
IDWriteFontFamily1_Release(family);
return hr;
}
......
......@@ -1128,15 +1128,12 @@ if (0) /* crashes on native */
font3 = (void*)0xdeadbeef;
hr = IDWriteFontFamily1_GetFont(family1, ~0u, &font3);
todo_wine {
ok(hr == E_FAIL, "got 0x%08x\n", hr);
ok(font3 == NULL, "got %p\n", font3);
}
hr = IDWriteFontFamily1_GetFont(family1, 0, &font3);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
if (hr == S_OK) {
hr = IDWriteFont3_QueryInterface(font3, &IID_IDWriteFont, (void**)&font);
ok(hr == S_OK, "got 0x%08x\n", hr);
IDWriteFont_Release(font);
......@@ -1146,7 +1143,6 @@ if (0) /* crashes on native */
IDWriteFont1_Release(font1);
IDWriteFont3_Release(font3);
}
IDWriteFontFamily1_Release(family1);
}
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