Calculate correct font pointSize for GetNonClientMetrics

wxNativeFontInfo constructor calculates the pointSize using the main screen DPI.
But lfHeight returned by GetNonClientMetrics is based on the window DPI.
This commit is contained in:
Maarten Bent
2019-08-25 15:27:28 +02:00
parent 219fa3fa89
commit 10fec15751
3 changed files with 30 additions and 4 deletions

View File

@@ -397,8 +397,17 @@ void wxMessageDialog::AdjustButtonLabels()
wxFont wxMessageDialog::GetMessageFont()
{
const wxWindow* win = wxTheApp ? wxTheApp->GetTopWindow() : NULL;
const NONCLIENTMETRICS& ncm = wxMSWImpl::GetNonClientMetrics(win);
return wxNativeFontInfo(ncm.lfMessageFont);
wxNativeFontInfo info(wxMSWImpl::GetNonClientMetrics(win).lfMessageFont);
// wxNativeFontInfo constructor calculates the pointSize using the
// main screen DPI. But lfHeight is based on the window DPI.
if ( win )
{
info.pointSize = wxNativeFontInfo::GetPointSizeAtPPI(
info.lf.lfHeight, win->GetDPI().y);
}
return info;
}
int wxMessageDialog::ShowMessageBox()