Nikolay Sivov : dwrite: Implement IDWriteFontSet::GetFontFaceReference().

Alexandre Julliard julliard at winehq.org
Thu Mar 4 15:53:36 CST 2021


Module: wine
Branch: master
Commit: a6bdbc714642478c744040d45cd7079ef348a2d9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a6bdbc714642478c744040d45cd7079ef348a2d9

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Mar  4 18:39:35 2021 +0300

dwrite: Implement IDWriteFontSet::GetFontFaceReference().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/font.c       | 14 ++++++++++++--
 dlls/dwrite/tests/font.c | 15 ++++++++-------
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index ef61b173824..98c194b8c30 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -7162,9 +7162,19 @@ static UINT32 WINAPI dwritefontset_GetFontCount(IDWriteFontSet3 *iface)
 static HRESULT WINAPI dwritefontset_GetFontFaceReference(IDWriteFontSet3 *iface, UINT32 index,
         IDWriteFontFaceReference **reference)
 {
-    FIXME("%p, %u, %p.\n", iface, index, reference);
+    struct dwrite_fontset *set = impl_from_IDWriteFontSet3(iface);
+    struct dwrite_fontset_entry *entry;
 
-    return E_NOTIMPL;
+    TRACE("%p, %u, %p.\n", iface, index, reference);
+
+    *reference = NULL;
+
+    if (index >= set->count)
+        return E_INVALIDARG;
+
+    entry = &set->entries[index];
+    return IDWriteFactory7_CreateFontFaceReference_(set->factory, entry->file, entry->face_index,
+            entry->simulations, reference);
 }
 
 static HRESULT WINAPI dwritefontset_FindFontFaceReference(IDWriteFontSet3 *iface,
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 97caa7b31a2..4dcbbc4d077 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -9454,22 +9454,23 @@ static void test_fontsetbuilder(void)
             setcount = IDWriteFontSet_GetFontCount(fontset);
             ok(setcount == 1, "Unexpected font count %u.\n", setcount);
 
+            ref2 = (void *)0xdeadbeef;
+            hr = IDWriteFontSet_GetFontFaceReference(fontset, setcount, &ref2);
+            ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+            ok(!ref2, "Unexpected pointer.\n");
+
             ref2 = NULL;
             hr = IDWriteFontSet_GetFontFaceReference(fontset, 0, &ref2);
-       todo_wine
             ok(hr == S_OK, "Failed to get font face reference, hr %#x.\n", hr);
             ok(ref2 != ref, "Unexpected reference.\n");
 
             ref3 = NULL;
             hr = IDWriteFontSet_GetFontFaceReference(fontset, 0, &ref3);
-       todo_wine {
             ok(hr == S_OK, "Failed to get font face reference, hr %#x.\n", hr);
             ok(ref2 != ref3, "Unexpected reference.\n");
-       }
-            if (ref3)
-                IDWriteFontFaceReference_Release(ref3);
-            if (ref2)
-                IDWriteFontFaceReference_Release(ref2);
+
+            IDWriteFontFaceReference_Release(ref3);
+            IDWriteFontFaceReference_Release(ref2);
 
             for (id = DWRITE_FONT_PROPERTY_ID_FAMILY_NAME; id < DWRITE_FONT_PROPERTY_ID_TOTAL; ++id)
             {




More information about the wine-cvs mailing list