Commit 1a5fa5f1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Michael Stefaniuc

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

Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org> (cherry picked from commit ff57b1fe) Signed-off-by: 's avatarMichael Stefaniuc <mstefani@winehq.org>
parent 89c06a84
......@@ -1083,9 +1083,10 @@ void opentype_get_font_properties(IDWriteFontFileStream *stream, DWRITE_FONT_FAC
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment