Skip to content

Commit 34b8ed3

Browse files
authored
Account for custom cell sizes in launch size calculation (#18862)
When calculating the initial terminal window size, we weren't taking into account the line height and cell width settings, so the resulting number of rows and columns didn't match the requested launch size. Verification: Manually verified that the window is now correctly sized when using a custom line height and cell width. Closes #18582
1 parent 08e76da commit 34b8ed3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/cascadia/TerminalControl/TermControl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2825,6 +2825,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
28252825
const auto fontSize = settings.FontSize();
28262826
const auto fontWeight = settings.FontWeight();
28272827
const auto fontFace = settings.FontFace();
2828+
const auto cellWidth = CSSLengthPercentage::FromString(settings.CellWidth().c_str());
2829+
const auto cellHeight = CSSLengthPercentage::FromString(settings.CellHeight().c_str());
28282830
const auto scrollState = settings.ScrollState();
28292831
const auto padding = settings.Padding();
28302832

@@ -2836,6 +2838,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
28362838
// not, but DX doesn't use that info at all.
28372839
// The Codepage is additionally not actually used by the DX engine at all.
28382840
FontInfoDesired desiredFont{ fontFace, 0, fontWeight.Weight, fontSize, CP_UTF8 };
2841+
desiredFont.SetCellSize(cellWidth, cellHeight);
28392842
FontInfo actualFont{ fontFace, 0, fontWeight.Weight, desiredFont.GetEngineSize(), CP_UTF8, false };
28402843

28412844
// Create a DX engine and initialize it with our font and DPI. We'll

0 commit comments

Comments
 (0)