From abe71945ef04578daf356b8f2ad904d9fe6c7ba8 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 23 May 2018 08:24:38 +0300 Subject: [PATCH] dwrite/tests: Skip some tests on variable fonts. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- 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 6c723196dc0..44a81a199e8 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 6b4931c97b4..af4ffc87970 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;