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:
@@ -392,7 +392,15 @@ void MenuDrawData::Init()
|
||||
|
||||
Offset = -12;
|
||||
|
||||
Font = wxFont(wxNativeFontInfo(metrics.lfMenuFont));
|
||||
wxNativeFontInfo info(metrics.lfMenuFont);
|
||||
// wxNativeFontInfo constructor calculates the pointSize using the
|
||||
// main screen DPI. But lfHeight is based on the window DPI.
|
||||
if ( window )
|
||||
{
|
||||
info.pointSize = wxNativeFontInfo::GetPointSizeAtPPI(
|
||||
info.lf.lfHeight, window->GetDPI().y);
|
||||
}
|
||||
Font = wxFont(info);
|
||||
|
||||
Theme = false;
|
||||
}
|
||||
|
@@ -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()
|
||||
|
@@ -183,8 +183,17 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
||||
// controls may prefer to use lfStatusFont or lfCaptionFont if it
|
||||
// is more appropriate for them
|
||||
const wxWindow* win = wxTheApp ? wxTheApp->GetTopWindow() : NULL;
|
||||
const wxNativeFontInfo
|
||||
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);
|
||||
}
|
||||
|
||||
gs_fontDefault = new wxFont(info);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user