-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add space
glyph to Symbols fonts
#297
Conversation
Thanks @Mange . It'll take me a bit to get to this but I'll review it |
Trust me, I'm not trying to stress you right now, but I just wanted to do a friendly bump in case you forgot about this. (I know how it is sometimes) If you get this notification and feel "Ugh, I really don't have time" you don't have to comment here and I'm sorry. I'm just sending you a notification in case you forgot. If not, feel free to archive the email and not click/tap on anything. |
No worries @Mange. I want to get things moving again. I should have some more time now but still won't be as much as before but at the very least I want to make sure PRs get in |
Friendly bump. :) Let me know if there's anything I can help you with to give you more time/motivation (bug triaging, for example). |
Thanks @Mange will be looking at it soon! |
Yeah you are right there are a bunch of differences besides just the added space glyph. Not sure what happened. You are correct there isn't any script currently that generates those symbol only ttf files |
Actually I did document the symbol font generation process, it is here: https://github.com/ryanoasis/nerd-fonts/wiki/Release-Workflow#ad-hoc-updating-of-the-glyph-only-fonts Probably not obvious.. |
Something is up with those symbol ttf fonts (will look into it later) However I think actually what you want to do might be as simple as adding Line 403 in d27ef23
|
I'll take a look. Thank you! |
Having this space available will help with rendering on Linux and allows renderers to render space symbols without switching fonts when icons have spaces between them.
I tried that way, and it seems to work better with the diff. Thank you for pointing me towards the correct places to look in. However, my test case does not work anymore with this version. Maybe I did the config wrong. Would you mind taking a look at the diff? If I look at the generated font, it looks like the space character has become part of the font.
Note how I suspect that it's my reproduction of the demo that isn't working, but I just wanted to check with you. I'll update if I manage to see a pango view rendered correctly. |
I got it to work. The problem was really embarrassing; I had no However, the result doesn't look very good. It's almost like the space has zero width, or the symbol taking up the space. The symbol is also aligned in a weird way. New result (Ignore the blue background, that's unrelated) Previous result: I'll try to patch the space from some other source font until it looks good. |
I've tried it with all the included fonts and also with a copy of DejaVu Sans Mono. I figure that the font-patcher rescales the space to take up no space. I tried defining a SPACE_SCALE_LIST = { 'ScaleGlyph': 0x0020, 'GlyphsToScale': [ 0x0020 ] } I've also tried to hack in that It's almost like if the space symbol in all the fonts have 0 width or something. |
@ryanoasis just thought of pinging :) It would be very nice if this PR could be merged. |
I'm also experiencing this issue in kitty. I tried to work around this by setting
Is this accurate for kitty's implementation of Pango as well? I would assume that kitty tries to render the icon with |
Here's my attempt at putting the Fira Code |
I have not read kitty's source code enough to comment on that. I just know that pango itself has this bug and has had it for years. If kitty uses pango, it's likely the cause for the problem in that app as well. If kitty doesn't use pango, it could still be the same bug but inside some other software project/package. |
Just to get myself caught up I think the original change was to the actual source file of 'original-source.otf' but now we are just replacing the space character from the 'original-source.otf' ? |
I started out by copying the glyph from a common font into the symbols font, which worked well but removed metadata from the symbols font file. Now I've tried to get it to copy it straight in the patcher, but that didn't work no matter which way I tried to get it to work. I'm not a pythonista, and I'm really not familiar with this codebase either so I've mostly tried to cargo cult a solution in here. The end-goal is to just have a completely blank glyph in the 0x20 position inside the symbols font, without making the font file weird. |
Thanks @Mange . So I am a little confused, it looks like this change of copying If so I think we are good to merge... |
But it didn't work anymore with the change. Space characters still shows up badly.
|
Thanks for the update. I'll try to look into this... |
Pango 1.44 does not have this issue anymore. pango-view -t "Playing some for you right now" A lot of Linux distros will be slow to upgrade since 1.44 had some issues with other programs because they changed font rendering quite a lot, but it will slowly become deployed everywhere over time. I think we can close this PR, unless we want to fix this for LTS releases or other distros that could take years to upgrade. |
Please don't close. |
House keeping: Closing this PR, if anyone has strong objections please comment and we can discuss re-opening. Thanks all |
[why] It could be beneficial to have at least the 'blank' glyph defined, next to all the special glyphs (symbols). This is needed by some (old) font rendering engines (Pango, IE11). Fixes: #297 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Description
Added the
space
glyph from DejaVu Sans Mono Regular into both NerdFont Complete symbol fonts and saved them as TTF.
I used fontforge and generated the font as a
TrueType
with default options.This could, in theory, fix #275.
Requirements / Checklist
./font-patcher Inconsolata.otf --fontawesome --octicons --pomicons
./gotta-patch-em-all-font-patcher\!.sh Hermit
What does this Pull Request (PR) do?
It adds the space character to the symbols fonts files.
How should this be manually tested?
On a Linux machine, check this output with the normal symbol fonts installed (and a fontconfig that automatically falls back to the symbols):
pango-view -t "Playing some for you right now"
Then install this new version of the font, reset the cache and try again:
Any background context you can provide?
Pango is one of the most common font rendering libraries on Linux. It's used by GTK/GNOME and a lot of standalone apps, like Rofi, Polybar, and a lot of terminals.
Pango looks for fallback fonts when the current font doesn't contain a given glyph, but it won't check spaces or any other very common "invisible" characters with the assumption that all fonts should have spaces in them.
This makes it so that after Pango switches to Nerd Fonts for a glyph, it won't switch back until it gets a non-space character after it, making it impossible to have spaces after a symbol.
I usually try to work around it by wrapping symbols in parenthesis, or adding a colon after them, but in some apps this isn't really possible to do anything about.
Issues to look at:
Would fix icon rendering in a lot of programs, including:
What are the relevant tickets (if any)?
Screenshots (if appropriate or helpful)
See "Any background" above for some examples.
Caveats / problems
.sfd
files too, but they got no meaningful changes ("last modified" and "window size" information only).I think you might want to clean this up somehow; maybe repeat the process yourself..? Alternatively, if I could get some instructions on how to properly just add the glyph to the TTF file without any additional changes I could repeat that process and replace the commits in this PR.