Add wxWindow::WXAdjustFontToOwnPPI()

Avoid calling GeTDPI() in font.WXAdjustToPPI(GetDPI()); invocations in
common code on platforms that don't need any adjustment (i.e. anything
other than MSW).

This fixes wxOSX crashes when GetFont() is called too early during
window creation, but is the right thing to do regardless.

Closes https://github.com/wxWidgets/wxWidgets/pull/2036

Closes #18903.
This commit is contained in:
Václav Slavík
2020-08-27 15:49:48 +02:00
committed by Vadim Zeitlin
parent 9e68df224f
commit 8efc6fb003
6 changed files with 21 additions and 10 deletions

View File

@@ -599,6 +599,8 @@ public:
void MSWUpdateOnDPIChange(const wxSize& oldDPI, const wxSize& newDPI);
protected:
virtual void WXAdjustFontToOwnPPI(wxFont& font) const wxOVERRIDE;
// Called from MSWUpdateOnDPIChange() specifically to update the control
// font, as this may need to be done differently for some specific native
// controls. The default version updates m_font of this window.