ryanoasis / nerd-fonts

Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts: Hack, Source Code Pro, more. Glyph collections: Font Awesome, Material Design Icons, Octicons, & more
https://NerdFonts.com
Other
52.6k stars 3.59k forks source link

Dejavu Sans Mono Nerd (version 3.2) does not respect Font Awesome 4 #1589

Closed anthony-S93 closed 2 months ago

anthony-S93 commented 2 months ago

🎯 Subject of the issue

Experienced behavior: Font Awesome glyphs are rendered inconsistently after upgrading my ttf-dejavu-nerd from version 3.1 to version 3.2. As far as I can tell, all font awesome fonts are affected, but I will use the nf-fa-eye_slash (codepoint f070) to illustrate the issue.

If I use nf-fa-eye_slash in my terminal prompt, the glyph rendered on the prompt and the glyph I see inside my text editor (neovim) are different.

In the terminal prompt, the latest font awesome glyph is used: 20240405_17h22m02s_grim

Inside Neovim, the Font Awesome 4 version of the glyph (the desired one) is used: 20240405_17h23m18s_grim

Another inconsistent behavior is the fact that different versions of the glyphs are rendered if I copied and paste it on the terminal:

https://github.com/ryanoasis/nerd-fonts/assets/69449791/7b9e7fe7-13be-44dc-a3d1-2fd96f494076

The updated version of the FA glyphs are also used in the output of lsd even though the glyphs inside lsd's configuration file are stilled rendered using the Font Awesome 4 glyphs.

20240405_17h38m56s_grim

I should mention that I have Font Awesome 4 installed along side ttf-dejavu-nerd. I have also have the following lines inside my alacritty config:

[font]
normal.family      = 'DejaVuSansMono'
bold.family        = 'DejaVuSansMono'
italic.family      = 'DejaVuSansMono'
bold_italic.family = 'DejaVuSansMono'
size               = 13

The reason I'm not using the latest Font Awesome is because I simply prefer how the glyphs look in Font Awesome 4. My guess is that ttf-devaju-nerd has the latest Font Awesome glyphs baked into it. But what I don't understand is the inconsistency in the rendering of the glyphs. Why are the Font Awesome 4 glyphs used in certain cases (e.g: inside Neovim and when copy and pasting the glyphs) but not in other cases (like in the output of lsd or the terminal prompt) even though the glyphs are rendered by the same terminal emulator? If I have Font Awesome 4 installed alongside ttf-dejavu-nerd, shouldn't the Font Awesome 4 glyphs be used in all cases?

The issue goes away after downgrading the ttf-dejavu-nerd package back to 3.1

🔧 Your Setup

Finii commented 2 months ago

I guess you should make the Font Awesome 4.0 icon file the prefereed one in your fontconfig.

If you use the eye-slash (F070) in some terminal or whatever:

maybe something like

<fontconfig>
  <alias>
    <family>DejaVuSansMono</family>
    <prefer><family>Font Awesome 4</family></prefer>
  </alias>
</fontconfig>

(Well, I do not know the family name of your FA-4 font.)

Edit: Fontconfig conf is usually in /etc/fonts/conf.d/ I guess.

Finii commented 2 months ago

The video is indeed strange.

The difference seems to be that the glyph above is bold while the one you paste is regular. In your terminal you can select different fonts for both. If the glyph is in neither (you later say you have DejaVuSansMono for these, which will be DejaVuSansMono-Regular and DejaVuSansMono-Bold - two different fonts from a fontconfig point of view. Both do not have the glyph and for both some (random) substitution font is individually selected. And that is different. After a reboot that might change.

That should in principle we fixed by the fontconfig above. Just put that into some new text file in the mentioned directory and name the file like the others (number then some text and .conf).

Edit: Highlight 'individually'

anthony-S93 commented 2 months ago

I guess you should make the Font Awesome 4.0 icon file the prefereed one in your fontconfig.

If you use the eye-slash (F070) in some terminal or whatever:

* If it's in the current font it will be used (e.g. DejaVu Nerd Font)

* If it's not in the current font some other ('random') font that has a glyph at that codepoint is used
  That can be especially inconsistent (some apps using the Nerd Font, some the Font Awesome 4 font

maybe something like

<fontconfig>
  <alias>
    <family>DejaVuSansMono</family>
    <prefer><family>Font Awesome 4</family></prefer>
  </alias>
</fontconfig>

(Well, I do not know the family name of your FA-4 font.)

Edit: Fontconfig conf is usually in /etc/fonts/conf.d/ I guess.

Thank you for the response. It turns out that you are on the right track. Adding a font configuration does indeed resolve the issue.