From 5d9ab56d9e49fd026c66edd54604ecd08c8259f0 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Fri, 5 May 2017 12:36:21 +0100 Subject: [PATCH] comdlg32: Select the correct font before querying the extents. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/comdlg32/itemdlg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index 92499e6faab..30960178573 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -862,6 +862,7 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width, BOOL multili RECT rc; HDC hdc; WCHAR *c; + HFONT font; TRACE("\n"); @@ -871,7 +872,10 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width, BOOL multili SendMessageW(hctrl, WM_GETTEXT, len+1, (LPARAM)text); hdc = GetDC(hctrl); + font = (HFONT)SendMessageW(hctrl, WM_GETFONT, 0, 0); + font = SelectObject(hdc, font); GetTextExtentPoint32W(hdc, text, lstrlenW(text), &size); + SelectObject(hdc, font); ReleaseDC(hctrl, hdc); if(len && multiline)