Require wxWindow parameter for wxNativeFontInfo constructor in MSW

Use the DPI of the window to determine the correct font pointSize.

To not break user code, add a default argument when not building the library.
This commit is contained in:
Maarten Bent
2019-08-27 23:14:35 +02:00
parent 2704d32089
commit 13cb9d41d8
8 changed files with 29 additions and 40 deletions

View File

@@ -348,7 +348,7 @@ void MenuDrawData::Init()
wxUxThemeFont themeFont;
::GetThemeSysFont(hTheme, TMT_MENUFONT, themeFont.GetPtr());
Font = wxFont(themeFont.GetLOGFONT());
Font = wxFont(wxNativeFontInfo(themeFont.GetLOGFONT(), window));
Theme = true;
@@ -392,15 +392,7 @@ void MenuDrawData::Init()
Offset = -12;
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);
Font = wxFont(wxNativeFontInfo(metrics.lfMenuFont, window));
Theme = false;
}