gdi32/tests: Avoid excessive traces for fonts with OS/2 version 4 tables

Nikolay Sivov nsivov at codeweavers.com
Thu Sep 10 06:36:37 CDT 2015


This happens at least on Win8.1, most likely on Win10 as well.
-------------- next part --------------
From fd3599f761ef625da17d849f7dd7a902efec2684 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu, 10 Sep 2015 14:31:15 +0300
Subject: [PATCH] gdi32/tests: Avoid excessive traces for fonts with OS/2
 version 4 tables

---
 dlls/gdi32/tests/font.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 6b0da1f..2972587 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -3188,9 +3188,14 @@ typedef struct
     USHORT usDefaultChar;
     USHORT usBreakChar;
     USHORT usMaxContext;
-} TT_OS2_V2;
+    /* version 4 (OpenType 1.6) */
+    USHORT usLowerOpticalPointSize;
+    USHORT usUpperOpticalPointSize;
+} TT_OS2_V4;
 #include "poppack.h"
 
+#define TT_OS2_V0_SIZE (FIELD_OFFSET(TT_OS2_V4, ulCodePageRange1))
+
 typedef struct
 {
     USHORT version;
@@ -3242,7 +3247,7 @@ typedef struct
     USHORT id_range_offset;
 } cmap_format_4_seg;
 
-static void expect_ff(const TEXTMETRICA *tmA, const TT_OS2_V2 *os2, WORD family, const char *name)
+static void expect_ff(const TEXTMETRICA *tmA, const TT_OS2_V4 *os2, WORD family, const char *name)
 {
     ok((tmA->tmPitchAndFamily & 0xf0) == family ||
        broken(PRIMARYLANGID(GetSystemDefaultLangID()) != LANG_ENGLISH),
@@ -3662,7 +3667,7 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
     HDC hdc;
     HFONT hfont, hfont_old;
     TEXTMETRICA tmA;
-    TT_OS2_V2 tt_os2;
+    TT_OS2_V4 tt_os2;
     LONG size, ret;
     const char *font_name = lf->lfFaceName;
     DWORD cmap_first = 0, cmap_last = 0;
@@ -3693,7 +3698,8 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
 
     memset(&tt_os2, 0, sizeof(tt_os2));
     ret = GetFontData(hdc, MS_OS2_TAG, 0, &tt_os2, size);
-    ok(ret == size, "GetFontData should return %u not %u\n", size, ret);
+    ok(ret >= TT_0S2_V0_SIZE && ret <= size, "GetFontData should return size from [%u,%u] not %u\n", TT_OS2_V0_SIZE,
+        size, ret);
 
     SetLastError(0xdeadbeef);
     ret = GetTextMetricsA(hdc, &tmA);
-- 
2.1.4



More information about the wine-patches mailing list