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

@@ -3207,7 +3207,8 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
// CHARFORMAT stores it to pixel-based units used by LOGFONT.
// Note that RichEdit seems to always use standard DPI of 96, even when the
// window is a monitor using a higher DPI.
lf.lfHeight = wxNativeFontInfo::GetLogFontHeightAtPPI(cf.yHeight/20.0f, 96);
lf.lfHeight = wxNativeFontInfo::GetLogFontHeightAtPPI(cf.yHeight/20.0f,
GetDPI().y);
lf.lfWidth = 0;
lf.lfCharSet = ANSI_CHARSET; // FIXME: how to get correct charset?
lf.lfClipPrecision = 0;
@@ -3240,7 +3241,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
else
lf.lfWeight = FW_NORMAL;
wxFont font(lf);
wxFont font(wxNativeFontInfo(lf, this));
if (font.IsOk())
{
style.SetFont(font);