Nikolay Sivov : dwrite: Always return non-zero metrics for strikethrough/ underline thickness.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 11 10:30:31 CDT 2016


Module: wine
Branch: master
Commit: 137030bf7781a1ae9797667e555d2df46ab59920
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=137030bf7781a1ae9797667e555d2df46ab59920

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Apr 10 23:59:11 2016 +0300

dwrite: Always return non-zero metrics for strikethrough/underline thickness.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/opentype.c   | 12 ++++++++++++
 dlls/dwrite/tests/font.c |  2 --
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 97a786d..b9bddea 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -1204,6 +1204,18 @@ void opentype_get_font_metrics(IDWriteFontFileStream *stream, DWRITE_FONT_FACE_T
         metrics->underlineThickness = GET_BE_WORD(tt_post->underlineThickness);
     }
 
+    /* use any of thickness values if another one is zero, if both are zero use estimate */
+    if (metrics->strikethroughThickness || metrics->underlineThickness) {
+        if (!metrics->strikethroughThickness)
+            metrics->strikethroughThickness = metrics->underlineThickness;
+        if (!metrics->underlineThickness)
+            metrics->underlineThickness = metrics->strikethroughThickness;
+    }
+    else {
+        metrics->strikethroughThickness = metrics->designUnitsPerEm / 14;
+        metrics->underlineThickness = metrics->designUnitsPerEm / 14;
+    }
+
     /* estimate missing metrics */
     if (metrics->xHeight == 0)
         metrics->xHeight = metrics->designUnitsPerEm / 2;
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 0c060b8..5591913 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -1576,12 +1576,10 @@ static void check_font_metrics(const WCHAR *nameW, const DWRITE_FONT_METRICS *go
         wine_dbgstr_w(nameW), got->designUnitsPerEm, expected->designUnitsPerEm);
     ok(got->underlinePosition == expected->underlinePosition, "font %s: underlinePosition %d, expected %d\n",
         wine_dbgstr_w(nameW), got->underlinePosition, expected->underlinePosition);
-todo_wine_if(got->underlineThickness == 0)
     ok(got->underlineThickness == expected->underlineThickness, "font %s: underlineThickness %u, "
         "expected %u\n", wine_dbgstr_w(nameW), got->underlineThickness, expected->underlineThickness);
     ok(got->strikethroughPosition == expected->strikethroughPosition, "font %s: strikethroughPosition %d, expected %d\n",
         wine_dbgstr_w(nameW), got->strikethroughPosition, expected->strikethroughPosition);
-todo_wine_if(got->strikethroughThickness == 0)
     ok(got->strikethroughThickness == expected->strikethroughThickness, "font %s: strikethroughThickness %u, "
         "expected %u\n", wine_dbgstr_w(nameW), got->strikethroughThickness, expected->strikethroughThickness);
 }




More information about the wine-cvs mailing list