From 9b5b04c1c1a7b32dd3e1e453b6d739082c4ccede Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 19 Apr 2012 21:43:51 +0900 Subject: [PATCH] gdiplus: Avoid saving negative values in pixel_size and emSize. --- dlls/gdiplus/font.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index 169e28fd3ec..1ac76041011 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -190,9 +190,6 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, (*font)->lfw.lfUnderline = logfont->lfUnderline; (*font)->lfw.lfStrikeOut = logfont->lfStrikeOut; - (*font)->pixel_size = (*font)->emSize = logfont->lfHeight; - (*font)->unit = UnitPixel; - hfont = CreateFontIndirectW(&(*font)->lfw); oldfont = SelectObject(hdc, hfont); GetTextMetricsW(hdc, &textmet); @@ -201,6 +198,8 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, (*font)->lfw.lfWeight = textmet.tmWeight; (*font)->lfw.lfCharSet = textmet.tmCharSet; + (*font)->pixel_size = (*font)->emSize = textmet.tmHeight; + (*font)->unit = UnitPixel; (*font)->height = 1; /* FIXME: need NEWTEXTMETRIC.ntmSizeEM here */ (*font)->line_spacing = textmet.tmAscent + textmet.tmDescent + textmet.tmExternalLeading;