kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.06k stars 972 forks source link

kitty does not properly detect LiterationMono Nerd Font #4374

Closed Dieterbe closed 2 years ago

Dieterbe commented 2 years ago

Hello, first of all, thanks for a wonderful terminal program.

I have the LiberationMono Nerd Font installed:

~ ❯❯❯ fc-match 'LiterationMono Nerd Font'
Literation Mono Nerd Font Complete.ttf: "LiterationMono Nerd Font" "Book"
~ ❯❯❯ fc-list 'LiterationMono Nerd Font'
/usr/share/fonts/TTF/Literation Mono Bold Italic Nerd Font Complete.ttf: LiterationMono Nerd Font:style=Bold Italic
/usr/share/fonts/TTF/Literation Mono Italic Nerd Font Complete.ttf: LiterationMono Nerd Font:style=Italic
/usr/share/fonts/TTF/Literation Mono Bold Nerd Font Complete.ttf: LiterationMono Nerd Font:style=Bold
/usr/share/fonts/TTF/Literation Mono Nerd Font Complete.ttf: LiterationMono Nerd Font:style=Book
~ ❯❯❯

The problem can be reproduced using this minimal kitty.conf

font_family      LiterationMono Nerd Font
font_size 11.0

When I run the following script, it does seem to use the proper font, but only for the "base version", underline and strikethrough (which didn't appear in fc-list/fc-match). the bolds and italics don't seem to work (these did show up)

See screenshot below.

read -r -d '' text <<'EOF'
'" <> ?+| /=\ -_ ,.:;
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
! @ # $ % ^ & * ( ) { }
1 2 3 4 5 6 7 8 9 0 [ ]
EOF
echo -e "Regular:\n$text"
echo -e "\n\e[1mBold:\n$text\e[0m"
echo -e "\n\e[3mItalic:\n$text\e[0m"
echo -e "\n\e[3m\e[1mBold italic:\n$text\e[0m"
echo -e "\n\e[4mUnderline:\n$text\e[0m"
echo -e "\n\e[9mStrikethrough:\n$text\e[0m"
echo
echo "Icons:"
echo "FontAwesome       MaterialDesign    Devicons             Octicons       Powerline                        Seti-Ui           Weather-icons"
echo " nf-fa-wifi      直nf-mdi-wifi      nf-dev-gulp         nf-oct-x      nf-ple-flame_thick              nf-seti-xml      nf-weather-sleet"
echo " nf-fa-arrow_up   nf-mdi-battery   nv-def-hackernews   nf-oct-star   nf-ple-honeycomb                nf-seti-folder   nf-weather-meteor"
echo " nf-fa-battery    nf-mdi-apple     nf-dev-github       nf-oct-key    nf-ple-left_half_circle_thick   nf-seti-python   nf-weather-alien"
echo
echo "Icon size comparison examples"
echo "see https://github.com/ryanoasis/nerd-fonts/issues/127"
echo -e "Small?:\uf300\uf460\ue70a\ue258"
echo -e "So-so?:\uf000\uf072"
echo -e "Normal:\ue285\uf245"

Screenshots kitty-literation-screenshot

Any idea why the bold and italics don't render correctly?

BTW, when I start kitty with debug-font-fallback, it doesn't seem to mention the base font. I'm not sure how useful this parameter is for this case, as it explicitly aims to debug "fallback glyhps" not in the main font. but wanted to mention it anyway.

~ ❯❯❯ kitty --debug-font-fallback
[353 11:16:50.038183] Preloaded font faces:
[353 11:16:50.038204] normal face: /usr/share/fonts/TTF/AndaleMo.TTF:0
[353 11:16:50.038208] bold face: /usr/share/fonts/TTF/AndaleMo.TTF:0
[353 11:16:50.038212] italic face: /usr/share/fonts/TTF/AndaleMo.TTF:0
[353 11:16:50.038215] bi face: /usr/share/fonts/TTF/AndaleMo.TTF:0
U+276f bold Face(family=Hack Nerd Font Mono, style=Bold, ps_name=HackNerdFontCompleteM-Bold, path=/usr/share/fonts/TTF/Hack Bold Nerd Font Complete Mono.ttf, index=0, is_scalable=True, has_color=False, ascen
der=19
01, descender=-483, height=2384, underline_position=-265, underline_thickness=90, strikethrough_position=530, strikethrough_thickness=102) (new face)
U+276f bold Face(family=Hack Nerd Font Mono, style=Bold, ps_name=HackNerdFontCompleteM-Bold, path=/usr/share/fonts/TTF/Hack Bold Nerd Font Complete Mono.ttf, index=0, is_scalable=True, has_color=False, ascen
der=19
01, descender=-483, height=2384, underline_position=-265, underline_thickness=90, strikethrough_position=530, strikethrough_thickness=102)
U+276f bold Face(family=Hack Nerd Font Mono, style=Bold, ps_name=HackNerdFontCompleteM-Bold, path=/usr/share/fonts/TTF/Hack Bold Nerd Font Complete Mono.ttf, index=0, is_scalable=True, has_color=False, ascen
der=19
01, descender=-483, height=2384, underline_position=-265, underline_thickness=90, strikethrough_position=530, strikethrough_thickness=102)

Press Ctrl+Shift+F6 (cmd+option+comma on macOS) in kitty, to copy debug output about kitty and its configuration to the clipboard and paste it here.

this doesn't do anything for me.

On older versions of kitty, run kitty --debug-config instead

~ ❯❯❯ kitty --debug-config
Unknown option: --debug-config
~ ❯❯❯ kitty --version                                                                                                                         
kitty 0.23.1 created by Kovid Goyal

Anyway, I have provided the minimal config.

For completeness sake, here's more information about the font package and its contents:

~/.c/kitty ❯❯❯ pacman -Qs liberation
local/nerd-fonts-liberation-mono 2.1.0-2 (nerd-fonts)
    Patched font Liberation Mono from the nerd-fonts library
~/.c/kitty ❯❯❯ pacman -Qi nerd-fonts-liberation-mono
Name            : nerd-fonts-liberation-mono
Version         : 2.1.0-2
Description     : Patched font Liberation Mono from the nerd-fonts library
Architecture    : any
URL             : https://github.com/ryanoasis/nerd-fonts
Licenses        : MIT
Groups          : nerd-fonts
Provides        : nerd-fonts-liberation-mono
Depends On      : fontconfig
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : nerd-fonts-git  nerd-fonts-complete
Replaces        : None
Installed Size  : 27.04 MiB
Packager        : Unknown Packager
Build Date      : Sun 12 Dec 2021 02:41:59 PM EST
Install Date    : Sun 12 Dec 2021 02:42:00 PM EST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None
~/.c/kitty ❯❯❯ pacman -Ql nerd-fonts-liberation-mono
nerd-fonts-liberation-mono /usr/
nerd-fonts-liberation-mono /usr/share/
nerd-fonts-liberation-mono /usr/share/fonts/
nerd-fonts-liberation-mono /usr/share/fonts/TTF/
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Mono Bold Italic Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Mono Bold Italic Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Mono Bold Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Mono Bold Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Mono Italic Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Mono Italic Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Mono Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Mono Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Sans Bold Italic Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Sans Bold Italic Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Sans Bold Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Sans Bold Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Sans Italic Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Sans Italic Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Sans Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Sans Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Serif Bold Italic Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Serif Bold Italic Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Serif Bold Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Serif Bold Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Serif Italic Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Serif Italic Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Serif Nerd Font Complete Mono.ttf
nerd-fonts-liberation-mono /usr/share/fonts/TTF/Literation Serif Nerd Font Complete.ttf
nerd-fonts-liberation-mono /usr/share/licenses/
nerd-fonts-liberation-mono /usr/share/licenses/nerd-fonts-liberation-mono/
nerd-fonts-liberation-mono /usr/share/licenses/nerd-fonts-liberation-mono/LICENSE
Dieterbe commented 2 years ago

I have also tried setting the italic font explicitly like so:

font_family      LiterationMono Nerd Font
italic_font      LiterationMono Nerd Font:style=Italic

Seems like fc-match recognizes it properly:

~ ❯❯❯ fc-match 'LiterationMono Nerd Font:style=Italic'
Literation Mono Italic Nerd Font Complete.ttf: "LiterationMono Nerd Font" "Italic"

but again, using the test script, it doesn't show the italic text

kovidgoyal commented 2 years ago

The font name is Liberation Mono not Literation Mono. And don't use patched fonts, just install the nerd fonts separately. kitty will use it automatically and you can tell it to explicitly as well using symbol_map in kitty.conf.

Dieterbe commented 2 years ago

And don't use patched fonts, just install the nerd fonts separately

I don't understand this. Nerd Fonts are patched fonts. Any nerd font installed is a patched font. Perhaps what you mean is to install liberation-mono and separate font packages to provide Font Awesome, Devicons, Octicons and Material Design icons ?

I was specifically recommended elsewhere to just go with nerd-fonts as it removes the complication of using multiple fonts to get the icon packages.

(the name of the nerd font version is Literation, as can be seen in fc-match and fc-list, and is explained further on https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/LiberationMono/font-info.md )

kovidgoyal commented 2 years ago

The nerd fonts are available as a separate standalone font, look in its releases page. Use that.

And if you want to find the names of fonts to use in kitty.conf, use kitty +list-fonts not fc-list.

xsrvmy commented 2 years ago

Were nerd fonts downloaded from master branch or 2.1.0? The master branch is bugged right now.

mattia-marini commented 3 months ago

Just for future reference, you should got to NerdFonts github, got to the latest release and search for "NerdFontSymbolsOnly". You should find everything here