Certain glyphs are clipped #261

Closed
opened 1 year ago by sv · 5 comments
sv commented 1 year ago

Mostly happens with italics, see the rightmost ascenders on "V" and "w".

image

Environment:

  • Debian Bullseye Alpha 3 (testing)
  • sway v1.5
  • foot v1.5.4
  • neovim v0.4.4
  • Consolas font.

P.S. I have e-mailed Debian package maintainer and enquired about an update the latest upstream version.

P.P.S. Potentially relevant: https://github.com/extrawurst/gitui/issues/464#issuecomment-751316509, please refer to the 2nd screenshot with the arrow symbols.

Mostly happens with italics, see the rightmost ascenders on "V" and "w". ![image](/attachments/81f1352a-9eb6-48ff-b2b8-d8f6e6e3bcd0) Environment: - Debian Bullseye Alpha 3 (testing) - sway v1.5 - foot v1.5.4 - neovim v0.4.4 - Consolas font. **P.S.** I have e-mailed Debian package maintainer and enquired about an update the latest upstream version. **P.P.S.** Potentially relevant: https://github.com/extrawurst/gitui/issues/464#issuecomment-751316509, please refer to the 2nd screenshot with the arrow symbols.
3.0 KiB

See #207

See #207
dnkl commented 1 year ago
Owner

The italics are, as @Ordoviz mentioned, a duplicate of #207.

The closest thing to a "fix" for this we'll see in foot (except implementing an OpenGL/Vulkan backend and re-drawing the entire screen each frame) is #244 (letterspacing, in this case). But that of course means the font will look different. It may be acceptable for some fonts, while others will look way too stretched out.

The arrows is a different issue. wcwidth()1 considers them to be 1 column wide, but in your font, the glyphs are 2 columns wide. That's why they get split in half (in the screenshot from @extrawurst, the glyphs are single column. I.e. his font agrees with wcwidth().

There could be a couple of reasons for this: one is that these glyphs really are half width (i.e. 1 column wide) and your font is simply bad. Another possibility is that these characters have an undefined width. In that case, fonts like yours aren't wrong, but since wcwidth() alwayss return 1 for these characters, they are still unusable in a terminal. Without knowing which Unicode codepoints they are, I can't really say more than that.


  1. wcwidth() returns the width of a character, in number of columns. The terminal emulator, and the application running inside it must agree on the width of all characters, otherwise the terminal state gets out of sync and the output will get corrupted. ↩︎

The italics are, as @Ordoviz mentioned, a duplicate of https://codeberg.org/dnkl/foot/issues/207. The closest thing to a "fix" for this we'll see in foot (except implementing an OpenGL/Vulkan backend and re-drawing the entire screen each frame) is https://codeberg.org/dnkl/foot/issues/244 (letterspacing, in this case). But that of course means the font will look different. It may be acceptable for some fonts, while others will look way too stretched out. The arrows is a different issue. `wcwidth()`[^1] considers them to be **1** column wide, but in your font, the glyphs are **2** columns wide. That's why they get split in half (in the screenshot from @extrawurst, the glyphs are single column. I.e. his font agrees with `wcwidth()`. There could be a couple of reasons for this: one is that these glyphs really are half width (i.e. 1 column wide) and your font is simply bad. Another possibility is that these characters have an undefined width. In that case, fonts like yours aren't _wrong_, but since `wcwidth()` alwayss return 1 for these characters, they are still unusable in a terminal. Without knowing which Unicode codepoints they are, I can't really say more than that. [^1]: `wcwidth()` returns the **width** of a character, in number of columns. The terminal emulator, and the application running inside it must agree on the width of all characters, otherwise the terminal state gets out of sync and the output will get corrupted.
dnkl commented 1 year ago
Owner

Note that it is also possible that the arrows aren't even available in your font, and that foot (via fontconfig) is loading them from a fallback font.

If that's the case, you can configure either FontConfig (affecting all applications), or customize foot's fallback list in foot.ini, to use a different fallback font.

Note that it is also possible that the arrows aren't even available in your font, and that foot (via fontconfig) is loading them from a fallback font. If that's the case, you can configure either FontConfig (affecting all applications), or customize foot's fallback list in `foot.ini`, to use a different fallback font.
sv commented 1 year ago
Poster

That was helpful and educational, thanks @dnkl!

That was helpful and educational, thanks @dnkl!
dnkl commented 1 year ago
Owner

@sv you're welcome :)

@sv you're welcome :)
dnkl closed this issue 1 year ago
dnkl added the
duplicate
label 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.