Some fonts' italic text has wavy baselines #18445

Closed
opened 2026-01-31 06:14:15 +00:00 by claunia · 22 comments
Owner

Originally created by @indika-dev on GitHub (Sep 14, 2022).

Windows Terminal version

1.16.2523.0

Windows build number

10.0.19043.0

Other Software

neovim 0.7.2 (WSL2)
FiraCode NF, 12pt as Terminal Font
colorscheme github_dark

Steps to reproduce

Open a java source code file and comments are wavy, non-comment code lines are as expected
WavyCommentLines

Expected Behavior

Open a java source code file and comments look the same way as other code lines

Actual Behavior

comment lines are wavy

Originally created by @indika-dev on GitHub (Sep 14, 2022). ### Windows Terminal version 1.16.2523.0 ### Windows build number 10.0.19043.0 ### Other Software neovim 0.7.2 (WSL2) FiraCode NF, 12pt as Terminal Font colorscheme github_dark ### Steps to reproduce Open a java source code file and comments are wavy, non-comment code lines are as expected ![WavyCommentLines](https://user-images.githubusercontent.com/56093026/190098169-7a6dd970-e306-47a0-a6fd-73ec37e72f8e.jpg) ### Expected Behavior Open a java source code file and comments look the same way as other code lines ### Actual Behavior comment lines are wavy
Author
Owner

@zadjii-msft commented on GitHub (Sep 14, 2022):

Looks like the text is just formatted as italic by neovim. I'm sure whatever neovim config you're using has options for configuring how different elements are rendered - you can always disable it there.

I'm sure there's a way to use font features to disable italics, though, I don't know it off the top of my head.

