Nikolay Sivov : dwrite: Implement FindFamilyName() for system font collection.
Alexandre Julliard
julliard at winehq.org
Mon Oct 22 13:42:45 CDT 2012
Module: wine
Branch: master
Commit: 2793d8196b92bf0492b930cdc5bfb6f2542ce7b6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2793d8196b92bf0492b930cdc5bfb6f2542ce7b6
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Oct 21 00:31:11 2012 -0400
dwrite: Implement FindFamilyName() for system font collection.
---
dlls/dwrite/font.c | 18 ++++++++++++++++--
dlls/dwrite/tests/font.c | 3 +--
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 689a330..ff4a345 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -690,8 +690,22 @@ static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection *
static HRESULT WINAPI dwritefontcollection_FindFamilyName(IDWriteFontCollection *iface, const WCHAR *name, UINT32 *index, BOOL *exists)
{
struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface);
- FIXME("(%p)->(%s %p %p): stub\n", This, debugstr_w(name), index, exists);
- return E_NOTIMPL;
+ UINT32 i;
+
+ TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(name), index, exists);
+
+ for (i = 0; i < This->count; i++)
+ if (!strcmpW(This->families[i], name))
+ {
+ *index = i;
+ *exists = TRUE;
+ return S_OK;
+ }
+
+ *index = (UINT32)-1;
+ *exists = FALSE;
+
+ return S_OK;
}
static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollection *iface, IDWriteFontFace *face, IDWriteFont **font)
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 9dc59e0..07d3e7d 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -536,7 +536,6 @@ static void test_system_fontcollection(void)
i = IDWriteFontCollection_GetFontFamilyCount(collection);
ok(i, "got %u\n", i);
-todo_wine {
ret = FALSE;
i = (UINT32)-1;
hr = IDWriteFontCollection_FindFamilyName(collection, tahomaW, &i, &ret);
@@ -550,7 +549,7 @@ todo_wine {
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!ret, "got %d\n", ret);
ok(i == (UINT32)-1, "got %u\n", i);
-}
+
IDWriteFontCollection_Release(collection);
}
More information about the wine-cvs
mailing list