nerd-fonts
nerd-fonts copied to clipboard
zap (26A1) is wide in vim
Subject of the issue
I've no idea is this an issue with fonts or Vim or terminals. Somehow "zap" icon became 2-symbol wide in Vim, while in shell/mcedit/mousepad it looks normal.
$ echo "'⚡'"
'⚡'
$ echo "'⚡'" | vim -u /dev/null --noplugin -
# vim shows this, note extra space after zap:
# '⚡ '
This is not happens with all other icons, only with this one.
Your Setup
I've tried several fonts: RobotoMono Nerd Font, DroidSansMono Nerd Font, etc. I've tried several terminals: uxrvt, konsole. I'm using Gentoo Linux.
@powerman Hey thanks for the report. I am seeing the same. It looks like this is how it is in the source (octicons).
Will do some more investigating.. but looks like to fix this would have to be some tweaking to the patcher script
3 years later still a mystery :laughing: :cry:
It looks the same even 5 years later, unless there was any patches that I am not aware of
Firstly, you see the zap is 'yellow'. The zap patched in by Nerd Fonts is black-and-white.
On my machine it comes from Noto Color Emoji
which is given precidience over the selected font by fontconfig rules.
When I remove the Google font I get a nice one-cell-wide black-and-white zap.
The fontconfig line on my machine is here:
/etc/fonts/conf.avail/60-generic.conf: <family>Noto Color Emoji</family> <!-- Google -->
So, what you get is what you (or some distro guy) has set up. Change your setup to get what you want ;-)
@Finii Actually it's you see yellow zap - because GitHub (or browser) show it this way. :smile: In my console it's black&white. Anyway, today, about 6 years later, I don't have this issue, at least in vim using command I reported long time ago.
@Finii Actually it's you see yellow zap - because GitHub (or browser) show it this way
Well, no:
Top tilix
with NotoColorEmoji.ttf
removed, then copied into fonts and restarted tilix
: Color zap
Entered zap via ctrl
+shift
+u
2
6
a
1
enter
I don't have this issue, at least in vim using command I reported long time ago
Well, your b&w zap still looks like 2 widths wide :grimacing: So issue is still there ;-)
Well, your b&w zap still looks like 2 widths wide grimacing So issue is still there ;-)
The issue isn't in "2 width wide", it's in "2 with wide symbol itself plus 1 extra space symbol".
For JetBrainsMono Nerd Font, it now only has the 1 extra space:
@LeviticusNelson which exact font are you using?
Edit: And which terminal?
@powerman I guess I do not get it :grimacing: Maybe you can show with more screenshot and also tell me which font and terminal you use please.
Ah sorry, I see..., I guess. In Tilix it looks like 'the icon and a blank' with just one insert. Trying to find out the why.
@Finii Font: JetBrainsMono Nerd Font Regular Terminal: Alacritty (xterm-256color)
Well, it seems there is yet another fontfallback thing...
The zap in writer
like like the one in the font and is only one cell wide.
In gnome-terminal
there is some obviously different zap that occupies 2 cells.
It uses FreeSerif, but that is also NOT 2 'cells' wide.
I believe that is an extra handling in the terminals. Is it marked as 'is two wide' in the unicode table?
After removing all fonts that have a 'zap', so that tofu will be shown...:
Still the 'zap' takes 2 cells.
Before
After
According to unicode a terminal HAS TO render zap
as wide
character (i.e. 2 cells wide)
https://www.unicode.org/Public/15.0.0/ucd/EastAsianWidth.txt
The classification is W
. See also https://www.unicode.org/reports/tr11/ :
# Field 0: Unicode code point value or range of code point values
# Field 1: East_Asian_Width property, consisting of one of the following values:
# "A", "F", "H", "N", "Na", "W"
# - All code points, assigned or unassigned, that are not listed
# explicitly are given the value "N".
On W
: https://www.unicode.org/reports/tr11/#ED4
For example in windows terminal
you see this in the code here: https://github.com/microsoft/terminal/blob/main/src/types/CodepointWidthDetector.cpp
Whatever the font says is ignored and it is rendered 2 cells wide.
Edit: Add link to tr11-ED4
We had equivalent problems with the MaterialDesignIcons that are/were erroreously in the F900
- FDFF
blocks, and some symbols were 'wide' while other were 'narrow' in terminals, but in the font all were the same width.
# The format is two fields separated by a semicolon.
# Field 0: Unicode code point value or range of code point values
# Field 1: East_Asian_Width property, consisting of one of the following values:
# "A", "F", "H", "N", "Na", "W"
# - All code points, assigned or unassigned, that are not listed
# explicitly are given the value "N".
# - The unassigned code points in the following blocks default to "W":
# CJK Unified Ideographs Extension A: U+3400..U+4DBF
# CJK Unified Ideographs: U+4E00..U+9FFF
# CJK Compatibility Ideographs: U+F900..U+FAFF
Edit: Add tr11 excerpt
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.