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

Weird font glitch with nerd font icons #550

Closed
RRethy opened this issue May 18, 2018 · 2 comments
Closed

Weird font glitch with nerd font icons #550

RRethy opened this issue May 18, 2018 · 2 comments

Comments

@RRethy
Copy link

RRethy commented May 18, 2018

How it looks in Kitty

screen shot 2018-05-17 at 9 32 25 pm

How it looks in alacritty

screen shot 2018-05-17 at 9 31 44 pm

I tried it with a lot of different nerd patched fonts, mono and non-mono, and all nerd font icons were shifted to the right by a bit. The shifting is there in an out of vim. In the screenshot below, it shows the icon with the cursor on top of it.

screen shot 2018-05-17 at 9 34 05 pm

I can't find anything in the docs on fixing this. I'm wondering if there is something I missed which would can be added to my kitty.conf to fix this, or if you have any suggestion on trying something else. Any help is appreciated, thanks.

Btw, really great job on the terminal, super smooth and even with the small glitch above, it looks really nice.

@kovidgoyal
Copy link
Owner

kovidgoyal commented May 18, 2018

There is no way to guarantee that a glyph will line up with the left edge of a cell. Whether it does or not depends on various things like how the glyph is defined in the font, the cell size, the glyph size in the font, etc.

For this kind of thing, it is better to use geometric shapes rather than font glyphs. You can see an example of that in the kitty screenshot in the readme (look at the vim statusbar). So instead of using whatever codepoint you use for the filled D glyph instead use the U+e0b0 codepoint which will give you a filled triangle that is always properly aligned regardless of font. Similarly U+e0b2 will give you a filled left point triangle.

It is possible to similarly override the redering of whatever code point the nerd fonts use for filled D but it's not something I am interested in myself, patches are welcome. You would basically need to add rendering for the filled D shapes to box_drawing.py (similar to the triangle() function)

@kovidgoyal
Copy link
Owner

Actually it turns out that generating the bezier curve to fit a D inside an arbitrary rectangle is a fun little challenge, so I think I will implement the overrides in box_drawing.py myself.

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

No branches or pull requests

2 participants