@zadjii-msft commented on GitHub (Sep 14, 2022): Looks like the text is just formatted as italic by neovim. I'm sure whatever neovim config you're using has options for configuring how different elements are rendered - you can always disable it there. I'm sure there's a way to use [font features](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-appearance#font-features) to disable italics, though, I don't know it off the top of my head.
Author
Owner

@indika-dev commented on GitHub (Sep 14, 2022):

Hi @zadjii-msft ,

that's right, that the comments are formatted in italics, that's defined in the colorscheme. Good point with the configuration, I will try that.
But this only appears in Windows Terminal. With wezterm, the same code is rendered as it should be. Therefore, I think, this is still a bug.
NoWavyCommentLines

@indika-dev commented on GitHub (Sep 14, 2022): Hi @zadjii-msft , that's right, that the comments are formatted in italics, that's defined in the colorscheme. Good point with the configuration, I will try that. But this only appears in Windows Terminal. With wezterm, the same code is rendered as it should be. Therefore, I think, this is still a bug. ![NoWavyCommentLines](https://user-images.githubusercontent.com/56093026/190145207-ef83c8a7-0881-466e-8d84-0f8911f3b53c.jpg)
Author
Owner

@zadjii-msft commented on GitHub (Sep 14, 2022):

@indika-dev Does wezterm support italics as emitted by client apps? @wez for some help. Maybe there's something in the default config that disables them for wezterm. (sorry for not being more familiar with wezterm. I probably should be.)

@zadjii-msft commented on GitHub (Sep 14, 2022): @indika-dev Does wezterm support italics as emitted by client apps? @wez for some help. Maybe there's something in the default config that disables them for wezterm. (sorry for not being more familiar with wezterm. I probably should be.)
Author
Owner

@indika-dev commented on GitHub (Sep 14, 2022):

Sorry, but I don't know, what you mean with "...italics as emitted by client apps". What I found in the documentation is this. But I didn't configure this.
neovim itself does not configure fonts. The terminal renders the "output" of neovim.

@indika-dev commented on GitHub (Sep 14, 2022): Sorry, but I don't know, what you mean with "...italics as emitted by client apps". What I found in the documentation is [this.](https://wezfurlong.org/wezterm/config/lua/config/font_rules.html) But I didn't configure this. neovim itself does not configure fonts. The terminal renders the "output" of neovim.
Author
Owner

@zadjii-msft commented on GitHub (Sep 14, 2022):

I mean along the lines of #5461. Apps like vim can tell the Terminal "I want this text to be italicized" in the same way they tell the Terminal "I want this text to be red".

@zadjii-msft commented on GitHub (Sep 14, 2022): I mean along the lines of #5461. Apps like vim can tell the Terminal "I want this text to be italicized" in the same way they tell the Terminal "I want this text to be red".
Author
Owner

@wez commented on GitHub (Sep 14, 2022):

Yeah, wezterm supports italics (CSI 3 m to enable, CSI 23 m to disable).

My read of this issue is that the problem is that the italics have a wavy baseline in the image in the OP, which suggests to me an issue with how the glyphs are rasterized/hinted, rather than an issue with understanding whether italics should be enabled.

If someone reported this to me in wezterm, I'd be curious about whether it was font specific: wezterm uses a feature of freetype to synthesize italics (by skewing the glyph) when no italic variant of the font is found, and that can behave differently from "normal" font rendering, and I wonder if there are parallels to that in the MS font shaper/rasterizer stack used in MS terminal?

@wez commented on GitHub (Sep 14, 2022): Yeah, wezterm supports italics (`CSI 3 m` to enable, `CSI 23 m` to disable). My read of this issue is that the problem is that the italics have a wavy baseline in the image in the OP, which suggests to me an issue with how the glyphs are rasterized/hinted, rather than an issue with understanding whether italics should be enabled. If someone reported this to me in wezterm, I'd be curious about whether it was font specific: wezterm uses a feature of freetype to synthesize italics (by skewing the glyph) when no italic variant of the font is found, and that can behave differently from "normal" font rendering, and I wonder if there are parallels to that in the MS font shaper/rasterizer stack used in MS terminal?
Author
Owner

@zadjii-msft commented on GitHub (Sep 14, 2022):

My read of this issue is that the problem is that the italics have a wavy baseline in the image in the

goodness gracious, thanks for that. I clearly didn't have enough coffee this morning and just figured OP meant "italic" when they said "wavy". Yea, the baselines do look a little wavy, don't they. Huh.

@indika-dev can you give us your whole settings.json file/? The exact set of settings should help with a repro here.

@zadjii-msft commented on GitHub (Sep 14, 2022): > My read of this issue is that the problem is that the italics have a wavy baseline in the image in the goodness gracious, thanks for that. I clearly didn't have enough coffee this morning and just figured OP meant "italic" when they said "wavy". Yea, the baselines **do** look a little wavy, don't they. Huh. @indika-dev can you give us your whole [settings.json file](https://github.com/microsoft/terminal/wiki/Frequently-Asked-Questions-(FAQ)#where-can-i-find-the-settings-file)/? The exact set of settings should help with a repro here.
Author
Owner

@wez commented on GitHub (Sep 14, 2022):

I clearly didn't have enough coffee this morning

It's still pretty early!

@wez commented on GitHub (Sep 14, 2022): > I clearly didn't have enough coffee this morning It's still pretty early!
Author
Owner

@indika-dev commented on GitHub (Sep 14, 2022):

I took a look at #5461 and Nerd Fonts were mentioned. So, I tested a bit and it looks like, that the wavy lines only appear under certain Nerd Fonts:

  • FiraCode NF, CascadiaCove PL and JetBrainsMono NF have wavy lines
  • SauceCodePro NF and BlexMono Nerd Font have no wavy lines
@indika-dev commented on GitHub (Sep 14, 2022): I took a look at #5461 and Nerd Fonts were mentioned. So, I tested a bit and it looks like, that the wavy lines only appear under certain Nerd Fonts: - FiraCode NF, CascadiaCove PL and JetBrainsMono NF have wavy lines - SauceCodePro NF and BlexMono Nerd Font have **no** wavy lines
Author
Owner

@indika-dev commented on GitHub (Sep 14, 2022):

@indika-dev can you give us your whole settings.json file/?

Sure, here it is.
settings.zip

@indika-dev commented on GitHub (Sep 14, 2022): > @indika-dev can you give us your whole [settings.json file](https://github.com/microsoft/terminal/wiki/Frequently-Asked-Questions-(FAQ)#where-can-i-find-the-settings-file)/? Sure, here it is. [settings.zip](https://github.com/microsoft/terminal/files/9567119/settings.zip)
Author
Owner

@DHowett commented on GitHub (Sep 14, 2022):

Hey @lhecker, is this related to your glyph scaler?

@DHowett commented on GitHub (Sep 14, 2022): Hey @lhecker, is this related to your glyph scaler?
Author
Owner

@lhecker commented on GitHub (Sep 14, 2022):

It sure is. FiraCode without adjusting glyph position:
image

With adjustments:
image

Thoughts:

  • Scaling should be relative to the baseline and not to the center of the cell and would probably fix this issue. (But is this correct?)
  • Currently talking internally with DirectWrite wizards why we're getting weird glyph metrics for italic Fira Code (edit: turns out that IDWriteTextLayout::GetOverhangMetrics returns incorrect/overzealous metrics for simulated italics)
    Fun fact: Fira Code has no italic variant. It's automatically generated by DirectWrite and that's the primary source of these issues you're seeing.
@lhecker commented on GitHub (Sep 14, 2022): It sure is. FiraCode without adjusting glyph position: ![image](https://user-images.githubusercontent.com/2256941/190239573-f67d661c-f715-4067-ad04-926d9c13abf5.png) With adjustments: ![image](https://user-images.githubusercontent.com/2256941/190239718-c96d53c6-3213-4993-9c3f-ad553528c713.png) Thoughts: * Scaling should be relative to the baseline and not to the center of the cell and would probably fix this issue. (But is this correct?) * Currently talking internally with DirectWrite wizards why we're getting weird glyph metrics for italic Fira Code (**edit:** turns out that `IDWriteTextLayout::GetOverhangMetrics` returns incorrect/overzealous metrics for simulated italics) Fun fact: Fira Code has no italic variant. It's automatically generated by DirectWrite and that's the primary source of these issues you're seeing.
Author
Owner

@birtles commented on GitHub (Sep 15, 2022):

I see the same with Caskaydia Cove Nerd Font from https://www.nerdfonts.com/font-downloads (also using Neovim)

image

It appeared fine before Terminal was updated to 1.16 this morning.

@birtles commented on GitHub (Sep 15, 2022): I see the same with Caskaydia Cove Nerd Font from https://www.nerdfonts.com/font-downloads (also using Neovim) ![image](https://user-images.githubusercontent.com/1232595/190325514-1699cba4-c38c-49ba-b9e7-90173843922c.png) It appeared fine before Terminal was updated to 1.16 this morning.
Author
Owner

@lhecker commented on GitHub (Sep 15, 2022):

@birtles That's because that font, just like FiraCode, doesn't ship with a proper italic variant. When DirectWrite "simulates" those italic glyphs, it doesn't correctly compute the so called "overhangs" (= how much a glyph is outside of the bounding box / cell) and this confuses the new text renderer.

The original Cascadia Code ships with an actual italic variant which looks quite different (easily visible on the "f" character) and works correctly (because it's not simulated):
image

I'm working on a fix, but I'm not 100% sure how to best approach it yet.

@lhecker commented on GitHub (Sep 15, 2022): @birtles That's because that font, just like FiraCode, doesn't ship with a proper italic variant. When DirectWrite "simulates" those italic glyphs, it doesn't correctly compute the so called "overhangs" (= how much a glyph is outside of the bounding box / cell) and this confuses the new text renderer. The original Cascadia Code ships with an actual italic variant which looks quite different (easily visible on the "f" character) and works correctly (because it's not simulated): ![image](https://user-images.githubusercontent.com/2256941/190401980-e2b2dcc7-1f1a-4ddc-b1b2-7234dc2b2574.png) I'm working on a fix, but I'm not 100% sure how to best approach it yet.
Author
Owner

@lhecker commented on GitHub (Sep 22, 2022):

FYI The fix that will be published is still incomplete unfortunately. It'll still cause italics to be downsized and cause an uneven appearance, even if it's slightly less bad now:
atlas_engine_baseline

I'm working on a permanent and proper fix in the meantime, but it'll most likely not be part of 1.16 unfortunately.

@lhecker commented on GitHub (Sep 22, 2022): FYI The fix that will be published is still incomplete unfortunately. It'll still cause italics to be downsized and cause an uneven appearance, even if it's slightly less bad now: ![atlas_engine_baseline](https://user-images.githubusercontent.com/2256941/191102193-fe59a86b-4e4b-489e-881b-1b881e834eee.gif) I'm working on a permanent and proper fix in the meantime, but it'll most likely not be part of 1.16 unfortunately.
Author
Owner

@ghost commented on GitHub (Sep 23, 2022):

:tada:This issue was addressed in #14039, which has now been successfully released as Windows Terminal Preview v1.16.2641.0.🎉

Handy links:

@ghost commented on GitHub (Sep 23, 2022): :tada:This issue was addressed in #14039, which has now been successfully released as `Windows Terminal Preview v1.16.2641.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.16.2641.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@summelon commented on GitHub (Jan 27, 2023):

I'm sorry to reuse this closed thread.
I meet a similar text issue on preview version 1.17.1023.
There seems to be a misalignment in the italic text similar to wavy baselines.
My font is FiraCode NF Retina.
The screenshot is taken from an ubuntu server accessed by using MS Terminal.
Could you have a look at this issue? @lhecker
Many thanks!
image

@summelon commented on GitHub (Jan 27, 2023): I'm sorry to reuse this closed thread. I meet a similar text issue on preview version 1.17.1023. There seems to be a misalignment in the italic text similar to wavy baselines. My font is FiraCode NF Retina. The screenshot is taken from an ubuntu server accessed by using MS Terminal. Could you have a look at this issue? @lhecker Many thanks! ![image](https://user-images.githubusercontent.com/52701013/215021747-bc32d818-94bc-4eca-8415-dab45b104bf7.png)
Author
Owner

@cscherrNT commented on GitHub (Sep 7, 2023):

I still have weird italics scaling.

grafik

echo "\033[3m  % TlDr; Problem -> Issue -> Branch -> Fix in branch -> Master in Branch mergen für Backport -> Mergerequest \033[0m"

grafik

@cscherrNT commented on GitHub (Sep 7, 2023): I still have weird italics scaling. ![grafik](https://github.com/microsoft/terminal/assets/123484154/87651a00-8415-4e24-83aa-e92d10ec047d) ```bash echo "\033[3m % TlDr; Problem -> Issue -> Branch -> Fix in branch -> Master in Branch mergen für Backport -> Mergerequest \033[0m" ``` ![grafik](https://github.com/microsoft/terminal/assets/123484154/27b9f564-9088-4a10-9914-b71a788fc060)
Author
Owner

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

As mentioned above (https://github.com/microsoft/terminal/issues/13987#issuecomment-1254319201) this issue was closed with a hotfix, that didn't address the entire problem. The proper, thorough fix is #14959 which has first shipped in v1.18.1421.0.

Could you try out the latest Windows Terminal Preview (v1.18.1462.0) and see if the issue still occurs for you?

@lhecker commented on GitHub (Sep 7, 2023): As mentioned above (https://github.com/microsoft/terminal/issues/13987#issuecomment-1254319201) this issue was closed with a hotfix, that didn't address the entire problem. The proper, thorough fix is #14959 which has first shipped in v1.18.1421.0. Could you try out the latest Windows Terminal Preview ([v1.18.1462.0](https://github.com/microsoft/terminal/releases/tag/v1.18.1462.0)) and see if the issue still occurs for you?
Author
Owner

@cscherrNT commented on GitHub (Sep 8, 2023):

I'm using the latest official version shipped in the windows store (I think? There is no update button available): 1.16.11461.0. I'm on a work machine, so I'd rather not install a preview version and keep to stable software. Are the italic scaling issues only fixed for the preview version, not the stable release?

@cscherrNT commented on GitHub (Sep 8, 2023): I'm using the latest official version shipped in the windows store (I think? There is no update button available): `1.16.11461.0`. I'm on a work machine, so I'd rather not install a preview version and keep to stable software. Are the italic scaling issues only fixed for the preview version, not the stable release?
Author
Owner

@lhecker commented on GitHub (Sep 8, 2023):

It's fixed starting v1.18.1421.0, which at the time of writing is only available as Preview.

FYI That Preview in particular version was released over 3 months ago. It's unlikely you'll find major bugs in it. You can use it to bridge the gap until 1.18 is the stable version (= within a month). Actual development versions of Windows Terminal are not released in the Windows Store, but rather tested by the team for a while before being released.

@lhecker commented on GitHub (Sep 8, 2023): It's fixed starting v1.18.1421.0, which at the time of writing is only available as Preview. FYI That Preview in particular version was released over 3 months ago. It's unlikely you'll find major bugs in it. You can use it to bridge the gap until 1.18 is the stable version (= within a month). Actual development versions of Windows Terminal are not released in the Windows Store, but rather tested by the team for a while before being released.
Author
Owner

@DHowett commented on GitHub (Sep 8, 2023):

I'm using the latest official version shipped in the windows store (I think? There is no update button available): 1.16.11461.0.

That's strange! The latest version available in the store for the Stable channel is 1.17

@DHowett commented on GitHub (Sep 8, 2023): > I'm using the latest official version shipped in the windows store (I think? There is no update button available): `1.16.11461.0`. _That's strange!_ The latest version available in the store for the Stable channel is 1.17
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18445