[PATCH 1/2] dwrite: Make CreateFontFace() fail with DWRITE_E_FILEFORMAT for supported types in case of type mismatch

Nikolay Sivov nsivov at codeweavers.com
Fri Sep 4 04:15:41 CDT 2015


---

-------------- next part --------------
>From 86fcb8ce1410a5e3cce802102c9facce49935868 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri, 4 Sep 2015 11:28:38 +0300
Subject: [PATCH 1/2] dwrite: Make CreateFontFace() fail with
 DWRITE_E_FILEFORMAT for supported types in case of type mismatch

---
 dlls/dwrite/main.c       | 5 ++++-
 dlls/dwrite/tests/font.c | 3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c
index ce4299c..c996827 100644
--- a/dlls/dwrite/main.c
+++ b/dlls/dwrite/main.c
@@ -818,9 +818,12 @@ static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory2 *iface,
     if (FAILED(hr))
         return hr;
 
-    if (!is_supported || (face_type != req_facetype))
+    if (!is_supported)
         return E_FAIL;
 
+    if (face_type != req_facetype)
+        return DWRITE_E_FILEFORMAT;
+
     hr = IDWriteFontFile_GetReferenceKey(*font_files, &key, &key_size);
     if (FAILED(hr))
         return hr;
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 7617dbb..2a625d5 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -1307,12 +1307,11 @@ if (0) /* crashes on native */
 
     /* try mismatching face type, the one that's not supported */
     hr = IDWriteFactory_CreateFontFace(factory, DWRITE_FONT_FACE_TYPE_CFF, 1, &file, 0, DWRITE_FONT_SIMULATIONS_NONE, &fontface);
-todo_wine
     ok(hr == DWRITE_E_FILEFORMAT, "got 0x%08x\n", hr);
 
     hr = IDWriteFactory_CreateFontFace(factory, DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION, 1, &file, 0,
         DWRITE_FONT_SIMULATIONS_NONE, &fontface);
-    ok(hr == E_FAIL, "got 0x%08x\n", hr);
+    ok(hr == DWRITE_E_FILEFORMAT || broken(hr == E_FAIL) /* < win10 */, "got 0x%08x\n", hr);
 
     hr = IDWriteFactory_CreateFontFace(factory, DWRITE_FONT_FACE_TYPE_RAW_CFF, 1, &file, 0, DWRITE_FONT_SIMULATIONS_NONE, &fontface);
 todo_wine
-- 
2.1.4



More information about the wine-patches mailing list