mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:54:13 +00:00
comdlg32: Always use screen dpi in the font dialog, even with a printer dc.
This commit is contained in:
parent
9bb6932e4b
commit
a19536587b
2 changed files with 21 additions and 14 deletions
|
@ -455,6 +455,21 @@ static inline HDC CFn_GetDC(const CHOOSEFONTW *lpcf)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* 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]
|
||||
*/
|
||||
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue