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

Issue with texture healing with 'w' #279

Open
geodimm opened this issue Jan 7, 2025 · 5 comments
Open

Issue with texture healing with 'w' #279

geodimm opened this issue Jan 7, 2025 · 5 comments
Milestone

Comments

@geodimm
Copy link

geodimm commented Jan 7, 2025

The w letter looks cutoff when preceded by an underscore or a dot. See the tab_bar_margin_width string.

Texture healing off (kitty term):

Screenshot 2025-01-07 at 15 27 44

Texture healing on (kitty term):

w
Screenshot 2025-01-07 at 15 27 22

W
Screenshot 2025-01-07 at 15 30 02

There are similar issues with the sequence (m in italic too.

Is that by design or a bug?

@heathercran heathercran added this to the 1.3 milestone Feb 7, 2025
@heathercran
Copy link
Collaborator

Hi, thanks for noting this! I'll look into what could be causing this before the next release.

@Finii
Copy link
Contributor

Finii commented Feb 7, 2025

Cause is simple ;-)
It has a negative lsb, and that is not rendered (by Kitty, other clients do render into the previous/following 'cell'). There are multiple other .both glyphs that have negative bearings, I assume they all have the problem (on some clients).

Image

@rileycran
Copy link
Collaborator

The negative side bearings are intentional in texture healing. The IDE actually clipping anything that falls outside the LSB and RSB is not an intended text rendering behavior. As far as I know this is an issue with the rendering choices of the IDE, not the Monaspace fonts.

@heathercran
Copy link
Collaborator

@Finii true, but in the screenshots in Kitty above, it's actually a w.both swap being made. It seems that Kitty is only cutting off the lsb and not the rsb. I haven't tested in Kitty myself, but do you know if this is typical behaviour? We've also had issues with Kitty resizing ligatures to fit within one character width (#222), so it may be that this is an IDE issue, as @rileycran said.

@Finii
Copy link
Contributor

Finii commented Feb 7, 2025

@rileycran Yes the font is perfect within font specs. On the other hand I believe there are other clients with "hand written" renderers out there that all have individual limitations.

