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

p10k prompt is not displayed correctly with AtlasEngine #16664

Closed
Mystic8b opened this issue Feb 4, 2024 · 4 comments
Closed

p10k prompt is not displayed correctly with AtlasEngine #16664

Mystic8b opened this issue Feb 4, 2024 · 4 comments
Labels
Area-AtlasEngine Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Milestone

Comments

@Mystic8b
Copy link

Mystic8b commented Feb 4, 2024

Windows Terminal version

1.19.10302.0

Windows build number

22631.3085

Other Software

WSL Ubuntu latest
ZSH
p10k (rainbow theme)
MesloLGS Nerd Font (from p10k repo)
9px font size

Steps to reproduce

Setup zsh, p10k, set rainbow theme by using p10k configure
Select MesloLGS NF with a font size of 9px in the terminal settings with AtlasEngine enabled.

Expected Behavior

Smooth borders of the prompt, like in this screenshot with AtlasEngine disabled
image

Actual Behavior

Incorrect prompt rendering
image

@Mystic8b Mystic8b added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Feb 4, 2024
@lhecker lhecker added Product-Terminal The new Windows Terminal. Priority-3 A description (P3) Area-AtlasEngine and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Feb 5, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Tag-Fix Doesn't match tag requirements and removed Needs-Tag-Fix Doesn't match tag requirements labels Feb 5, 2024
@zadjii-msft zadjii-msft added this to the Backlog milestone Feb 5, 2024
@lhecker
Copy link
Member

lhecker commented Feb 6, 2024

Given your font size of 9pt (FYI: not px - our font sizes are in pt) and an apparent line height of 15 pixels, I'm assuming that you're using a display scale of 100%, right?

In that case, please delete your Meslo NF font and then download and install the latest version here: https://www.nerdfonts.com/font-downloads (At the time of writing the direct link is: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/Meslo.zip)

This is because I found that the issue you've described does not occur on my PC in that case:
image

But you can see there that the "s" in ssh has the exact same pixel height as yours and the white box is also 15px tall. BTW this is super opinionated, but I personally definitely recommend enabling ClearType if you're using a 100% scale monitor. It'll add a somewhat ugly blue line in the rounded box, but it'll make the text a lot more legible in my opinion.

That aside, you can set fractional font sizes which allows you to solve this issue under most circumstances.

Lastly, I consider this an issue with the font itself, as we simply draw the glyphs exactly as they were designed. The only text renderer simply didn't have this issue because it cut off any overly large glyphs or distorted them if necessary. That has caused a ton of issues in the past and I personally don't wish to open that can of worms again. 😟 But this is a common issue with a lot of fonts (including our own Cascadia Code), and we intend to ship this workaround at some point: #5897

As such I'll close this issue for now and I'd suggest upvoting and following #5897 if you're interested in seeing this resolved properly in the future (we loosely use upvotes to see what features to implement in the future).

@lhecker lhecker closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Feb 6, 2024
@Mystic8b
Copy link
Author

Mystic8b commented Feb 6, 2024

This is because I found that the issue you've described does not occur on my PC in that case:

Your example has the same problem. One pixel bottom part is missing
image

I have already tried all variations of this font, there are problems everywhere. And the problems are only when using AtlasEngine. And you released it with the default renderer. You must fix this.

P10k uses its own version of the font and the developer says that the problem is in the terminal.

@lhecker
Copy link
Member

lhecker commented Feb 6, 2024

I believe it's important to mention that your screenshot is exactly how DirectWrite renders that glyph and there's no missing pixel on our end:
image

I do think it's weird though that the last row of pixels seems like it gets cut off by DirectWrite. I'll investigate why that occurs and if it's something we do wrong, I'll reopen this issue and use it to track a fix for the missing pixels.


That aside, I always agreed that this is an issue with Windows Terminal and that it needs to be fixed urgently, if possible. But in my opinion #5897 presents the best path towards fixing the issue and that's why I closed your issue, as I considered it to be a duplicate. I don't mean to ignore your issue and I apologize if it felt that way.

It's correct that we used to special case powerline glyphs in the past, but the way we did it was to "scale" glyphs to perfectly fit their box. This had a lot of subtle problems: "pixel perfect" fonts failed to work, font fallback didn't work correctly, and sometimes glyphs were misaligned. A lot of people complained about it over the years. Here's some: #8993, #13527, #13662, #14877

Scaling glyphs like that is something no other terminal did. If anything, they all use a technique as described in #5897 as it has none of the issues above, so I'll use #5897 to track a fix for this. I'll see if I can get it done sooner rather than later.

@lhecker
Copy link
Member

lhecker commented Feb 6, 2024

The bottom pixels are cut off because DirectWrite defaults to DWRITE_RENDERING_MODE_DEFAULT which seems to ignore the GASP table at small font sizes. If I explicitly use DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC it works as expected:
image

If more people would be interested in making this configurable, we could consider adding it as a setting. Right now, I'm not sure whether there's any benefit to making this configurable, since it doesn't address the powerline issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AtlasEngine Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

3 participants