mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 13:47:59 -06:00
Fixes of DPI scaling on Windows.
This commit is contained in:
parent
dad8a47741
commit
e8325a8e2d
5 changed files with 17 additions and 21 deletions
|
@ -75,7 +75,7 @@ template<class F> typename F::FN winapi_get_function(const wchar_t *dll, const c
|
|||
#endif
|
||||
|
||||
// If called with nullptr, a DPI for the primary monitor is returned.
|
||||
int get_dpi_for_window(wxWindow *window)
|
||||
int get_dpi_for_window(const wxWindow *window)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
enum MONITOR_DPI_TYPE_ {
|
||||
|
@ -126,7 +126,7 @@ int get_dpi_for_window(wxWindow *window)
|
|||
#endif
|
||||
}
|
||||
|
||||
wxFont get_default_font_for_dpi(int dpi)
|
||||
wxFont get_default_font_for_dpi(const wxWindow *window, int dpi)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// First try to load the font with the Windows 10 specific way.
|
||||
|
@ -137,7 +137,7 @@ wxFont get_default_font_for_dpi(int dpi)
|
|||
memset(&nm, 0, sizeof(NONCLIENTMETRICS));
|
||||
nm.cbSize = sizeof(NONCLIENTMETRICS);
|
||||
if (SystemParametersInfoForDpi_fn(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &nm, 0, dpi))
|
||||
return wxFont(wxNativeFontInfo(nm.lfMessageFont));
|
||||
return wxFont(wxNativeFontInfo(nm.lfMessageFont, window));
|
||||
}
|
||||
// Then try to guesstimate the font DPI scaling on Windows 8.
|
||||
// Let's hope that the font returned by the SystemParametersInfo(), which is used by wxWidgets internally, makes sense.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue