From 6e8519b1287d122d983b9631599161a87d6666b2 Mon Sep 17 00:00:00 2001 From: Gerard Patel <gerard.patel@asi.fr> Date: Mon, 18 Dec 2000 03:11:10 +0000 Subject: [PATCH] Allow for the dialog font size to be set directly in pixels. --- windows/dialog.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/windows/dialog.c b/windows/dialog.c index b9edb20a8e9..b7a9d2e141b 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -735,10 +735,16 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate, /* The font height must be negative as it is a point size */ /* and must be converted to pixels first */ /* (see CreateFont() documentation in the Windows SDK). */ - HDC dc = GetDC(0); - int pixels = template.pointSize * GetDeviceCaps(dc , LOGPIXELSY)/72; - ReleaseDC(0, dc); - + HDC dc; + int pixels; + if (((short)template.pointSize) < 0) + pixels = -((short)template.pointSize); + else + { + dc = GetDC(0); + pixels = template.pointSize * GetDeviceCaps(dc , LOGPIXELSY)/72; + ReleaseDC(0, dc); + } if (win32Template) hFont = CreateFontW( -pixels, 0, 0, 0, template.weight, template.italic, FALSE, FALSE, -- GitLab