Module: wine
Branch: master
Commit: 5cb954aa6aa60464a364b645227a3d00d2295740
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5cb954aa6aa60464a364b6452…
Author: Nikolay Sivov <nsivov(a)codeweavers.com>
Date: Sun Sep 27 22:53:42 2015 +0300
dwrite: Handle fonts with broken usWinDescent values.
---
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) {