Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coordSizeUnscaled calculation in AtlasEngine #13384

Merged
1 commit merged into from
Jun 30, 2022

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Jun 27, 2022

This commit fixes a bug causing the OpenConsole to get increasingly larger
every time the font is changed when the AtlasEngine is active.
The only impact this bug had on Windows Terminal is that the
font-size in HTML and RTF selection copies are too large.

Validation Steps Performed

  • OpenConsole window size doesn't change when
    switching between main and alt buffer ✅

@lhecker lhecker added Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Area-AtlasEngine labels Jun 27, 2022
@DHowett
Copy link
Member

DHowett commented Jun 27, 2022

The only impact this bug had on Windows Terminal is that the
font-size in HTML and RTF selection copies are too large.

i kept noticing that and it was rubbing me the wrong way every time

{
// The coordSizeUnscaled parameter to SetFromEngine is used for API functions like GetConsoleFontSize.
// Since clients expect that settings the font height to Y yields back a font height of Y,
// we're scaling the X relative/proportional to the actual cellWidth/cellHeight ratio.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do not totally understand what is happening here :P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It assumes this to be true (mathematically speaking):

requestedSize.X / requestedSize.Y == coordSize.X / coordSize.Y

and thus computes requestedSize.X via:

requestedSize.X = requestedSize.Y * coordSize.X / coordSize.Y

DxEngine and AtlasEngine use the given requestedSize.Y as the font height in DIPs and add the line "paddings" on top of it, whereas GdiEngine uses it as the cell height.
I'm not sure how to best calculate the requestedSize.X, but this seems like a viable approach. I think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

@carlos-zamora
Copy link
Member

@msftbot merge this in 5 minutes

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jun 30, 2022
@ghost
Copy link

ghost commented Jun 30, 2022

Hello @carlos-zamora!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Thu, 30 Jun 2022 21:15:39 GMT, which is in 5 minutes

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@ghost ghost merged commit 8fba292 into main Jun 30, 2022
@ghost ghost deleted the dev/lhecker/atlas-engine-fixup branch June 30, 2022 21:16
@ghost
Copy link

ghost commented Jul 6, 2022

🎉Windows Terminal Preview v1.15.186 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AtlasEngine AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants