From ac834437e6dd6e6231dcf96f1dde6b5ce0a9a612 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Thu, 7 Apr 2022 08:54:43 -0400 Subject: Disabled reading propreties from the registry. Added flag to supress DPI calculations in font assignment if the font size is already DPI corrected. --- RadTerminal.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/RadTerminal.cpp b/RadTerminal.cpp index afed179..cd9fb12 100644 --- a/RadTerminal.cpp +++ b/RadTerminal.cpp @@ -117,6 +117,7 @@ ATOM GetRadTerminalAtom(HINSTANCE hInstance) struct RadTerminalCreate { int iFontHeight; + BOOL fontDpiCorrected; std::tstring strFontFace; std::tstring strScheme; COORD szCon; @@ -186,6 +187,7 @@ RadTerminalCreate GetTerminalCreate(bool bParseCmdLine, std::tstring profile) RadTerminalCreate rtc = {}; rtc.iFontHeight = 16; + rtc.fontDpiCorrected = FALSE; //rtc.strFontFace = _T("Courier New"); rtc.strFontFace = _T("Consolas"); //rtc.strFontFace = _T("Cascadia Code"); @@ -196,8 +198,8 @@ RadTerminalCreate GetTerminalCreate(bool bParseCmdLine, std::tstring profile) rtc.strCommand = _T("cmd"); rtc.workDirectory = _T(""); - LoadRegistry(rtc, _T("Default")); - LoadRegistry(rtc, profile.c_str()); + //LoadRegistry(rtc, _T("Default")); + //LoadRegistry(rtc, profile.c_str()); if (bParseCmdLine) ParseCommandLine(rtc); @@ -884,7 +886,9 @@ BOOL CreateFonts(HWND hWnd, tsm_screen_draw_info* const di, const UINT dpi) for (int u = 0; u < 2; ++u) { CHECK(di->hFonts[b][i][u] == NULL || DeleteObject(di->hFonts[b][i][u]), FALSE); - CHECK(di->hFonts[b][i][u] = CreateFont(di->strFontFace.c_str(), MulDiv(di->iFontHeight, dpi, USER_DEFAULT_SCREEN_DPI), b == 0 ? FW_NORMAL : FW_BOLD, i, u), FALSE); + CHECK(di->hFonts[b][i][u] = CreateFont(di->strFontFace.c_str(), + dpi == 0 ? di->iFontHeight : MulDiv(di->iFontHeight, dpi, USER_DEFAULT_SCREEN_DPI), + b == 0 ? FW_NORMAL : FW_BOLD, i, u), FALSE); } HDC hdc = GetDC(hWnd); @@ -937,8 +941,8 @@ BOOL RadTerminalWindowOnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct) #endif } - const UINT dpi = GetDpiForWindow(hWnd); - + const UINT dpi = rtc->fontDpiCorrected ? 0 : GetDpiForWindow(hWnd); + data->draw_info.iFontHeight = rtc->iFontHeight; data->draw_info.strFontFace = rtc->strFontFace; CreateFonts(hWnd, &data->draw_info, dpi); @@ -1373,7 +1377,7 @@ void RadTerminalWindowOnSizing(HWND hWnd, UINT edge, LPRECT prRect) const DWORD style = GetWindowStyle(hWnd); const DWORD exstyle = GetWindowExStyle(hWnd); const BOOL fMenu = GetMenu(hWnd) != NULL; - CHECK_ONLY(UnadjustWindowRectExForDpi(prRect, style, fMenu, exstyle, dpi)); + //CHECK_ONLY(UnadjustWindowRectExForDpi(prRect, style, fMenu, exstyle, dpi)); if (style & WS_VSCROLL) prRect->right -= GetSystemMetricsForDpi(SM_CXVSCROLL, dpi); SIZE sz = GetCellSize(&data->draw_info); @@ -1403,7 +1407,7 @@ void RadTerminalWindowOnSizing(HWND hWnd, UINT edge, LPRECT prRect) if (style & WS_VSCROLL) prRect->right += GetSystemMetricsForDpi(SM_CXVSCROLL, dpi); - CHECK_ONLY(AdjustWindowRectExForDpi(prRect, style, fMenu, exstyle, dpi)); + //CHECK_ONLY(AdjustWindowRectExForDpi(prRect, style, fMenu, exstyle, dpi)); //prRect->right += 100; } -- cgit v1.2.3