1px line between powerline glyphs #12354

Closed
opened 2026-01-31 03:13:17 +00:00 by claunia · 22 comments
Owner

Originally created by @kaysond on GitHub (Feb 1, 2021).

Environment

Windows build number: Microsoft Windows [Version 10.0.19042.746]
Windows Terminal version (if applicable): 1.5.10271.0 & 1.6.10272.0

Steps to reproduce

Install any nerdfont
Set up anything that uses powerline glyphs (in my case, bobthefish plugin on fish shell)

Expected behavior

Clean rendering/placement of powerline glyphs (see Color schemes @ https://github.com/oh-my-fish/theme-bobthefish)

Actual behavior

The glyphs have a 1px line of the adjacent glyph color
image
Funnily enough, you can see the same thing in the powerline setup tutorial: https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup

Setting "useAcrylic": true and "acrylicOpacity" : 0.899 fixes one glyph, but not the other:
image

I've tried a variety of rendering options, fonts, sizes, etc, but none completely solve the problem. I also have the Windows text scaling set to 100%. I am on a high-dpi monitor (2560x1440) though.

I searched around and found #3626 #455 #4930 #633 #6669 but those aren't quite what's happening here. Sorry if I missed a dupe.

Originally created by @kaysond on GitHub (Feb 1, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: Microsoft Windows [Version 10.0.19042.746] Windows Terminal version (if applicable): 1.5.10271.0 & 1.6.10272.0 ``` # Steps to reproduce Install any nerdfont Set up anything that uses powerline glyphs (in my case, bobthefish plugin on fish shell) <!-- A description of how to trigger this bug. --> # Expected behavior Clean rendering/placement of powerline glyphs (see Color schemes @ https://github.com/oh-my-fish/theme-bobthefish) <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior The glyphs have a 1px line of the adjacent glyph color ![image](https://user-images.githubusercontent.com/1147328/106495319-60517d00-6470-11eb-9899-f3ed5b9fae4d.png) Funnily enough, you can see the same thing in the powerline setup tutorial: https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup Setting `"useAcrylic": true` and `"acrylicOpacity" : 0.899` fixes one glyph, but not the other: ![image](https://user-images.githubusercontent.com/1147328/106495944-259c1480-6471-11eb-805d-bb78275d0e45.png) I've tried a variety of rendering options, fonts, sizes, etc, but none completely solve the problem. I also have the Windows text scaling set to 100%. I am on a high-dpi monitor (2560x1440) though. I searched around and found #3626 #455 #4930 #633 #6669 but those aren't quite what's happening here. Sorry if I missed a dupe. <!-- What's actually happening? -->
Author
Owner

@zadjii-msft commented on GitHub (Feb 3, 2021):

#5897 and #373 both also look similar as well. I thought we were tracking this somewhere specifically, @miniksa might know where.

@zadjii-msft commented on GitHub (Feb 3, 2021): #5897 and #373 both also look similar as well. I thought we were tracking this somewhere specifically, @miniksa might know where.
Author
Owner

@miniksa commented on GitHub (Feb 3, 2021):

There isn't a specific place. Those links and this issue are good enough.

@miniksa commented on GitHub (Feb 3, 2021): There isn't a specific place. Those links and this issue are good enough.
Author
Owner

@Ririshi commented on GitHub (Mar 4, 2021):

I'm seeing the same issue with Cascadia Code PL, only when using cleartype antialiasing. I tested it on font sizes between 10 and 20 and it seems like all sizes suffer from it.

Example below with Powershell 7.1.2 using oh-my-posh v3 and the paradox theme:
image

It seems like the triangular shapes are shifted one pixel to the right when using cleartype AA, showing the background color. I'm unsure why the leftmost shape has a red line, though. If you look closely, you can also see the lines on the other triangular shapes. Upscaled 800% with nearest neighbour scaling:
image

@Ririshi commented on GitHub (Mar 4, 2021): I'm seeing the same issue with `Cascadia Code PL`, only when using `cleartype` antialiasing. I tested it on font sizes between 10 and 20 and it seems like all sizes suffer from it. Example below with Powershell 7.1.2 using oh-my-posh v3 and the `paradox` theme: ![image](https://user-images.githubusercontent.com/8461226/110004044-4af19c00-7d17-11eb-9841-1f6ff5d0c985.png) It seems like the triangular shapes are shifted one pixel to the right when using `cleartype` AA, showing the background color. I'm unsure why the leftmost shape has a red line, though. If you look closely, you can also see the lines on the other triangular shapes. Upscaled 800% with nearest neighbour scaling: ![image](https://user-images.githubusercontent.com/8461226/110004610-ebe05700-7d17-11eb-9058-c2e3701917fd.png)
Author
Owner

@nitz commented on GitHub (Aug 23, 2021):

I'm also seeing this issue with my setup, on preview 1.10.1933.0.

Config:

    "defaults": {
      "fontFace": "MesloLGS Nerd Font",
      "fontWeight": "normal",
      "useAcrylic": true,
      "acrylicOpacity": 0.4,
      "hidden": false,
      // also occurs worse with 'cleartype', but not with 'aliased'
      "antialiasingMode": "grayscale",
      "fontSize": 10
    },

Example of what I'm seeing, definitely with the  characters, but also with several other glyphs.

image image

I thought, perhaps it's because I'm using the non-mono NF? Well, that produces even weirder issues switching to it.

"fontFace": "MesloLGS Nerd Font" "fontFace": "MesloLGS Nerd Font Mono"
image image
"Apple" glyph cut off, as are the triangle and cap characters showing issues. Apple glyph no longer cut as all symbol glyphs appear smaller, but the caps are still showing issues. Additionally, the 'flame' glyphs appear to be doubled.

It definitely seems to be something related to the antialiasing, given that using "aliased" doesn't show the issue at all. Meanwhile, "cleartype" can make it appear worse. Additionally, it seems that the fontSize has an effect on it as well.

"aliased" "cleartype" "grayscale"
image image image
No rendering issues, but not lovely to look at. Issues left round cap, as well as triangle glyphs. Triangle issue gone, cap issue persists.
@nitz commented on GitHub (Aug 23, 2021): I'm also seeing this issue with my setup, on preview 1.10.1933.0. Config: ```jsonc "defaults": { "fontFace": "MesloLGS Nerd Font", "fontWeight": "normal", "useAcrylic": true, "acrylicOpacity": 0.4, "hidden": false, // also occurs worse with 'cleartype', but not with 'aliased' "antialiasingMode": "grayscale", "fontSize": 10 }, ``` Example of what I'm seeing, definitely with the  characters, but also with several other glyphs. ![image](https://user-images.githubusercontent.com/602691/130476763-3b1ac5a5-744e-4747-9f5c-a98286debf7a.png) | ![image](https://user-images.githubusercontent.com/602691/130477115-8fe5bf9b-9daa-45fa-aa1d-da0e396d622d.png) :-:|:-: I thought, perhaps it's because I'm using the non-mono NF? Well, that produces even weirder issues switching to it. "fontFace": "MesloLGS Nerd Font" | "fontFace": "MesloLGS Nerd Font Mono" :----:|:----: ![image](https://user-images.githubusercontent.com/602691/130477230-5ded4d92-527d-4946-a25d-2c7594358c4c.png) | ![image](https://user-images.githubusercontent.com/602691/130477383-d7277e8d-b65e-48a5-9fe3-654cc32b1128.png) "Apple" glyph cut off, as are the triangle and cap characters showing issues.| Apple glyph no longer cut as all symbol glyphs appear smaller, but the caps are still showing issues. Additionally, the 'flame' glyphs appear to be doubled. It definitely seems to be something related to the antialiasing, given that using "aliased" doesn't show the issue at all. Meanwhile, "cleartype" can make it appear worse. Additionally, it seems that the fontSize has an effect on it as well. "aliased"|"cleartype"|"grayscale" :--------:|:-----------:|:-----------: ![image](https://user-images.githubusercontent.com/602691/130478806-0ce16e91-13a5-4224-b70b-42ec83e203fd.png) | ![image](https://user-images.githubusercontent.com/602691/130478608-fb05e8b9-5c60-43eb-9ca6-f4fb2793d0a1.png) | ![image](https://user-images.githubusercontent.com/602691/130478726-62276ef7-793f-45f8-b3a7-ab64bed8a259.png) No rendering issues, but not lovely to look at. | Issues left round cap, as well as triangle glyphs. | Triangle issue gone, cap issue persists.
Author
Owner

@miniksa commented on GitHub (Aug 26, 2021):

Thank you for the investigation and various screenshots, @nitz. I'm wondering if @lhecker's plans to do #10461 will end up sorting this out since I believe it uses slightly different measurements and anti-aliasing phases than what we're currently doing.

@miniksa commented on GitHub (Aug 26, 2021): Thank you for the investigation and various screenshots, @nitz. I'm wondering if @lhecker's plans to do #10461 will end up sorting this out since I believe it uses slightly different measurements and anti-aliasing phases than what we're currently doing.
Author
Owner

@SHJordan commented on GitHub (Nov 28, 2021):

Is there a way to disable cleartype within VS Code and IntelliJ Idea? It fixed my issue on windows terminal.

@SHJordan commented on GitHub (Nov 28, 2021): Is there a way to disable cleartype within VS Code and IntelliJ Idea? It fixed my issue on windows terminal.
Author
Owner

@MattBDev commented on GitHub (May 2, 2022):

I just wanted to share that on 1.13.10983.0 with Windows 10 19043.1645 (21H1) and with experimental.useAtlasEngine enabled, the issue still occurs. I hope this issue will be fixed "soon". 😄

@MattBDev commented on GitHub (May 2, 2022): I just wanted to share that on 1.13.10983.0 with Windows 10 19043.1645 (21H1) and with `experimental.useAtlasEngine` enabled, the issue still occurs. I hope this issue will be fixed "soon". 😄
Author
Owner

@SHJordan commented on GitHub (May 3, 2022):

What fixed it for me, as a AMD GPU user, was disabling VSR(Virtual Super Resolution) and Integer Scaling. Both settings can be found on AMD SOFTWARE. Hope it helps.

@SHJordan commented on GitHub (May 3, 2022): What fixed it for me, as a AMD GPU user, was disabling VSR(Virtual Super Resolution) and Integer Scaling. Both settings can be found on AMD SOFTWARE. Hope it helps.
Author
Owner

@kaysond commented on GitHub (Jul 10, 2022):

I'm now running Ubuntu 22.04 LTS on terminal version 1.13.11431.0 on Win10 Pro 19044.1766 (21H2) and with the following appearance settings, this seems to be fixed:
image
image

@kaysond commented on GitHub (Jul 10, 2022): I'm now running Ubuntu 22.04 LTS on terminal version 1.13.11431.0 on Win10 Pro 19044.1766 (21H2) and with the following appearance settings, this seems to be fixed: ![image](https://user-images.githubusercontent.com/1147328/178133452-7977c165-daf9-442f-a86e-5a60400b412e.png) ![image](https://user-images.githubusercontent.com/1147328/178133463-bf08dcf4-e0a0-4354-ab62-452feb6e5b8e.png)
Author
Owner

@kaysond commented on GitHub (Jun 16, 2023):

@zadjii-msft - this looks like its back (or maybe it never went away...) on the right side only, though:
image

@kaysond commented on GitHub (Jun 16, 2023): @zadjii-msft - this looks like its back (or maybe it never went away...) on the right side only, though: ![image](https://github.com/microsoft/terminal/assets/1147328/476e438b-c24e-4f6d-ae52-023a03a0845b)
Author
Owner

@lhecker commented on GitHub (Jun 16, 2023):

@kaysond We use the so called "glyph advance width" of the character "0" to determine the width of the cells in the terminal. That value might not always match powerline glyphs exactly (down to the pixel), because many such fonts aren't designed perfectly either. I would definitely recommend trying out the latest version of your font first. Maybe it got improved already?

But if you open the settings.json file via the settings dialog you can explicitly override that cell width like so:

{
    "profiles":
    {
        "defaults":
        {
            "font":
            {
                "face": "...",
                "cellWidth": "10px"
            }
        },
    },
}

You'll have to experiment a little bit what value works best for you. The setting works just like CSS units so you can also use a relative value like 0.5ch.

@lhecker commented on GitHub (Jun 16, 2023): @kaysond We use the so called "glyph advance width" of the character "0" to determine the width of the cells in the terminal. That value might not always match powerline glyphs exactly (down to the pixel), because many such fonts aren't designed perfectly either. I would definitely recommend trying out the latest version of your font first. Maybe it got improved already? But if you open the `settings.json` file via the settings dialog you can explicitly override that cell width like so: ```json { "profiles": { "defaults": { "font": { "face": "...", "cellWidth": "10px" } }, }, } ``` You'll have to experiment a little bit what value works best for you. The setting works just like CSS units so you can also use a relative value like `0.5ch`.
Author
Owner

@kaysond commented on GitHub (Jun 16, 2023):

@kaysond We use the so called "glyph advance width" of the character "0" to determine the width of the cells in the terminal. That value might not always match powerline glyphs exactly (down to the pixel), because many such fonts aren't designed perfectly either. I would definitely recommend trying out the latest version of your font first. Maybe it got improved already?

I tried the latest version of the font from nerdfonts, and it didn't help. Presumably since the glyphs are added programmatically, they'd be the same width... I could be wrong though - how would I test this?

But if you open the settings.json file via the settings dialog you can explicitly override that cell width like so:
You'll have to experiment a little bit what value works best for you. The setting works just like CSS units so you can also use a relative value like 0.5ch.

That doesn't really work - looks like the default is 9px; if I change it down to 8px, it compresses everything else in the terminal prompt, ruining the rest of the look. Seems fractional values aren't possible (I was wondering if it's a resolution thing)

@kaysond commented on GitHub (Jun 16, 2023): > @kaysond We use the so called "glyph advance width" of the character "0" to determine the width of the cells in the terminal. That value might not always match powerline glyphs exactly (down to the pixel), because many such fonts aren't designed perfectly either. I would definitely recommend trying out the latest version of your font first. Maybe it got improved already? I tried the latest version of the font from nerdfonts, and it didn't help. Presumably since the glyphs are added programmatically, they'd be the same width... I could be wrong though - how would I test this? > But if you open the `settings.json` file via the settings dialog you can explicitly override that cell width like so: > You'll have to experiment a little bit what value works best for you. The setting works just like CSS units so you can also use a relative value like `0.5ch`. That doesn't really work - looks like the default is 9px; if I change it down to 8px, it compresses everything else in the terminal prompt, ruining the rest of the look. Seems fractional values aren't possible (I was wondering if it's a resolution thing)
Author
Owner

@kaysond commented on GitHub (Jun 16, 2023):

So I did some digging, and this is definitely a rendering issue.

The glyphs themselves are exactly the same width. You can see the source here:

I tried two different nerdfonts: Ubuntu Mono and Roboto Mono. These should both have the exact same glyph. Depending on the font size and the font, the issue appears or goes away:
image

We use the so called "glyph advance width" of the character "0" to determine the width of the cells in the terminal.

Given that this is the case, and that the font size matters and the problem only happens on one direction, I wonder if there's some kind of rounding/flooring error when the glyph is being scaled...

@kaysond commented on GitHub (Jun 16, 2023): So I did some digging, and this is definitely a rendering issue. The glyphs themselves are exactly the same width. You can see the source here: - https://github.com/ryanoasis/powerline-extra-symbols/blob/master/src/uniE0B0_Powerline_normal-left.eps - https://github.com/ryanoasis/powerline-extra-symbols/blob/master/src/uniE0B2_Powerline_normal-right.eps I tried two different [nerdfonts](https://www.nerdfonts.com/font-downloads): Ubuntu Mono and Roboto Mono. These should both have the exact same glyph. Depending on the font size and the font, the issue appears or goes away: ![image](https://github.com/microsoft/terminal/assets/1147328/41d32ff7-ec80-4b37-8747-8b1fc5b47371) > We use the so called "glyph advance width" of the character "0" to determine the width of the cells in the terminal. Given that this is the case, and that the font size matters *and* the problem only happens on one direction, I wonder if there's some kind of rounding/flooring error when the glyph is being scaled...
Author
Owner

@lhecker commented on GitHub (Jun 16, 2023):

Our terminal doesn't allow proportional font rendering (just like most other terminals), but Nerd Fonts are not "perfectly" monospace, visually speaking. They would need manual hinting to work correctly here. You can verify our renderer's behavior with Microsoft's reference text renderer "VisualTrueType" (VTT). In theory it should match it exactly (after pressing Alt+G / enabling GASP in VTT).

I've tested it with the NF (non-Mono) variant and the latest version 3.0.2 and the result looks immediately exactly like what you're reporting:

a magnified screenshot of the reference text renderer

It's the same 21px tall as in your screenshot, has the same single, dark pixel at the bottom, and shows that the right border has been anti-aliased in the same, unfortunate way: It's tinted blue in this case, but with your current foreground color of #444444 this turns into a dark-ish gray.

Do you have a proposal what we could do better here?

@lhecker commented on GitHub (Jun 16, 2023): Our terminal doesn't allow proportional font rendering (just like most other terminals), but Nerd Fonts are not "perfectly" monospace, visually speaking. They would need manual hinting to work correctly here. You can verify our renderer's behavior with Microsoft's reference text renderer "VisualTrueType" (VTT). In theory it should match it exactly (after pressing Alt+G / enabling GASP in VTT). I've tested it with the NF (non-Mono) variant and the latest version 3.0.2 and the result looks immediately exactly like what you're reporting: ![a magnified screenshot of the reference text renderer](https://github.com/microsoft/terminal/assets/2256941/91fb42b3-0009-4e3f-a187-17c54f7bc28f) It's the same 21px tall as in your screenshot, has the same single, dark pixel at the bottom, and shows that the right border has been anti-aliased in the same, unfortunate way: It's tinted blue in this case, but with your current foreground color of `#444444` this turns into a dark-ish gray. Do you have a proposal what we could do better here?
Author
Owner

@kaysond commented on GitHub (Jun 16, 2023):

@lhecker - this is a cool tool, thanks! I tried to match your setup with ClearType settings (I did turn on GASP mode) and while it's not exacty the same, it seems to be close enough in terms of dimensions... Btw, I'm using UbuntuMonoNerdFontMono-Regular.ttf

Knowing nothing about font rendering, here are my observations:

  • The width of the ClearType "0" is 10px. The width of non-CT is 8px.
  • The left and right powerline glyphs are rendered exactly the same, just flipped, at 11px or 12px (non-CT, CT).
  • The full height block is 10px or 12px

The most interesting thing to my eye, though, is that the space between the vertical blue lines, which I've marked, is always10px. I'm guessing maybe that's the glyph width?

If you look down a column, you'll see that all those glyphs line up very nicely. Even with the anti-aliasing, if a 10px wide column were used, corresponding to those lines, and the glyphs were rendered and positioned as in VTT, there would be no gaps in the rendering between powerline glyphs, right?

image

@kaysond commented on GitHub (Jun 16, 2023): @lhecker - this is a cool tool, thanks! I tried to match your setup with ClearType settings (I did turn on GASP mode) and while it's not exacty the same, it seems to be close enough in terms of dimensions... Btw, I'm using `UbuntuMonoNerdFontMono-Regular.ttf` Knowing nothing about font rendering, here are my observations: - The width of the ClearType "0" is 10px. The width of non-CT is 8px. - The left and right powerline glyphs are rendered exactly the same, just flipped, at 11px or 12px (non-CT, CT). - The full height block is 10px or 12px The most interesting thing to my eye, though, is that the space between the vertical blue lines, which I've marked, is always10px. I'm guessing maybe that's the glyph width? If you look down a column, you'll see that all those glyphs line up very nicely. Even with the anti-aliasing, if a 10px wide column were used, corresponding to those lines, and the glyphs were rendered and positioned as in VTT, there would be no gaps in the rendering between powerline glyphs, right? ![image](https://github.com/microsoft/terminal/assets/1147328/76f199fc-f6a2-44d2-8c90-bf053a487b4e)
Author
Owner

@kaysond commented on GitHub (Aug 7, 2023):

Bump. @lhecker @zadjii-msft can you reopen this? Based on the above I don't think it's resolved.

@kaysond commented on GitHub (Aug 7, 2023): Bump. @lhecker @zadjii-msft can you reopen this? Based on the above I don't think it's resolved.
Author
Owner

@lhecker commented on GitHub (Aug 7, 2023):

@kaysond I'm sorry, I forgot to respond last time.

The most interesting thing to my eye, though, is that the space between the vertical blue lines, which I've marked, is always10px. I'm guessing maybe that's the glyph width?

That's the advance width. It indicates how much the "cursor" moves when writing that glyph. For monospace fonts the advance width is usually always the same for all glyphs, but of course that's not a strict requirement. Glyphs might also be wider than the advance width. That's especially true for cursive/italic text. When you mix in font fallback however, almost no monospace text ends up being strictly monospace. (But Windows Terminal forces glyphs into a monospace grid.)

That width is not measured in pixels, but rather in "font design units". The header of each .ttf file includes a "units per em" (UPM) field, which indicates how many units result in 1em. Usually that value is 2048, but 1000 or similar are also common. All values in .ttf are expressed in "font design units". The advance width for Consolas for instance is 1126 and it has an UPM of 2048, which results in an advance width of about 0.55em. At a font size of 20pt, this results in an advance width of pretty much exactly 1126 / 2048 * 20 = 11pt. Ubuntu Mono NF has an advance width of 500 and a UPM of 1000 (= 10pt).

If you look down a column, you'll see that all those glyphs line up very nicely. Even with the anti-aliasing, if a 10px wide column were used, corresponding to those lines, and the glyphs were rendered and positioned as in VTT, there would be no gaps in the rendering between powerline glyphs, right?

Yep, there would be no gaps. (But there would be slightly visible red/blue lines when ClearType is used, because the glyphs do slightly overlap. This comment shows them: https://github.com/microsoft/terminal/issues/8993#issuecomment-790795815)

But the problem is that you set VTT to a font size of 20pt at a display resolution of 72 DPI (the default in VTT). 72 DPI is the resolution of "pt" but if you want "px" at 100% display scale you need to choose 96 DPI (150% display scale = 144 DPI, and so on).

For instance, the 0 glyph at 13pt and 96 DPI looks like this (17ppem, 8 dx (width), 11 dy (height), I forgot to enable GASP mode - it will look a bit different then):
image

The problem is the advance width there, which is "8 43/64 dx", or 8.67px. We currently round that value to the nearest pixel value which is 9px (as you've already found), but you've also said that 8px feels too squished.

If we were to support a technique called "subpixel positioning", we could probably solve the issue. It's a common technique in modern font rendering where you (for instance) have 3x the horizontal resolution for glyph positions. For every glyph you prepare 3 versions with a 0/3rd, 1/3rd and 2/3rd pixel offset. This will make them all 3 look a tiny bit different.

So, if you encounter a glyph coordinate like 8.67px you choose the 3rd variant with the 0.67px offset. If you have 15 "0"s in a row you're at coordinate 15*8.67 = 130px, so you chose the 1st variant.
But significant parts of the Windows Terminal code base treat pixel coordinates as integers, so I personally don't intend to pursue that topic within the next year(s). There are areas that are in much worse shape than our text rendering (like our Unicode support for instance), so I need to focus on that. The same is true for the other team members.
I would be extremely happy about PRs working towards that goal, however. I believe a request to support fractional advance widths would warrant a new issue since it would improve more than just powerline glyphs, so I'll open one now and put it on the backlog (#15805).

@lhecker commented on GitHub (Aug 7, 2023): @kaysond I'm sorry, I forgot to respond last time. > The most interesting thing to my eye, though, is that the space between the vertical blue lines, which I've marked, is always10px. I'm guessing maybe that's the glyph width? That's the advance width. It indicates how much the "cursor" moves when writing that glyph. For monospace fonts the advance width is usually always the same for all glyphs, but of course that's not a strict requirement. Glyphs might also be wider than the advance width. That's especially true for cursive/italic text. When you mix in font fallback however, almost no monospace text ends up being strictly monospace. (But Windows Terminal forces glyphs into a monospace grid.) That width is not measured in pixels, but rather in "font design units". The header of each .ttf file includes a "units per em" (UPM) field, which indicates how many units result in 1em. Usually that value is 2048, but 1000 or similar are also common. All values in .ttf are expressed in "font design units". The advance width for Consolas for instance is 1126 and it has an UPM of 2048, which results in an advance width of about 0.55em. At a font size of 20pt, this results in an advance width of pretty much exactly 1126 / 2048 * 20 = 11pt. Ubuntu Mono NF has an advance width of 500 and a UPM of 1000 (= 10pt). > If you look down a column, you'll see that all those glyphs line up very nicely. Even with the anti-aliasing, if a 10px wide column were used, corresponding to those lines, and the glyphs were rendered and positioned as in VTT, there would be no gaps in the rendering between powerline glyphs, right? Yep, there would be no gaps. (But there would be slightly visible red/blue lines when ClearType is used, because the glyphs do slightly overlap. This comment shows them: https://github.com/microsoft/terminal/issues/8993#issuecomment-790795815) But the problem is that you set VTT to a font size of 20pt at a display resolution of 72 DPI (the default in VTT). 72 DPI is the resolution of "pt" but if you want "px" at 100% display scale you need to choose 96 DPI (150% display scale = 144 DPI, and so on). For instance, the 0 glyph at 13pt and 96 DPI looks like this (17ppem, 8 dx (width), 11 dy (height), I forgot to enable GASP mode - it will look a bit different then): ![image](https://github.com/microsoft/terminal/assets/2256941/e55e809c-ca4e-43ef-b6c1-3d2ed9daa547) The problem is the advance width there, which is "8 43/64 dx", or 8.67px. We currently round that value to the nearest pixel value which is 9px (as you've already found), but you've also said that 8px feels too squished. If we were to support a technique called "subpixel positioning", we could probably solve the issue. It's a common technique in modern font rendering where you (for instance) have 3x the horizontal resolution for glyph positions. For every glyph you prepare 3 versions with a 0/3rd, 1/3rd and 2/3rd pixel offset. This will make them all 3 look a tiny bit different. So, if you encounter a glyph coordinate like 8.67px you choose the 3rd variant with the 0.67px offset. If you have 15 "0"s in a row you're at coordinate 15*8.67 = 130px, so you chose the 1st variant. But significant parts of the Windows Terminal code base treat pixel coordinates as integers, so I personally don't intend to pursue that topic within the next year(s). There are areas that are in much worse shape than our text rendering (like our Unicode support for instance), so I need to focus on that. The same is true for the other team members. I would be extremely happy about PRs working towards that goal, however. I believe a request to support fractional advance widths would warrant a new issue since it would improve more than just powerline glyphs, so I'll open one now and put it on the backlog (#15805).
Author
Owner

@kaysond commented on GitHub (Aug 8, 2023):

@lhecker Thank you very much for the deep dive! Makes sense to me.

@kaysond commented on GitHub (Aug 8, 2023): @lhecker Thank you very much for the deep dive! Makes sense to me.
Author
Owner

@reitowo commented on GitHub (Aug 26, 2023):

Actually ENABLING AtlasEngine will cause JetBrain Mono to act like this:
image

@reitowo commented on GitHub (Aug 26, 2023): Actually **ENABLING** AtlasEngine will cause `JetBrain Mono` to act like this: ![image](https://github.com/microsoft/terminal/assets/29846655/427e0a80-afed-417d-b552-2fb5bc53a737)
Author
Owner

@lhecker commented on GitHub (Aug 26, 2023):

@cnSchwarzer AtlasEngine disabled, JetBrainsMono Nerd Font, 10pt:
image

Both, the old and new renderer have the exact same issue. Just at different font sizes.
If you use 13pt with AtlasEngine enabled, instead of 12pt, the gaps will be gone.

@lhecker commented on GitHub (Aug 26, 2023): @cnSchwarzer AtlasEngine disabled, JetBrainsMono Nerd Font, 10pt: ![image](https://github.com/microsoft/terminal/assets/2256941/c122f7a7-e95a-42e2-a09c-16ec70fd5ac3) Both, the old and new renderer have the exact same issue. Just at different font sizes. If you use 13pt with AtlasEngine enabled, instead of 12pt, the gaps will be gone.
Author
Owner

@Kayzels commented on GitHub (Mar 3, 2024):

@cnSchwarzer AtlasEngine disabled, JetBrainsMono Nerd Font, 10pt: image

Both, the old and new renderer have the exact same issue. Just at different font sizes. If you use 13pt with AtlasEngine enabled, instead of 12pt, the gaps will be gone.

Encountered the same. With any font size except 10pt, JetBrains Mono Nerd Font seems fine. But at size 10 specifically, the glyph e0b6 has this line next to it whenever text follows.

Unfortunately, size 9 feels way too small, and size 11 too big. I'm wondering if there is any solution to fix this specifically for size 10? Closest solution I've found is to set the font size to 10.5.

@Kayzels commented on GitHub (Mar 3, 2024): > @cnSchwarzer AtlasEngine disabled, JetBrainsMono Nerd Font, 10pt: ![image](https://private-user-images.githubusercontent.com/2256941/263492831-c122f7a7-e95a-42e2-a09c-16ec70fd5ac3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDk0Njc0NTYsIm5iZiI6MTcwOTQ2NzE1NiwicGF0aCI6Ii8yMjU2OTQxLzI2MzQ5MjgzMS1jMTIyZjdhNy1lOTVhLTQyZTItYTA5Yy0xNmVjNzBmZDVhYzMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMwMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMDNUMTE1OTE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWJhOWMyMjkxM2M5ZTkxMzgyZjQyYmU2YWMwZWY4NjIzMjMyYmNiODg5MjRhMTQxNDIyMjc5NWVlOWZmNThiZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.soKnrtwrnqMggU2ed0gzJmxr-wudT-4U9iwEZk1dfxA) > > Both, the old and new renderer have the exact same issue. Just at different font sizes. If you use 13pt with AtlasEngine enabled, instead of 12pt, the gaps will be gone. Encountered the same. With any font size except 10pt, JetBrains Mono Nerd Font seems fine. But at size 10 specifically, the glyph e0b6 has this line next to it whenever text follows. Unfortunately, size 9 feels way too small, and size 11 too big. I'm wondering if there is any solution to fix this specifically for size 10? Closest solution I've found is to set the font size to 10.5.
Author
Owner

@lhecker commented on GitHub (Mar 3, 2024):

FYI #16729 was merged recently and it fixes this issue fundamentally. It will ship in 1.21 in a few months. In the meantime, you can find the Canary version that has it already here: https://aka.ms/terminal-canary-installer

If you find any issues with that version, please don't comment here, but open a new issue instead (a simple screenshot of the issue will be sufficient).

@lhecker commented on GitHub (Mar 3, 2024): FYI #16729 was merged recently and it fixes this issue fundamentally. It will ship in 1.21 in a few months. In the meantime, you can find the Canary version that has it already here: https://aka.ms/terminal-canary-installer If you find any issues with that version, please don't comment here, but open a new issue instead (a simple screenshot of the issue will be sufficient).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12354