[PATCH 2/3] dwrite: Fail earlier in TranslateColorGlyphRun() for fonts without color info

Nikolay Sivov nsivov at codeweavers.com
Thu Oct 29 02:20:54 CDT 2015


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/dwrite/font.c       | 15 +++++++++++++++
 dlls/dwrite/tests/font.c |  2 --
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 0e3c09a..97ea039 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -4556,8 +4556,23 @@ HRESULT create_colorglyphenum(FLOAT originX, FLOAT originY, const DWRITE_GLYPH_R
     DWRITE_MEASURING_MODE mode, const DWRITE_MATRIX *transform, UINT32 palette, IDWriteColorGlyphRunEnumerator **ret)
 {
     struct dwrite_colorglyphenum *colorglyphenum;
+    IDWriteFontFace2 *fontface2;
+    BOOL colorfont;
+    HRESULT hr;
 
     *ret = NULL;
+
+    hr = IDWriteFontFace_QueryInterface(run->fontFace, &IID_IDWriteFontFace2, (void**)&fontface2);
+    if (FAILED(hr)) {
+        WARN("failed to get IDWriteFontFace2, 0x%08x\n", hr);
+        return hr;
+    }
+
+    colorfont = IDWriteFontFace2_IsColorFont(fontface2);
+    IDWriteFontFace2_Release(fontface2);
+    if (!colorfont)
+        return DWRITE_E_NOCOLOR;
+
     colorglyphenum = heap_alloc(sizeof(*colorglyphenum));
     if (!colorglyphenum)
         return E_OUTOFMEMORY;
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index e03c819..41d848e 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -5074,10 +5074,8 @@ static void test_TranslateColorGlyphRun(void)
     layers = (void*)0xdeadbeef;
     hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0, 0.0, &run, NULL,
         DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
-todo_wine {
     ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
     ok(layers == NULL, "got %p\n", layers);
-}
     IDWriteFontFace_Release(fontface);
 
     /* Segoe UI Emoji, with color support */
-- 
2.6.1




More information about the wine-patches mailing list