diff options
author | Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com> | 2022-04-07 08:54:43 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com> | 2022-04-07 08:54:43 -0400 |
commit | ac834437e6dd6e6231dcf96f1dde6b5ce0a9a612 (patch) | |
tree | 403d337c671be6257e9bac4d8682c2c548744cd3 /RadTerminal.cpp | |
parent | db80aa329a98983b1f767003ba45090346f8beb3 (diff) | |
download | RadTerminal-ac834437e6dd6e6231dcf96f1dde6b5ce0a9a612.tar.gz RadTerminal-ac834437e6dd6e6231dcf96f1dde6b5ce0a9a612.zip |
Disabled reading propreties from the registry. Added flag to supress DPI calculations in font assignment if the font size is already DPI corrected.
Diffstat (limited to 'RadTerminal.cpp')
-rw-r--r-- | RadTerminal.cpp | 18 |
1 files 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; } |