Commit a1953658 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

comdlg32: Always use screen dpi in the font dialog, even with a printer dc.

parent 9bb6932e
......@@ -456,6 +456,21 @@ static inline HDC CFn_GetDC(const CHOOSEFONTW *lpcf)
}
/*************************************************************************
* GetScreenDPI [internal]
*/
static inline int GetScreenDPI(void)
{
HDC hdc;
int result;
hdc = GetDC(0);
result = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(0, hdc);
return result;
}
/*************************************************************************
* CFn_ReleaseDC [internal]
*/
static inline void CFn_ReleaseDC(const CHOOSEFONTW *lpcf, HDC hdc)
......@@ -486,10 +501,8 @@ static INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *
if (nFontType & RASTER_FONTTYPE)
{
INT points;
if(!(hdc = CFn_GetDC(lpcf))) return 0;
points = MulDiv( lpNTM->ntmTm.tmHeight - lpNTM->ntmTm.tmInternalLeading,
72, GetDeviceCaps(hdc, LOGPIXELSY));
CFn_ReleaseDC(lpcf, hdc);
72, GetScreenDPI());
i = AddFontSizeToCombo3(hcmb3, points, lpcf);
if(i) return 0;
} else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
......@@ -705,7 +718,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOS
lpxx->lfHeight;
INT points;
int charset = lpxx->lfCharSet;
points = MulDiv( height, 72, GetDeviceCaps(hdc, LOGPIXELSY));
points = MulDiv( height, 72, GetScreenDPI());
pstyle = MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:
FW_NORMAL,lpxx->lfItalic !=0);
SendDlgItemMessageW(hDlg, cmb1, CB_SETCURSEL, j, 0);
......@@ -982,14 +995,8 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFO
CB_GETITEMDATA , i, 0));
else
lpcf->iPointSize = 100;
hdc = CFn_GetDC(lpcf);
if( hdc)
{
lpxx->lfHeight = - MulDiv( lpcf->iPointSize ,
GetDeviceCaps(hdc, LOGPIXELSY), 720);
CFn_ReleaseDC(lpcf, hdc);
} else
lpxx->lfHeight = -lpcf->iPointSize / 10;
lpxx->lfHeight = - MulDiv( lpcf->iPointSize ,
GetScreenDPI(), 720);
i=SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0);
if (i!=CB_ERR)
lpxx->lfCharSet=SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, i, 0);
......
......@@ -135,8 +135,8 @@ static void test_ChooseFontA(void)
expected_lfheight = -MulDiv(expected_pointsize, dpiy, 720);
ok(ret == TRUE, "ChooseFontA returned FALSE\n");
todo_wine ok(cfa.iPointSize == expected_pointsize, "Expected %i, got %i\n", expected_pointsize, cfa.iPointSize);
todo_wine ok(lfa.lfHeight == expected_lfheight, "Expected %i, got %i\n", expected_lfheight, lfa.lfHeight);
ok(cfa.iPointSize == expected_pointsize, "Expected %i, got %i\n", expected_pointsize, cfa.iPointSize);
ok(lfa.lfHeight == expected_lfheight, "Expected %i, got %i\n", expected_lfheight, lfa.lfHeight);
ok(lfa.lfWeight == FW_NORMAL, "Expected FW_NORMAL, got %i\n", lfa.lfWeight);
ok(strcmp(lfa.lfFaceName, "Symbol") == 0, "Expected Symbol, got %s\n", lfa.lfFaceName);
......
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