nerd-fonts
nerd-fonts copied to clipboard
Characters from the range U+F900 to U+FAFF are displayed with a width of two
🎯 Subject of the issue
ogham/exa can display icons using Nerd Fonts codepoints. However, it seems that some icons are displayed with one character more than expected, like U+FABF, and there’s no way, as far as I know, to accurately find out which size it is to workaround this problem.
🔧 Your Setup
- Hack Nerd Font Mono.tff 2.1.0 and Hack Regular Nerd Font Complete.ttf 2.1.0
- Konsole, Kitty
- Ubuntu 20.04, Arch Linux
★ Screenshots
Same thing happens to me on MacOS using iTerm
Ran into the same issue on gnome-terminal and kitty, on Pop!_OS 21.04
kitty:
gnome-terminal:
The U+F900 to U+FAFF range is used for CJK characters actually, so the terminal is expected double width characters there.
Just stumbled over this in Windows Terminal code:
UnicodeRange{ 0xe000, 0xf8ff, CodepointWidth::Ambiguous },
UnicodeRange{ 0xf900, 0xfaff, CodepointWidth::Wide },
The font (i.e. Nerd Font) has no influence on rendering if the terminal overrides our info.
I feel like Nerd Fonts should avoid this Unicode range if a lot of terminal have problem with it, to be honest, but I’m not sure how practical or feasible it is.
I suggest we should skip the range F900
- FAFF
.
This range is design for CJK, and lots of programs hard code CJK
features in this range.
Also, this is a problem for CJK users.
For example,
- Icons display as Chinese without use nerd fonts.
@tywtyw2002 see #574 and finally #716
The font (i.e. Nerd Font) has no influence on rendering if the terminal overrides our info.
In general--because there is no guarantee that a terminal-based application is even running on the same host as the terminal emulator--you cannot rely on the font to tell you how big a glyph is supposed to be. An application trying to simply print text would need to know what font is set (and perhaps even load it up and parse it, when it may not even exist on that system; output could be going to a printer, etc.) to accurately determine how to do so. Terminal emulators must therefore override all font info based on a standard that font authors and terminal emulator authors agree to. :smile:
Glyphs finally dropped with v3.0.0
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.