dwrite: Implement GetFontFamily() for system font collection.

This commit is contained in:
Nikolay Sivov 2012-10-22 00:06:03 -04:00 committed by Alexandre Julliard
parent a30faec10e
commit 10431905e5
2 changed files with 19 additions and 2 deletions

View File

@ -161,6 +161,8 @@ struct dwrite_fontface {
LONG ref;
};
static HRESULT create_fontfamily(const WCHAR *familyname, IDWriteFontFamily **family);
static inline struct dwrite_fontface *impl_from_IDWriteFontFace(IDWriteFontFace *iface)
{
return CONTAINING_RECORD(iface, struct dwrite_fontface, IDWriteFontFace_iface);
@ -666,8 +668,16 @@ static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollecti
static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection *iface, UINT32 index, IDWriteFontFamily **family)
{
struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface);
FIXME("(%p)->(%u %p): stub\n", This, index, family);
return E_NOTIMPL;
TRACE("(%p)->(%u %p)\n", This, index, family);
if (index >= This->count)
{
*family = NULL;
return E_FAIL;
}
return create_fontfamily(This->families[index], family);
}
static HRESULT WINAPI dwritefontcollection_FindFamilyName(IDWriteFontCollection *iface, const WCHAR *name, UINT32 *index, BOOL *exists)

View File

@ -526,6 +526,7 @@ todo_wine
static void test_system_fontcollection(void)
{
IDWriteFontCollection *collection, *coll2;
IDWriteFontFamily *family;
HRESULT hr;
UINT32 i;
BOOL ret;
@ -546,6 +547,12 @@ static void test_system_fontcollection(void)
i = IDWriteFontCollection_GetFontFamilyCount(collection);
ok(i, "got %u\n", i);
/* invalid index */
family = (void*)0xdeadbeef;
hr = IDWriteFontCollection_GetFontFamily(collection, i, &family);
ok(hr == E_FAIL, "got 0x%08x\n", hr);
ok(family == NULL, "got %p\n", family);
ret = FALSE;
i = (UINT32)-1;
hr = IDWriteFontCollection_FindFamilyName(collection, tahomaW, &i, &ret);