[PATCH 2/2] dwrite/tests: Skip some tests on variable fonts.

Nikolay Sivov nsivov at codeweavers.com
Wed May 23 00:24:38 CDT 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---

Bahnschrift is variable font, test will need to read instance metrics to
give proper results.

 dlls/dwrite/tests/font.c | 34 ++++++++++++++++++++++++++++++++++
 include/dwrite_3.idl     | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 6c723196dc..44a81a199e 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -2544,6 +2544,19 @@ static void get_logfont_from_font(IDWriteFont *font, LOGFONTW *logfont)
     IDWriteFontFace_Release(fontface);
 }
 
+static BOOL has_face_variations(IDWriteFontFace *fontface)
+{
+    IDWriteFontFace5 *fontface5;
+    BOOL ret = FALSE;
+
+    if (SUCCEEDED(IDWriteFontFace_QueryInterface(fontface, &IID_IDWriteFontFace5, (void **)&fontface5))) {
+        ret = IDWriteFontFace5_HasVariations(fontface5);
+        IDWriteFontFace5_Release(fontface5);
+    }
+
+    return ret;
+}
+
 static void test_ConvertFontFaceToLOGFONT(void)
 {
     IDWriteFontCollection *collection;
@@ -2614,6 +2627,13 @@ if (0) /* crashes on native */
             hr = IDWriteFont_CreateFontFace(font, &fontface);
             ok(hr == S_OK, "got 0x%08x\n", hr);
 
+            if (has_face_variations(fontface)) {
+                skip("%s: test does not support variable fonts.\n", wine_dbgstr_w(nameW));
+                IDWriteFontFace_Release(fontface);
+                IDWriteFont_Release(font);
+                continue;
+            }
+
             memset(&logfont, 0xcc, sizeof(logfont));
             hr = IDWriteGdiInterop_ConvertFontFaceToLOGFONT(interop, fontface, &logfont);
             ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -4014,6 +4034,8 @@ if (0) { /* crashes on native */
 
         for (j = 0; j < font_count; j++) {
             static const WCHAR spaceW[] = {' ', 0};
+            IDWriteFontFace *fontface;
+            BOOL has_variations;
 
             hr = IDWriteFontFamily_GetFont(family, j, &font);
             ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -4028,6 +4050,18 @@ if (0) { /* crashes on native */
             lstrcatW(nameW, spaceW);
             lstrcatW(nameW, facenameW);
 
+            hr = IDWriteFont_CreateFontFace(font, &fontface);
+            ok(hr == S_OK, "got 0x%08x\n", hr);
+
+            has_variations = has_face_variations(fontface);
+            IDWriteFontFace_Release(fontface);
+
+            if (has_variations) {
+                skip("%s: test does not support variable fonts.\n", wine_dbgstr_w(nameW));
+                IDWriteFont_Release(font);
+                continue;
+            }
+
             system = FALSE;
             memset(&logfont, 0xcc, sizeof(logfont));
             hr = IDWriteGdiInterop_ConvertFontToLOGFONT(interop, font, &logfont, &system);
diff --git a/include/dwrite_3.idl b/include/dwrite_3.idl
index 6b4931c97b..af4ffc8797 100644
--- a/include/dwrite_3.idl
+++ b/include/dwrite_3.idl
@@ -22,6 +22,7 @@ interface IDWriteFontFaceReference;
 interface IDWriteFontFace3;
 interface IDWriteFontSet;
 interface IDWriteFontDownloadQueue;
+interface IDWriteFontResource;
 
 cpp_quote("#ifndef _WINGDI_")
 /* already defined in wingdi.h but needed for WIDL */
@@ -457,6 +458,37 @@ interface IDWriteFontFace4 : IDWriteFontFace3
     void ReleaseGlyphImageData(void *context);
 }
 
+typedef enum DWRITE_FONT_AXIS_TAG
+{
+    DWRITE_FONT_AXIS_TAG_WEIGHT       = 0x74686777, /* 'wght' */
+    DWRITE_FONT_AXIS_TAG_WIDTH        = 0x68746477, /* 'wdth' */
+    DWRITE_FONT_AXIS_TAG_SLANT        = 0x746e6c73, /* 'slnt' */
+    DWRITE_FONT_AXIS_TAG_OPTICAL_SIZE = 0x7a73706f, /* 'opsz' */
+    DWRITE_FONT_AXIS_TAG_ITALIC       = 0x6c617469, /* 'ital' */
+} DWRITE_FONT_AXIS_TAG;
+
+typedef struct DWRITE_FONT_AXIS_VALUE
+{
+    DWRITE_FONT_AXIS_TAG axisTag;
+    FLOAT value;
+} DWRITE_FONT_AXIS_VALUE;
+
+[
+    local,
+    object,
+    uuid(98eff3a5-b667-479a-b145-e2fa5b9fdc29)
+]
+interface IDWriteFontFace5 : IDWriteFontFace4
+{
+    UINT32 GetFontAxisValueCount();
+    HRESULT GetFontAxisValues(
+        DWRITE_FONT_AXIS_VALUE *values,
+        UINT32 value_count);
+    BOOL HasVariations();
+    HRESULT GetFontResource(IDWriteFontResource **resource);
+    BOOL Equals(IDWriteFontFace *fontface);
+}
+
 typedef struct DWRITE_COLOR_GLYPH_RUN1
 {
     DWRITE_GLYPH_RUN glyphRun;
-- 
2.17.0




More information about the wine-devel mailing list