[PATCH] dwrite: Handle fonts with broken usWinDescent values
Nikolay Sivov
nsivov at codeweavers.com
Sun Sep 27 14:53:42 CDT 2015
---
-------------- next part --------------
From 8f47a976d7bb9dab8c425c06e57488e8664a74a1 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun, 27 Sep 2015 22:48:38 +0300
Subject: [PATCH] dwrite: Handle fonts with broken usWinDescent values
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/dwrite/opentype.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index fd471ef..82e0a9c 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -960,7 +960,9 @@ void opentype_get_font_metrics(IDWriteFontFileStream *stream, DWRITE_FONT_FACE_T
USHORT version = GET_BE_WORD(tt_os2->version);
metrics->ascent = GET_BE_WORD(tt_os2->usWinAscent);
- metrics->descent = GET_BE_WORD(tt_os2->usWinDescent);
+ /* Some fonts have usWinDescent value stored as signed short, which could be wrongly
+ interpreted as large unsigned value. */
+ metrics->descent = abs((SHORT)GET_BE_WORD(tt_os2->usWinDescent));
/* line gap is estimated using two sets of ascender/descender values and 'hhea' line gap */
if (tt_hhea) {
--
2.5.3
More information about the wine-patches
mailing list