Last active
August 20, 2024 16:49
-
-
Save rolfschr/4261ea856535c6007194b2b27f3dee04 to your computer and use it in GitHub Desktop.
zutty & HackNerdFontMono
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, | |
I'm trying to reproduce the experience I have with `urxvt` with `zutty` using the font "HackNerdFontMono". While I can use the font, I do have problems with it: | |
* The font color is the same as the background color (at least for me). Changing the colors (i.e. new "theme" in ~/.Xresources) did not have an effect. | |
* I do not have "Braille" symbols available (`btop` used as indicator here). | |
* I also want to have the special glyphs from that font. Those are not provideb by the font "Hack". | |
There are some screenshots with tests below. I'm sorry this is so chaotic, I worked on two different systems (wayland + xserver, not sure this makes a difference); both running NixOS. | |
Posting everything within the same comment would have helped to re-order but I had issues with this (besides also using two different GitHub accounts [work+personal]). | |
I have no clue about fonts and virtual terminals so please forgive if I'm asking/doing anything wrong/stupid here. | |
I have used zutty v0.16 as show here: https://github.com/NixOS/nixpkgs/pull/257156#issuecomment-2278807153 | |
The comment below (https://gist.github.com/rolfschr/4261ea856535c6007194b2b27f3dee04?permalink_comment_id=5150931#gistcomment-5150931) shows my expected outcome. | |
Basic comparison is: | |
`urxvt -fn "xft:Hack Nerd Font Mono:size=12"` vs `zutty -font "HackNerdFontMono"` | |
For a quick overview on Braille support for nerd fonts, see ryanoasis/nerd-fonts#1064 and ryanoasis/nerd-fonts#837
Feedback from the author:
I was able to reproduce your issue with HackNerdFontMono (not showing
anything but the background). That is due to a bug which is corrected
by the below snippet - feel free to test it:
diff --git a/src/font.cc b/src/font.cc
index d3f9118..6fd73fe 100644
--- a/src/font.cc
+++ b/src/font.cc
@@ -65,6 +65,9 @@ namespace zutty
if (c == Unicode_Replacement_Character)
return true;
+ if (c > std::numeric_limits<uint16_t>::max ())
+ return false;
+
return ((dwidth && wcwidth (c) == 2) ||
(!dwidth && wcwidth (c) < 2));
}
The author integrated this (background issue) into zutty:
https://git.hq.sig7.se/zutty.git/commit/04b2ca3b3aaa070c41583247f8112c31b6003886
As for the Braille + nerd font glyph support, one needs to find a font that contains both. Zutty will not do any magic here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Zutty - DejaVuSansMono
Zutty with DejaVuSansMono doesn't show braille signs in
btop
(CPU) and does not have the glyphs (lsd
):(Not sure the double with font error is important here.)
Zutty's default with default font 9x18
Zutty shows the braille, but no glyphs (which is fine, of course: