-- intermediate version

This commit is contained in:
RaiKoHoff 2020-06-15 16:06:21 +02:00
parent ab67fc14f4
commit a897f9b8a6
9 changed files with 144 additions and 49 deletions

View File

@ -18,15 +18,20 @@ extern "C" {
#if defined(_WIN32)
/* Return false on failure: */
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
typedef struct _dpi_t { unsigned x; unsigned y; } DPI_T;
#define VC_EXTRALEAN 1
#define WIN32_LEAN_AND_MEAN 1
typedef struct _dpi_t { unsigned x; unsigned y; } DPI_T;
__declspec(dllexport) void Scintilla_LoadDpiForWindow(void);
__declspec(dllexport) int Scintilla_RegisterClasses(void *hInstance);
__declspec(dllexport) int Scintilla_ReleaseResources(void);
__declspec(dllexport) int Scintilla_InputCodePage(void);
__declspec(dllexport) DPI_T Scintilla_GetCurrentDPI(void* hwnd);
__declspec(dllexport) int Scintilla_GetSystemMetricsEx(void* hwnd, int nIndex);
__declspec(dllexport) DPI_T Scintilla_GetWindowDPI(void* hwnd);
__declspec(dllexport) int Scintilla_GetSystemMetricsForDpi(int nIndex, DPI_T dpi);
__declspec(dllexport) bool Scintilla_AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, DPI_T dpi);
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#endif
int Scintilla_LinkLexers(void);
#ifdef __cplusplus

View File

