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

Bundle Nerd fonts as fallback #1521

Closed
jankatins opened this issue Jan 7, 2022 · 9 comments
Closed

Bundle Nerd fonts as fallback #1521

jankatins opened this issue Jan 7, 2022 · 9 comments
Labels
enhancement New feature or request fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds.

Comments

@jankatins
Copy link
Contributor

jankatins commented Jan 7, 2022

Is your feature request related to a problem? Please describe.

Nerdfonts seem to fall into the same category into which wezterm falls: if you need a differet terminal emulator, you likely also want nerdfonts at some point. https://github.com/starship/starship, https://github.com/Yash-Handa/logo-ls and probably a lot more suggest installing nerd fonts. #1516 (comment) made the great suggestion to add the nerdfonts only font and use it as a fallback instead of using a patched font.

Describe the solution you'd like

Bundle the suggested nerd font only font and add it as a default fallback

Describe alternatives you've considered

Installing it myself and configuring wezterm to use them.

@wez
Copy link
Owner

wez commented Jan 8, 2022

I'm not sure whether https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/NerdFontsSymbolsOnly/complete/Symbols-1000-em%20Nerd%20Font%20Complete%20Mono.ttf
or
https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/NerdFontsSymbolsOnly/complete/Symbols-2048-em%20Nerd%20Font%20Complete%20Mono.ttf
is best to bundle.

ryanoasis/nerd-fonts#753 worries me a bit, so perhaps the 1000-em version is best?
I don't have a great way to sanity check that things really look sane because I don't use starship or other fancy prompt/vim things.

I'd love for someone to play around with these fonts and come up with a verdict on what works best, then we can see about bundling the symbols.

As for licensing: https://github.com/ryanoasis/nerd-fonts/blob/master/license-audit.md#glyphicon-sources suggests that things are mostly fine, but the Pomicons symbols have a non-commercial restriction which is not as free as the licensing for the rest of wezterm. I think if we were to bundle and distribute, we'd need a version with Pomicons removed in order to avoid making wezterm's license less free.

@jankatins
Copy link
Contributor Author

jankatins commented Jan 8, 2022

I'm now using this

  font = wezterm.font_with_fallback({
         "JetBrains Mono",
         "Symbols Nerd Font"
   }),

which ends up as this:

[00:38:46] λ  wezterm ls-fonts
Primary font:
wezterm.font_with_fallback({
  -- /usr/share/fonts/truetype/jetbrains-mono/JetBrainsMono-Regular.ttf, FontConfig
  "JetBrains Mono",

  -- /home/js/.local/share/fonts/Symbols-1000-em Nerd Font Complete.ttf, FontConfig
  "Symbols Nerd Font",

  -- /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf, FontConfig
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Last Resort High-Efficiency",

})

If I use the mono variant, wezterm picks up the 2024 variant:

[00:42:44] λ  wezterm ls-fonts
Primary font:
wezterm.font_with_fallback({
  -- /usr/share/fonts/truetype/jetbrains-mono/JetBrainsMono-Regular.ttf, FontConfig
  "JetBrains Mono",

  -- /home/js/.local/share/fonts/Symbols-2048-em Nerd Font Complete Mono.ttf, FontConfig
  "Symbols Nerd Font Mono",

  -- /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf, FontConfig
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Last Resort High-Efficiency",

})

and logo-ls doesn't show any icon. Removing all 2024 variant from the font folder picks up the 1000-em-*Mono variant, but does not show any icons either :-( So I guess at least the (RC) release fonts are broken :-(

I'm currently going by the 1000em non-mono variant, that works :-)

@SuperSandro2000
Copy link
Contributor

ryanoasis/nerd-fonts#753 worries me a bit, so perhaps the 1000-em version is best?

That is only for the latest version. I suggest to grab an older one for now.

I use the following config:

  font = wezterm.font_with_fallback({"JetBrains Mono", "Symbols Nerd Font"}),

@jankatins
Copy link
Contributor Author

Seems ryanoasis/nerd-fonts@d2cd41e fixes some stuff for ryanoasis/nerd-fonts#753, haven't tested yet.

wez added a commit that referenced this issue Jan 16, 2022
Built using:

```
./FontForge-2020-11-07-21ad4a1-x86_64.AppImage --script $PWD/font-patcher "$PWD/src/unpatched-fonts/NerdFontsSymbolsOnly/NerdFontsSymbolsOnly Template 1000 em.ttf" --powerline --use-single-width-glyphs -out /tmp/nerd-fonts-out --fontawesome --fontawesomeextension --fontlinux --octicons --codicons --powersymbols --powerline --powerlineextra --mdi --weathericons
```

which is everything *except* Pomicons at the time of writing, pending
clarifications of its distribution license
(ryanoasis/nerd-fonts#266)

refs: #1521
@wez wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Jan 16, 2022
@wez
Copy link
Owner

wez commented Jan 16, 2022

I've bundled a version of the font without pomicons.
This is how exa --icons looks now with the default config:
image

@wez
Copy link
Owner

wez commented Jan 17, 2022

with 54e92b6 you can now do:

local wezterm = require 'wezterm'

wezterm.log_info(wezterm.nerdfonts.dev_mozilla)

to resolve a nerd font glyph given its css name (minus the nf- prefix) from the https://www.nerdfonts.com/cheat-sheet

I anticipate this being helpful for folks using those symbols in their status lines for example.

wez added a commit that referenced this issue Jan 17, 2022
@wez
Copy link
Owner

wez commented Jan 17, 2022

@jankatins
Copy link
Contributor Author

Amazing, thank you!

@wez wez closed this as completed Feb 4, 2022
Riatre pushed a commit to Riatre/wezterm-shell-integration that referenced this issue Jan 8, 2023
Built using:

```
./FontForge-2020-11-07-21ad4a1-x86_64.AppImage --script $PWD/font-patcher "$PWD/src/unpatched-fonts/NerdFontsSymbolsOnly/NerdFontsSymbolsOnly Template 1000 em.ttf" --powerline --use-single-width-glyphs -out /tmp/nerd-fonts-out --fontawesome --fontawesomeextension --fontlinux --octicons --codicons --powersymbols --powerline --powerlineextra --mdi --weathericons
```

which is everything *except* Pomicons at the time of writing, pending
clarifications of its distribution license
(ryanoasis/nerd-fonts#266)

refs: wez/wezterm#1521
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds.
Projects
None yet
Development

No branches or pull requests

3 participants