dwrite: Implement IDWriteFontFamily1::GetFont().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
05e42a55ec
commit
cf3e92994d
@ -1541,7 +1541,7 @@ static const IDWriteFont3Vtbl dwritefontvtbl = {
|
|||||||
dwritefont3_GetLocality
|
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;
|
struct dwrite_font *This;
|
||||||
*font = NULL;
|
*font = NULL;
|
||||||
@ -1557,7 +1557,7 @@ static HRESULT create_font(struct dwrite_font_data *data, IDWriteFontFamily1 *fa
|
|||||||
This->data = data;
|
This->data = data;
|
||||||
InterlockedIncrement(&This->data->ref);
|
InterlockedIncrement(&This->data->ref);
|
||||||
|
|
||||||
*font = (IDWriteFont*)&This->IDWriteFont3_iface;
|
*font = &This->IDWriteFont3_iface;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -1635,7 +1635,7 @@ static HRESULT WINAPI dwritefontlist_GetFont(IDWriteFontList *iface, UINT32 inde
|
|||||||
if (index >= This->font_count)
|
if (index >= This->font_count)
|
||||||
return E_INVALIDARG;
|
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 = {
|
static const IDWriteFontListVtbl dwritefontlistvtbl = {
|
||||||
@ -1723,7 +1723,7 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily1 *iface, UINT32
|
|||||||
if (index >= This->data->font_count)
|
if (index >= This->data->font_count)
|
||||||
return E_INVALIDARG;
|
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)
|
static HRESULT WINAPI dwritefontfamily_GetFamilyNames(IDWriteFontFamily1 *iface, IDWriteLocalizedStrings **names)
|
||||||
@ -1796,7 +1796,7 @@ static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily1 *
|
|||||||
match = This->data->fonts[i];
|
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*);
|
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);
|
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,
|
static HRESULT WINAPI dwritefontfamily1_GetFontFaceReference(IDWriteFontFamily1 *iface, UINT32 index,
|
||||||
@ -2121,7 +2129,7 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec
|
|||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
hr = create_font(found_font, family, font);
|
hr = create_font(found_font, family, (IDWriteFont3**)font);
|
||||||
IDWriteFontFamily1_Release(family);
|
IDWriteFontFamily1_Release(family);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -1128,15 +1128,12 @@ if (0) /* crashes on native */
|
|||||||
|
|
||||||
font3 = (void*)0xdeadbeef;
|
font3 = (void*)0xdeadbeef;
|
||||||
hr = IDWriteFontFamily1_GetFont(family1, ~0u, &font3);
|
hr = IDWriteFontFamily1_GetFont(family1, ~0u, &font3);
|
||||||
todo_wine {
|
|
||||||
ok(hr == E_FAIL, "got 0x%08x\n", hr);
|
ok(hr == E_FAIL, "got 0x%08x\n", hr);
|
||||||
ok(font3 == NULL, "got %p\n", font3);
|
ok(font3 == NULL, "got %p\n", font3);
|
||||||
}
|
|
||||||
hr = IDWriteFontFamily1_GetFont(family1, 0, &font3);
|
hr = IDWriteFontFamily1_GetFont(family1, 0, &font3);
|
||||||
todo_wine
|
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
if (hr == S_OK) {
|
|
||||||
hr = IDWriteFont3_QueryInterface(font3, &IID_IDWriteFont, (void**)&font);
|
hr = IDWriteFont3_QueryInterface(font3, &IID_IDWriteFont, (void**)&font);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
IDWriteFont_Release(font);
|
IDWriteFont_Release(font);
|
||||||
@ -1146,7 +1143,6 @@ if (0) /* crashes on native */
|
|||||||
IDWriteFont1_Release(font1);
|
IDWriteFont1_Release(font1);
|
||||||
|
|
||||||
IDWriteFont3_Release(font3);
|
IDWriteFont3_Release(font3);
|
||||||
}
|
|
||||||
IDWriteFontFamily1_Release(family1);
|
IDWriteFontFamily1_Release(family1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user