@ -144,7 +144,7 @@ int SystemMetricsForDpi(int nIndex, unsigned dpi) {
return ((dpi == g_uSystemDPI) ? value : ::MulDiv(value, dpi, g_uSystemDPI));
}
BOOL DpiAdjustWindowRect(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, unsigned dpi) {
BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, unsigned dpi) {
if (fnAdjustWindowRectExForDpi) {
return fnAdjustWindowRectExForDpi(lpRect, dwStyle, FALSE, dwExStyle, dpi);
}
@ -2990,11 +2990,11 @@ void ListBoxX::SetList(const char *list, const char separator, const char typese
void ListBoxX::AdjustWindowRect(PRectangle *rc, UINT dpi) noexcept {
RECT rcw = RectFromPRectangle(*rc);
#if LISTBOXX_USE_THICKFRAME
DpiAdjustWindowRect(&rcw, WS_THICKFRAME, WS_EX_WINDOWEDGE, dpi);
AdjustWindowRectForDpi(&rcw, WS_THICKFRAME, WS_EX_WINDOWEDGE, dpi);
#elif LISTBOXX_USE_BORDER
DpiAdjustWindowRect(&rcw, WS_BORDER, WS_EX_WINDOWEDGE, dpi);
AdjustWindowRectForDpi(&rcw, WS_BORDER, WS_EX_WINDOWEDGE, dpi);
#else
DpiAdjustWindowRect(&rcw, 0, WS_EX_WINDOWEDGE, dpi);
AdjustWindowRectForDpi(&rcw, 0, WS_EX_WINDOWEDGE, dpi);
#endif
*rc = PRectangle::FromInts(rcw.left, rcw.top, rcw.right, rcw.bottom);
#if LISTBOXX_USE_FAKE_FRAME

View File

@ -47,11 +47,11 @@
#ifndef __cplusplus
extern "C" DPI_T GetWindowDPI(HWND hwnd);
extern "C" int SystemMetricsForDpi(int nIndex, unsigned dpi);
extern "C" BOOL DpiAdjustWindowRect(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, unsigned dpi);
extern "C" BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, unsigned dpi);
#else
DPI_T GetWindowDPI(HWND hwnd);
int SystemMetricsForDpi(int nIndex, unsigned dpi);
BOOL DpiAdjustWindowRect(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, unsigned dpi);
BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, unsigned dpi);
#endif // !__cplusplus

View File

@ -4093,13 +4093,17 @@ int Scintilla_InputCodePage(void) {
}
extern "C" __declspec(dllexport)
DPI_T Scintilla_GetCurrentDPI(void* hwnd) {
DPI_T Scintilla_GetWindowDPI(void* hwnd) {
return GetWindowDPI(static_cast<HWND>(hwnd));
}
extern "C" __declspec(dllexport)
int Scintilla_GetSystemMetricsEx(void* hwnd, int nIndex) {
DPI_T const _dpi = GetWindowDPI(static_cast<HWND>(hwnd));
return SystemMetricsForDpi(nIndex, _dpi.y);
int Scintilla_GetSystemMetricsForDpi(int nIndex, DPI_T dpi) {
return SystemMetricsForDpi(nIndex, dpi.y);
}
extern "C" __declspec(dllexport)
bool Scintilla_AdjustWindowRectForDpi(RECT* lpRect, DWORD dwStyle, DWORD dwExStyle, DPI_T dpi) {
return AdjustWindowRectForDpi(lpRect, dwStyle, dwExStyle, dpi.y);
}

View File

@ -867,7 +867,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Screen-Resolution -> %i x %i [pix]", ResX, ResY);
StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf);
DPI_T dpi = Scintilla_GetCurrentDPI(hwnd);
DPI_T dpi = Scintilla_GetWindowDPI(hwnd);
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Display-DPI -> %i x %i (Scale: %i%%).", dpi.x, dpi.y, ScaleIntToDPI_X(hwnd, 100));
StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf);
@ -3918,6 +3918,8 @@ void GetDlgPos(HWND hDlg, LPINT xDlg, LPINT yDlg)
//
void SetDlgPos(HWND hDlg, int xDlg, int yDlg)
{
if (!hDlg) { return; }
RECT rcDlg;
GetWindowRect(hDlg, &rcDlg);
@ -3950,8 +3952,14 @@ void SetDlgPos(HWND hDlg, int xDlg, int yDlg)
// Resize Dialog Helpers()
//
#define RESIZEDLG_PROP_KEY L"ResizeDlg"
#define MAX_RESIZEDLG_ATTR_COUNT 2
// temporary fix for moving dialog to monitor with different DPI
// TODO: all dimensions no longer valid after window DPI changed.
#define NP3_ENABLE_RESIZEDLG_TEMP_FIX 1
typedef struct _resizeDlg {
int direction;
DPI_T dpi;
int cxClient;
int cyClient;
int mmiPtMinX;
@ -3963,22 +3971,19 @@ typedef struct _resizeDlg {
typedef const RESIZEDLG* LPCRESIZEDLG;
void ResizeDlg_Init(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, RSZ_DLG_DIR iDirection)
void ResizeDlg_InitEx(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, RSZ_DLG_DIR iDirection)
{
RESIZEDLG* const pm = (RESIZEDLG*)AllocMem(sizeof(RESIZEDLG), HEAP_ZERO_MEMORY);
pm->direction = iDirection;
pm->dpi = Scintilla_GetWindowDPI(hwnd);
RECT rc;
GetClientRect(hwnd, &rc);
pm->cxClient = rc.right - rc.left;
pm->cyClient = rc.bottom - rc.top;
if (pm->direction < 0)
AdjustWindowRectEx(&rc, GetWindowLong(hwnd, GWL_STYLE) & ~WS_THICKFRAME, FALSE, 0);
else
AdjustWindowRectEx(&rc, GetWindowLong(hwnd, GWL_STYLE) | WS_THICKFRAME, FALSE, 0);
const DWORD style = (pm->direction < 0) ? (GetWindowStyle(hwnd) & ~WS_THICKFRAME) : (GetWindowStyle(hwnd) | WS_THICKFRAME);
Scintilla_AdjustWindowRectForDpi(&rc, style, 0, pm->dpi);
pm->mmiPtMinX = rc.right - rc.left;
pm->mmiPtMinY = rc.bottom - rc.top;
@ -3999,11 +4004,7 @@ void ResizeDlg_Init(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, RSZ_DLG_DI
SetWindowPos(hwnd, NULL, rc.left, rc.top, cxFrame, cyFrame, SWP_NOZORDER);
if (pm->direction < 0)
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_THICKFRAME);
else
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | WS_THICKFRAME);
SetWindowStyle(hwnd, style);
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
WCHAR wch[MAX_PATH];
@ -4011,11 +4012,11 @@ void ResizeDlg_Init(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, RSZ_DLG_DI
InsertMenu(GetSystemMenu(hwnd, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_STRING | MF_ENABLED, SC_SIZE, wch);
InsertMenu(GetSystemMenu(hwnd, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_SEPARATOR, 0, NULL);
if ((pm->direction >= 0)) {
if (pm->direction >= 0) {
HWND const hwndCtl = GetDlgItem(hwnd, nIdGrip);
if (hwndCtl) {
SetWindowLongPtr(hwndCtl, GWL_STYLE, GetWindowLongPtr(hwndCtl, GWL_STYLE) | SBS_SIZEGRIP | WS_CLIPSIBLINGS);
const int cGrip = Scintilla_GetSystemMetricsEx(hwnd, SM_CXHTHUMB);
SetWindowStyle(hwndCtl, GetWindowStyle(hwndCtl) | SBS_SIZEGRIP | WS_CLIPSIBLINGS);
int const cGrip = Scintilla_GetSystemMetricsForDpi(SM_CXHTHUMB, pm->dpi);
SetWindowPos(hwndCtl, NULL, pm->cxClient - cGrip, pm->cyClient - cGrip, cGrip, cGrip, SWP_NOZORDER);
}
}
@ -4043,6 +4044,19 @@ void ResizeDlg_Size(HWND hwnd, LPARAM lParam, int* cx, int* cy)
PRESIZEDLG pm = (PRESIZEDLG)GetProp(hwnd, RESIZEDLG_PROP_KEY);
const int cxClient = LOWORD(lParam);
const int cyClient = HIWORD(lParam);
#if NP3_ENABLE_RESIZEDLG_TEMP_FIX
const DPI_T dpi = Scintilla_GetWindowDPI(hwnd);
const DPI_T old = pm->dpi;
if (cx) {
*cx = cxClient - MulDiv(pm->cxClient, dpi.x, old.x);
}
if (cy) {
*cy = cyClient - MulDiv(pm->cyClient, dpi.y, old.y);
}
// store in original DPI.
pm->cxClient = MulDiv(cxClient, old.x, dpi.x);
pm->cyClient = MulDiv(cyClient, old.y, dpi.y);
#else
if (cx) {
*cx = cxClient - pm->cxClient;
}
@ -4051,13 +4065,31 @@ void ResizeDlg_Size(HWND hwnd, LPARAM lParam, int* cx, int* cy)
}
pm->cxClient = cxClient;
pm->cyClient = cyClient;
#endif
}
void ResizeDlg_GetMinMaxInfo(HWND hwnd, LPARAM lParam)
{
LPCRESIZEDLG pm = (LPCRESIZEDLG)GetProp(hwnd, RESIZEDLG_PROP_KEY);
LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
#if NP3_ENABLE_RESIZEDLG_TEMP_FIX
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
DPI_T const old = pm->dpi;
lpmmi->ptMinTrackSize.x = MulDiv(pm->mmiPtMinX, dpi.x, old.x);
lpmmi->ptMinTrackSize.y = MulDiv(pm->mmiPtMinY, dpi.y, old.y);
// only one direction
switch (pm->direction) {
case RSZ_ONLY_X:
lpmmi->ptMaxTrackSize.y = MulDiv(pm->mmiPtMaxY, dpi.x, old.x);
break;
case RSZ_ONLY_Y:
lpmmi->ptMaxTrackSize.x = MulDiv(pm->mmiPtMaxX, dpi.y, old.y);
break;
}
#else
lpmmi->ptMinTrackSize.x = pm->mmiPtMinX;
lpmmi->ptMinTrackSize.y = pm->mmiPtMinY;
@ -4066,10 +4098,12 @@ void ResizeDlg_GetMinMaxInfo(HWND hwnd, LPARAM lParam)
case RSZ_ONLY_X:
lpmmi->ptMaxTrackSize.y = pm->mmiPtMaxY;
break;
case RSZ_ONLY_Y:
lpmmi->ptMaxTrackSize.x = pm->mmiPtMaxX;
break;
}
#endif
}
void ResizeDlg_SetAttr(HWND hwnd, int index, int value) {
@ -4094,13 +4128,40 @@ static inline int GetDlgCtlHeight(HWND hwndDlg, int nCtlId) {
return height;
}
void ResizeDlgCtl(HWND hwndDlg, int nCtlId, int dx, int dy) {
HWND const hwndCtl = GetDlgItem(hwndDlg, nCtlId);
RECT rc;
GetWindowRect(hwndCtl, &rc);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)& rc, 2);
SetWindowPos(hwndCtl, NULL, 0, 0, rc.right - rc.left + dx, rc.bottom - rc.top + dy, SWP_NOZORDER | SWP_NOMOVE);
InvalidateRect(hwndCtl, NULL, TRUE);
void ResizeDlg_InitY2Ex(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, int iDirection, int nCtlId1, int nCtlId2) {
const int hMin1 = GetDlgCtlHeight(hwnd, nCtlId1);
const int hMin2 = GetDlgCtlHeight(hwnd, nCtlId2);
ResizeDlg_InitEx(hwnd, cxFrame, cyFrame, nIdGrip, iDirection);
PRESIZEDLG pm = (PRESIZEDLG)GetProp(hwnd, RESIZEDLG_PROP_KEY);
pm->attrs[0] = hMin1;
pm->attrs[1] = hMin2;
}
int ResizeDlg_CalcDeltaY2(HWND hwnd, int dy, int cy, int nCtlId1, int nCtlId2) {
if (dy == 0) {
return 0;
}
if (dy > 0) {
return MulDiv(dy, cy, 100);
}
const LPCRESIZEDLG pm = (LPCRESIZEDLG)GetProp(hwnd, RESIZEDLG_PROP_KEY);
#if NP3_ENABLE_RESIZEDLG_TEMP_FIX
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
int const hMinX = MulDiv(pm->attrs[0], dpi.x, pm->dpi.x);
int const hMinY = MulDiv(pm->attrs[1], dpi.y, pm->dpi.y);
#else
int const hMin1 = pm->attrs[0];
int const hMin2 = pm->attrs[1];
#endif
int const h1 = GetDlgCtlHeight(hwnd, nCtlId1);
int const h2 = GetDlgCtlHeight(hwnd, nCtlId2);
// cy + h1 >= hMin1 cy >= hMin1 - h1
// dy - cy + h2 >= hMin2 cy <= dy + h2 - hMin2
int const cyMin = hMinX - h1;
int const cyMax = dy + h2 - hMinY;
cy = dy - MulDiv(dy, 100 - cy, 100);
cy = clampi(cy, cyMin, cyMax);
return cy;
}
@ -4116,6 +4177,16 @@ HDWP DeferCtlPos(HDWP hdwp, HWND hwndDlg, int nCtlId, int dx, int dy, UINT uFlag
}
void ResizeDlgCtl(HWND hwndDlg, int nCtlId, int dx, int dy) {
HWND const hwndCtl = GetDlgItem(hwndDlg, nCtlId);
RECT rc;
GetWindowRect(hwndCtl, &rc);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc, 2);
SetWindowPos(hwndCtl, NULL, 0, 0, rc.right - rc.left + dx, rc.bottom - rc.top + dy, SWP_NOZORDER | SWP_NOMOVE);
InvalidateRect(hwndCtl, NULL, TRUE);
}
//=============================================================================
//
// MakeBitmapButton()
@ -4541,7 +4612,7 @@ void UpdateWindowLayoutForDPI(HWND hWnd, RECT* pRC, DPI_T* pDPI)
return;
}
DPI_T const wndDPI = pDPI ? *pDPI : Scintilla_GetCurrentDPI(hWnd);
DPI_T const wndDPI = pDPI ? *pDPI : Scintilla_GetWindowDPI(hWnd);
RECT rc;
GetWindowRect(hWnd, &rc);

View File

@ -17,7 +17,11 @@
#ifndef _NP3_DIALOGS_H_
#define _NP3_DIALOGS_H_
#ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#endif
#include "TypeDefs.h"
#include "Scintilla.h"
@ -72,7 +76,16 @@ void SetDlgPos(HWND hDlg, int xDlg, int yDlg);
// resize dialog directions
typedef enum { RSZ_NONE = -1, RSZ_BOTH = 0, RSZ_ONLY_X = 1, RSZ_ONLY_Y = 2 } RSZ_DLG_DIR;
void ResizeDlg_Init(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, RSZ_DLG_DIR iDirection);
void ResizeDlg_InitEx(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, RSZ_DLG_DIR iDirection);
inline void ResizeDlg_Init(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip) {
ResizeDlg_InitEx(hwnd, cxFrame, cyFrame, nIdGrip, RSZ_BOTH);
}
inline void ResizeDlg_InitX(HWND hwnd, int cxFrame, int nIdGrip) {
ResizeDlg_InitEx(hwnd, cxFrame, 0, nIdGrip, RSZ_ONLY_X);
}
inline void ResizeDlg_InitY(HWND hwnd, int cyFrame, int nIdGrip) {
ResizeDlg_InitEx(hwnd, 0, cyFrame, nIdGrip, RSZ_ONLY_Y);
}
void ResizeDlg_Destroy(HWND hwnd, int* cxFrame, int* cyFrame);
void ResizeDlg_Size(HWND hwnd, LPARAM lParam, int* cx, int* cy);
void ResizeDlg_GetMinMaxInfo(HWND hwnd, LPARAM lParam);
@ -106,32 +119,32 @@ int Toolbar_SetButtons(HANDLE, int, LPCWSTR, void*, int);
DPI_T GetCurrentPPI(HWND hwnd);
inline int ScaleIntToDPI_X(HWND hwnd, int val) { DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd); return MulDiv((val), dpi.x, USER_DEFAULT_SCREEN_DPI); }
inline int ScaleIntToDPI_Y(HWND hwnd, int val) { DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd); return MulDiv((val), dpi.y, USER_DEFAULT_SCREEN_DPI); }
inline int ScaleIntToDPI_X(HWND hwnd, int val) { DPI_T const dpi = Scintilla_GetWindowDPI(hwnd); return MulDiv((val), dpi.x, USER_DEFAULT_SCREEN_DPI); }
inline int ScaleIntToDPI_Y(HWND hwnd, int val) { DPI_T const dpi = Scintilla_GetWindowDPI(hwnd); return MulDiv((val), dpi.y, USER_DEFAULT_SCREEN_DPI); }
inline int ScaleFloatToDPI_X(HWND hwnd, float fVal) { DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd); return (int)lroundf((fVal * dpi.x) / (float)USER_DEFAULT_SCREEN_DPI); }
inline int ScaleFloatToDPI_Y(HWND hwnd, float fVal) { DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd); return (int)lroundf((fVal * dpi.y) / (float)USER_DEFAULT_SCREEN_DPI); }
inline int ScaleFloatToDPI_X(HWND hwnd, float fVal) { DPI_T const dpi = Scintilla_GetWindowDPI(hwnd); return (int)lroundf((fVal * dpi.x) / (float)USER_DEFAULT_SCREEN_DPI); }
inline int ScaleFloatToDPI_Y(HWND hwnd, float fVal) { DPI_T const dpi = Scintilla_GetWindowDPI(hwnd); return (int)lroundf((fVal * dpi.y) / (float)USER_DEFAULT_SCREEN_DPI); }
inline int ScaleIntFontSizeWidth(HWND hwnd, int val) {
DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd);
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
DPI_T const ppi = GetCurrentPPI(hwnd);
return MulDiv((val), dpi.x, ppi.x);
}
inline int ScaleIntFontSizeHeight(HWND hwnd, int val) {
DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd);
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
DPI_T const ppi = GetCurrentPPI(hwnd);
return MulDiv((val), dpi.y, ppi.y);
}
inline int ScaleFloatFontSize(HWND hwnd, float fSize) {
DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd);
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
DPI_T const ppi = GetCurrentPPI(hwnd);
return (int)lroundf((fSize * (float)dpi.y) / (float)ppi.y);
}
inline int ScaleFractionalFontSize(HWND hwnd, float fSize) {
DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd);
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
DPI_T const ppi = GetCurrentPPI(hwnd);
return (int)lroundf((fSize * (float)dpi.y) / (float)ppi.y) * SC_FONT_SIZE_MULTIPLIER;
}

