dwrite: Sanitize specified stretch value, valid range is [1, 9].

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-08-13 22:21:13 +03:00 committed by Alexandre Julliard
parent cc8cc65f79
commit ff57b1febb
1 changed files with 3 additions and 2 deletions

View File

@ -1291,9 +1291,10 @@ void opentype_get_font_properties(struct file_stream_desc *stream_desc, struct d
USHORT version = GET_BE_WORD(tt_os2->version);
USHORT fsSelection = GET_BE_WORD(tt_os2->fsSelection);
USHORT usWeightClass = GET_BE_WORD(tt_os2->usWeightClass);
USHORT usWidthClass = GET_BE_WORD(tt_os2->usWidthClass);
if (GET_BE_WORD(tt_os2->usWidthClass) <= DWRITE_FONT_STRETCH_ULTRA_EXPANDED)
props->stretch = GET_BE_WORD(tt_os2->usWidthClass);
if (usWidthClass > DWRITE_FONT_STRETCH_UNDEFINED && usWidthClass <= DWRITE_FONT_STRETCH_ULTRA_EXPANDED)
props->stretch = usWidthClass;
if (usWeightClass >= 1 && usWeightClass <= 9)
usWeightClass *= 100;