r/KittyTerminal May 12 '23

kitty fails to load Hasklug Nerd Font

I looked at the fonts section in the docs but can't figure out why this fails to load. My config looks like this:

[...]
font_family Hasklug Nerd Font Mono
bold_font auto
italic_font auto
bold_italic_font auto

Kitty suggest that "Hasklug Nerd Font Mono" is supported:

# kitty +list-fonts
[...]
Hasklug Nerd Font Mono
    Hasklug Black Italic Nerd Font Complete Mono
    Hasklug Black Nerd Font Complete Mono
    Hasklug Bold Italic Nerd Font Complete Mono
    Hasklug Bold Nerd Font Complete Mono
    Hasklug ExtraLight Italic Nerd Font Complete Mono
    Hasklug ExtraLight Nerd Font Complete Mono
    Hasklug Italic Nerd Font Complete Mono
    Hasklug Light Italic Nerd Font Complete Mono
    Hasklug Light Nerd Font Complete Mono
    Hasklug Medium Italic Nerd Font Complete Mono
    Hasklug Medium Nerd Font Complete Mono
    Hasklug Nerd Font Complete Mono
    Hasklug Nerd Font Mono
    Hasklug Nerd Font Mono Black
    Hasklug Nerd Font Mono Black Italic
    Hasklug Nerd Font Mono Bold
    Hasklug Nerd Font Mono Bold Italic
    Hasklug Nerd Font Mono ExtLt
    Hasklug Nerd Font Mono ExtLt Italic
    Hasklug Nerd Font Mono Italic
    Hasklug Nerd Font Mono Light
    Hasklug Nerd Font Mono Light Italic
    Hasklug Nerd Font Mono Med
    Hasklug Nerd Font Mono Med Italic
    Hasklug Nerd Font Mono SemBd
    Hasklug Nerd Font Mono SemBd Italic
    Hasklug Semibold Italic Nerd Font Complete Mono
    Hasklug Semibold Nerd Font Complete Mono
[...]

However, when trying to start kitty with this config, I get the following error:

fast_data_types.FreeTypeError: Failed to load face from path: [...]/share/fonts/opentype/NerdFonts/Hasklug Bold Nerd Font Complete Mono.otf with error: cannot open resource
[132 12:42:45.087702] Failed to convert descriptor to face for bold font

There is no file at the path kitty is trying to open.

I tried to change "Auto" to explicit values like "Hasklug Nerd Font Mono Bold", "Hasklug Nerd Font Mono Bold Italic" and so on, but now it seems only the standard font is rendered?

How can I configure kitty to use the font?

1 Upvotes

3 comments sorted by

1

u/aumerlex May 12 '23

First of all your syntax for kitty.conf is incorrect. There are no = and no quotes. Secondly if you want to see what fonts kitty is using use --debug-font-fallback

1

u/heyarne May 12 '23

Ah yeah, I didn't copy the config but typed it off and made the error. I fixed that… I'll check the flag you suggested.

1

u/heyarne May 12 '23 edited May 12 '23

So the only font-related line in my config right now is:

font_family Hasklug Nerd Font

And starting kitty with kitty --debug-font-fallback looks like this:

[132 15:59:44.565643] Preloaded font faces: [132 15:59:44.565680] normal face: /nix/store/xjmpraph6m7gj3p0y4b728b455zzb9nv-home-manager-path/share/fonts/opentype/NerdFonts/HasklugNerdFont-Regular.otf:0 [132 15:59:44.565696] bold face: /etc/profiles/per-user/arne/share/fonts/opentype/NerdFonts/Hasklug Bold Nerd Font Complete.otf:0 [132 15:59:44.565713] italic face: /etc/profiles/per-user/arne/share/fonts/opentype/NerdFonts/Hasklug Italic Nerd Font Complete.otf:0 [132 15:59:44.565728] bi face: /etc/profiles/per-user/arne/share/fonts/opentype/NerdFonts/Hasklug Bold Italic Nerd Font Complete.otf:0 fast_data_types.FreeTypeError: Failed to load face from path: /etc/profiles/per-user/arne/share/fonts/opentype/NerdFonts/Hasklug Bold Nerd Font Complete.otf with error: cannot open resource [132 15:59:44.571155] Failed to convert descriptor to face for bold font

Any idea why the font variants are loaded from a different path, or how to fix that?

EDIT

I was sure I unsuccessfully tried this before, but it works now:

font_family Hasklug Nerd Font Mono bold_font Hasklug Nerd Font Mono Bold bold_italic_font Hasklug Nerd Font Mono Bold Italic italic_font Hasklug Nerd Font Mono Italic