nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

Characters from the range U+F900 to U+FAFF are displayed with a width of two

Open ariasuni opened this issue 3 years ago • 8 comments

🎯 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

Screenshot_20210627_234208 Screenshot_20210627_234232

ariasuni avatar Jun 27 '21 21:06 ariasuni

Same thing happens to me on MacOS using iTerm

image

IzhakJakov avatar Nov 04 '21 13:11 IzhakJakov

Ran into the same issue on gnome-terminal and kitty, on Pop!_OS 21.04

kitty: kitty-nf

gnome-terminal: gnome-terminal-nf

eliminmax avatar Dec 02 '21 17:12 eliminmax

The U+F900 to U+FAFF range is used for CJK characters actually, so the terminal is expected double width characters there.

xsrvmy avatar Dec 31 '21 00:12 xsrvmy

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.

Finii avatar Dec 31 '21 07:12 Finii

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.

ariasuni avatar Jan 05 '22 22:01 ariasuni

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. Screen Shot 2022-03-02 at 18 05 46

tywtyw2002 avatar Mar 03 '22 01:03 tywtyw2002

@tywtyw2002 see #574 and finally #716

Finii avatar Mar 03 '22 07:03 Finii

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:

DHowett avatar Jun 20 '22 16:06 DHowett

Glyphs finally dropped with v3.0.0

Finii avatar May 01 '23 12:05 Finii

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.

github-actions[bot] avatar Nov 06 '23 00:11 github-actions[bot]