Missing line (and letter) spacing in BIZ UDGothic #23627

Closed
opened 2026-01-31 08:47:35 +00:00 by claunia · 4 comments
Owner

Originally created by @tats-u on GitHub (Sep 20, 2025).

Windows Terminal version

1.22.12111.0

Windows build number

10.0.26100.0

Other Software

No response

Steps to reproduce

  1. Enable the Windows capability "Language.Fonts.Jpan~~~und-JPAN~0.0.1.0" to install BIZ UDGothic
  2. Set font to "BIZ UDGothic"
  3. Display a Japanese content that contains many han characters

e.g. curl -LsSf https://github.com/sakura-editor/sakura/raw/refs/heads/master/README.md

Expected Behavior

Rendered by Firefox:

Image

Content Source: https://github.com/sakura-editor/sakura/blob/master/README.md
github.dev: https://github.dev/sakura-editor/sakura/blob/master/README.md

Image

Some amount of line spacing exists there.
I think the other browsers provide similar rendering results.

Actual Behavior

Zero Line (and letter) spacing:

Image

Looks extremely cramped.

BIZ UDGothic is 1 of 2 built-in Japanese monospace fonts (the other one is antique MS Gothic (see #107)).
You have to know some Windows customers do not allow employees to install custom 3rd-party fonts like UDEV Gothic and Cascadia Next.

Originally created by @tats-u on GitHub (Sep 20, 2025). ### Windows Terminal version 1.22.12111.0 ### Windows build number 10.0.26100.0 ### Other Software _No response_ ### Steps to reproduce 1. Enable the Windows capability "Language.Fonts.Jpan~~~und-JPAN~0.0.1.0" to install BIZ UDGothic 2. Set font to "BIZ UDGothic" 3. Display a Japanese content that contains many han characters e.g. `curl -LsSf https://github.com/sakura-editor/sakura/raw/refs/heads/master/README.md` ### Expected Behavior Rendered by Firefox: <img width="939" height="478" alt="Image" src="https://github.com/user-attachments/assets/4b118f04-89c5-47e8-989f-b011dc1710b8" /> Content Source: https://github.com/sakura-editor/sakura/blob/master/README.md github\.dev: https://github.dev/sakura-editor/sakura/blob/master/README.md <img width="882" height="506" alt="Image" src="https://github.com/user-attachments/assets/dfa79b3f-eff7-497c-974f-0cfe3fcace8c" /> Some amount of line spacing exists there. I think the other browsers provide similar rendering results. ### Actual Behavior Zero Line (and letter) spacing: <img width="1069" height="466" alt="Image" src="https://github.com/user-attachments/assets/040df10b-c0b9-4289-b7dd-8473b89a4196" /> Looks extremely cramped. BIZ UDGothic is 1 of 2 built-in Japanese monospace fonts (the other one is antique MS Gothic (see #107)). You have to know some Windows customers do not allow employees to install custom 3rd-party fonts like [UDEV Gothic](https://github.com/yuru7/udev-gothic) and [Cascadia Next](https://github.com/microsoft/cascadia-code/discussions/762).
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 08:47:35 +00:00
Author
Owner

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

I'll answer in sections:

Do we have a bug?

BIZ UDGothic specifies a ascent + descent + line-gap of exactly 1em (roughly the width of a capital M letter). An actual M character has a height of ~0.8em (= 80% line height). Here's our rendering:

Image

Cell / line height is 146px and the height of the "M" is 118px, which is exactly 80%. So, our code works as expected.

Why does it work in a browser?

The short answer is that browsers don't necessarily use the font information to calculate the line-height. The line-height CSS property is usually set to something around 1.2 which is multiplied onto the ascent + descent size. This results in a line height of 1.2em for this font, which matches your screenshots.

How can you fix that in Windows Terminal?

We have a line-height setting as well!

Image

Why can't we fix it?

Because a lot of monospace fonts actually require us to respect the ascent + descent + line-gap measurement. I believe BIZ UDGothic is the outlier here.

@lhecker commented on GitHub (Sep 22, 2025): I'll answer in sections: ### Do we have a bug? BIZ UDGothic specifies a `ascent + descent + line-gap` of exactly 1em (_roughly_ the width of a capital M letter). An actual M character has a height of ~0.8em (= 80% line height). Here's our rendering: <img width="95" height="161" alt="Image" src="https://github.com/user-attachments/assets/b3ca8dd9-4ffc-43d0-91eb-aee83191de8a" /> Cell / line height is 146px and the height of the "M" is 118px, which is exactly 80%. So, our code works as expected. ### Why does it work in a browser? The short answer is that browsers don't necessarily use the font information to calculate the line-height. The `line-height` CSS property is usually set to something around 1.2 which is multiplied onto the `ascent + descent` size. This results in a line height of 1.2em for this font, which matches your screenshots. ### How can you fix that in Windows Terminal? We have a line-height setting as well! <img width="1730" height="1123" alt="Image" src="https://github.com/user-attachments/assets/9d9d4d90-bcc6-4aab-8b44-5fd98569d445" /> ### Why can't _we_ fix it? Because a lot of monospace fonts actually require us to respect the `ascent + descent + line-gap` measurement. I believe BIZ UDGothic is the outlier here.
Author
Owner

@tats-u commented on GitHub (Sep 23, 2025):

@lhecker How about its letter spaces? It looks a little bit less than those in browsers for me.

@tats-u commented on GitHub (Sep 23, 2025): @lhecker How about its _letter_ spaces? It looks a little bit less than those in browsers for me.
Author
Owner

@lhecker commented on GitHub (Sep 24, 2025):

There's not really such thing as "monospace" in modern fonts. Monospace simply means that the font author tried to give the glyphs a uniform width and height. So, to browsers there's no difference between a proportional font and a monospace font - both get rendered proportional. If your font has a width of 15.5px then it can do that, because it needs this capability for proportional fonts anyway.

Our text renderer on the other hand is a bit more simplistic. It doesn't support fractional widths yet and so we round the cell width (letter space) to the nearest pixel. It appears in your case we just so happen to round down.

If you check my screenshot, you'll see that there's a "Cell width" setting right below the "Line height" one. You can use it to increase the letter spacing. 🙂

@lhecker commented on GitHub (Sep 24, 2025): There's not really such thing as "monospace" in modern fonts. Monospace simply means that the font author tried to give the glyphs a uniform width and height. So, to browsers there's no difference between a proportional font and a monospace font - both get rendered proportional. If your font has a width of 15.5px then it can do that, because it needs this capability for proportional fonts anyway. Our text renderer on the other hand is a bit more simplistic. It doesn't support fractional widths yet and so we round the cell width (letter space) to the nearest pixel. It appears in your case we just so happen to round down. If you check my screenshot, you'll see that there's a "Cell width" setting right below the "Line height" one. You can use it to increase the letter spacing. 🙂
Author
Owner

@tats-u commented on GitHub (Sep 24, 2025):

I see. Thank you for your investigation.

@tats-u commented on GitHub (Sep 24, 2025): I see. Thank you for your investigation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23627