microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.08k stars 8.24k forks source link

Inconsistent font width between Terminal restarts #16836

Closed dkaszews closed 6 months ago

dkaszews commented 6 months ago

Windows Terminal version

1.19.10573.0

Windows build number

10.0.19044.0

Other Software

No response

Steps to reproduce

After restarting Terminal, all fonts are ~10% wider, but not taller (same number of rows, 10% less columns). No appearance settings have been changed. I am unable to go back to old look, and the new one is looking slighly uncanny, the characters are looking too spread out. See screenshots for comparison, top line is old (desired) look, bottom is new look. Hard to tell if issue is in width of characters, spacing, or kerning.

image

Expected Behavior

Fonts should stay consistent.

Actual Behavior

Fonts change their look.

github-actions[bot] commented 6 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

dkaszews commented 6 months ago

Additional info related to display:

DHowett commented 6 months ago

I'm guessing that you used to be running 1.18, and that this may be due to the new text rendering engine.

@lhecker can share tips on controlling the cell size[^1] with the new renderer or otherwise help you troubleshoot.

[^1]: Which is itself a new feature that came out in 1.19! You can set pixel perfect sizing for cells in the terminal, and use fractional font sizes.

dkaszews commented 6 months ago

@DHowett Might be, as the Atlas engine was enabled and disabling it fixed the issue until system reboot, now toggling it back and forth does nothing. So there may also be a bug that the renderer engine toggle is broken. The fractional font size might be the thing I'm looking for, as it looks like maybe it rounds values differently and setting it to something like 11.9p would give me back the old look.

DHowett commented 6 months ago

So, the heart of the issue is that the old rendering engine actually scaled text down below your requested point size; it was never giving you a true 12pt at that scale factor. Atlas is a lot more accurate, but occasionally things like this crop up where people really preferred the old look.

Atlas is, fortunately, also what enables better cell size customization:

image

image

lhecker commented 6 months ago

[...] now toggling it back and forth does nothing.

The toggle is not broken, but you do need to restart the application after changing it. I intended to add such a description to avoid confusion earlier this year, but the next release will remove the old text renderer anyways so it was sort of not on my mind for a while. It's not very often that people use the toggle either.


Unfortunately, I can't really help with tracking down why it behaves differently. I tried replicating your settings and for me the cell width is completely unchanged: image

I would definitely recommend re-enabling AtlasEngine, due to the removal of the alternative in the next release. You can then fix the unpleasant cell width by opening your settings file with Ctrl+Shift+, and finding the "defaults" key. Then you can make it look like this:

{
    // ...
    "profiles":
    {
        "defaults":
        {
            "font": {
                "cellWidth": "9.5px",
                "cellHeight": "19px"
            }
        },
        // ...
    },
    // ...
}

You may have to adjust the width/height slightly to match the old text renderer. Since I was unable to reproduce a difference, I unfortunately can't recommend any exact numbers (the above should be roughly correct though).


That said, I'll close this issue, as the ~1px difference in cell-width/height results from slightly changed rounding behaviors. I did this after lots of testing with dozens of fonts to avoid cutting of glyphs. We added the cellWidth/Height setting for this exact reason, as it allows you to then customize the text renderer to suit your needs exactly.

dkaszews commented 6 months ago

The toggle is not broken, but you do need to restart the application after changing it.

Did that, did not help.

Still, thank you for detailed explanation, I will play around with the settings you described and hopefully find a look I like. Are the cell width/height available in options, or just JSON file? I find there are quite a bit of those, maybe adding some comment with link to reference would help with discovery.

lhecker commented 6 months ago

Are the cell width/height available in options, or just JSON file?

Only in the JSON file at the moment. We have a line-height setting in the UI which is the same as the cellHeight setting in JSON, but with a more familiar name. I felt like most people who search for something like this would expect to find a setting called "line height" and so I added that and hid the underlying setting to avoid confusion. I wouldn't mind adding the two settings though - I just need a good idea how to make it user-friendly and discoverable.

dkaszews commented 6 months ago

Playing around I found that 9/18px matches almost perfectly what I am used to, thank you once again for resolving my issue.

The "Line height" setting is confusing, as the comment says "Measured as multiple of the font size [...] default is usually around 1.2", but for me it defaults to 10 which is also the max value. Maybe because of the zoom I use? Touching it changes the cellHeight but using absolute values instead of pixels, trying to input 18px just changes it to 10, messing up what I put in JSON.