View File

@ -161,6 +161,8 @@ inline bool IsAsyncKeyDown(int key) { return (((GetAsyncKeyState(key) >> 8) & 0x
#define SendWMCommand(hwnd, id) SendWMCommandEx(hwnd, (id), 1)
#define PostWMCommand(hwnd, id) PostMessage(hwnd, WM_COMMAND, MAKEWPARAM((id), 1), 0)
#define SetWindowStyle(hwnd, style) SetWindowLong(hwnd, GWL_STYLE, (style))
//==== StrIs(Not)Empty() =============================================
inline bool StrIsEmptyA(LPCSTR s) { return (!s || (*s == '\0')); }

View File

@ -2245,7 +2245,7 @@ static HIMAGELIST CreateScaledImageListFromBitmap(HWND hWnd, HBITMAP hBmp)
HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR32 | ILC_MASK, NUMTOOLBITMAPS, NUMTOOLBITMAPS);
ImageList_AddMasked(himl, hBmp, CLR_DEFAULT);
DPI_T dpi = Scintilla_GetCurrentDPI(hWnd);
DPI_T dpi = Scintilla_GetWindowDPI(hWnd);
if (!Settings.DpiScaleToolBar ||
((dpi.x == USER_DEFAULT_SCREEN_DPI) && (dpi.y == USER_DEFAULT_SCREEN_DPI)))
{

View File

@ -3334,7 +3334,7 @@ bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam
if (!ChooseFont(&cf) || StrIsEmpty(lf.lfFaceName)) { return false; }
#else
if (Settings.RenderingTechnology > 0) {
DPI_T const dpi = Scintilla_GetCurrentDPI(hwnd);
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
const WCHAR* const localName = Settings2.PreferredLanguageLocaleName;
if (!ChooseFontDirectWrite(Globals.hwndMain, localName, dpi, &cf) || StrIsEmpty(lf.lfFaceName)) { return false; }
// HACK: to get the full font name instead of font family name