@heathercran One common limitation is to not-allow negative lsb. Often they allow negative rsb. (I believe. I think Kitty's behavior with negative rsb also depends if there is any glyph on the right side that is not blank 🙄)

And yes, Kitty (i.e. Kovid Goyal) definitively has strong opinions on how a font must look like; had more than one discussion with Kovid. His decisions are well founded and have good reasons, for his use case and assumptions.

I do not know the real limitations and never looked into the code. But at some point you must decide if you want to support / look good on Kitty or not.

Typical behaviour? Well, I personally hate clients that limit the expressiveness of fonts and a lot clients are unproblematic because they use the system's font renderer. But "fast" seems to be a must, and so there are some specialized clients, that might (or might not) be worth checking. I at some point carved in and installed them all.

Maybe you want to slim those few glyphs that leave their 'cell' down a bit, to better support those hardware accelerated GPU based clients, or maybe not.
I attached a list of glyphs to look at, for anyone to test their favourite client. I found it hard to find the possibly affected glyphs in Glyphs directly, thus the list (ordered by felt problematic-ity).

  • Kitty (most issues raised by users of this one)
  • Alacritty
  • Windows Terminal
  • iTerm2 (only Mac)
  • Ghostty (quite new)
  • Tilda (feels like user base is shrinking)
  • urxvt (usually the one with no problems at all)
  • IDEs usually just use the system renderer, well except MS Visual Studio, that changes render mode based on the name in the NAME table 😭

Very biased and just personal list of terminals, please do not get mad if your 'the best terminal' is not listed

List of 56 glyphs with LSB < -20 and > -600 (or something, just filtered with grep) in the details.
Roughly MTWwf&$#

<mtx name="M.both" width="1240" lsb="-21"/>
<mtx name="T.both" width="1240" lsb="-30"/>
<mtx name="T.left" width="1240" lsb="-108"/>
<mtx name="Tbar.both" width="1240" lsb="-30"/>
<mtx name="Tbar.left" width="1240" lsb="-108"/>
<mtx name="Tcaron.both" width="1240" lsb="-30"/>
<mtx name="Tcaron.left" width="1240" lsb="-108"/>
<mtx name="W.both" width="1240" lsb="-111"/>
<mtx name="W.left" width="1240" lsb="-70"/>
<mtx name="Wacute.both" width="1240" lsb="-111"/>
<mtx name="Wacute.left" width="1240" lsb="-70"/>
<mtx name="Wcircumflex.both" width="1240" lsb="-111"/>
<mtx name="Wcircumflex.left" width="1240" lsb="-70"/>
<mtx name="Wdieresis.both" width="1240" lsb="-111"/>
<mtx name="Wdieresis.left" width="1240" lsb="-70"/>
<mtx name="Wgrave.both" width="1240" lsb="-111"/>
<mtx name="Wgrave.left" width="1240" lsb="-70"/>
<mtx name="ampersand.both" width="1240" lsb="-72"/>
<mtx name="ampersand.left" width="1240" lsb="-23"/>
<mtx name="at.left" width="1240" lsb="-71"/>
<mtx name="dollar.both" width="1240" lsb="-29"/>
<mtx name="dollar.left" width="1240" lsb="-29"/>
<mtx name="dollar.nobar.both" width="1240" lsb="-29"/>
<mtx name="dollar.nobar.left" width="1240" lsb="-29"/>
<mtx name="f.italic" width="1240" lsb="-61"/>
<mtx name="f.italic.left" width="1240" lsb="-61"/>
<mtx name="hcircumflex" width="1240" lsb="-72"/>
<mtx name="numbersign.both" width="1240" lsb="-56"/>
<mtx name="numbersign.left" width="1240" lsb="-116"/>
<mtx name="uni0162.both" width="1240" lsb="-30"/>
<mtx name="uni0162.left" width="1240" lsb="-108"/>
<mtx name="uni019D" width="1240" lsb="-72"/>
<mtx name="uni021A.both" width="1240" lsb="-30"/>
<mtx name="uni021A.left" width="1240" lsb="-108"/>
<mtx name="uni0272" width="1240" lsb="-68"/>
<mtx name="uni2116.both" width="1240" lsb="-82"/>
<mtx name="uni2116.left" width="1240" lsb="-152"/>
<mtx name="uni2571" width="1240" lsb="-96"/>
<mtx name="uni2572" width="1240" lsb="-96"/>
<mtx name="uni2573" width="1240" lsb="-96"/>
<mtx name="uniE0B1" width="1240" lsb="-120"/>
<mtx name="uniE0B9" width="1240" lsb="-96"/>
<mtx name="uniE0BB" width="1240" lsb="-96"/>
<mtx name="uniE0BD" width="1240" lsb="-96"/>
<mtx name="uniE0BF" width="1240" lsb="-96"/>
<mtx name="uniE0CD" width="1240" lsb="-141"/>
<mtx name="w.both" width="1240" lsb="-99"/>
<mtx name="w.left" width="1240" lsb="-79"/>
<mtx name="wacute.both" width="1240" lsb="-99"/>
<mtx name="wacute.left" width="1240" lsb="-79"/>
<mtx name="wcircumflex.both" width="1240" lsb="-99"/>
<mtx name="wcircumflex.left" width="1240" lsb="-79"/>
<mtx name="wdieresis.both" width="1240" lsb="-99"/>
<mtx name="wdieresis.left" width="1240" lsb="-79"/>
<mtx name="wgrave.both" width="1240" lsb="-99"/>
<mtx name="wgrave.left" width="1240" lsb="-79"/>

P.S. Yes, #222, Kitty shrinks 'too big' glyphs down, not even keeping them centered, to fulfil the 'one cell one glyph' promise. I feel this is problematic if you want some overlap to avoid gaps in structures that should continue from cell to cell, like continuous arrows, box drawing glyphs, or powerline symbols. That makes me being very careful with overlap (i.e. negative bearings); I do not even know if kitty has any allowed margin.
Iirc box drawing glyphs are never taken from the font but some kitty-internal glyphs are used instead.
Kitty has many peculiarities 😬


Edit:

I found it hard to find the possibly affected glyphs in Glyphs directly

Well, it's so easy, embarrassingly easy... List view, sort by lsb...

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants