Unable to detect new TTF font (Nerd Font)
I am trying to install a Nerd Font variant to Ubuntu (specifically "DejaVu Sans Mono Nerd Font Complete.ttf" from Nerd Fonts GitHub repo) for use in my terminal (Kitty, already using DejaVu Sans Mono). I've downloaded this file and copied to it ~/.local/share/fonts, after which I restarted the terminal and tested to see if it was picked up. Both terminals tested didn't hadn't picked up the new font.
I also tried adding the font to ~/.fonts, and still not being picked up.
After searching how to install fonts, I've also tried running fc-cach -fv after copying to each directory and then checking what is installed with fc-list | grep Deja. The font isn't listed. Only fonts in /user/share/fonts seem to be detected.
I have also tried installed the font with Ubuntu font-manager, but this reports the following error: Library.vala:162: 2 :: unknown file format :: /home/.../.fonts/DejaVu Sans Mono Nerd Font Complete.ttf.
Has anyone any experience installing Nerd fonts, or ideas why this true type font isn't being detected?
I'm running Ubuntu Mate 20.04.1.
21 Answer
You are using the wrong font files. Use the fonts that have "Nerd Font Complete Mono Windows Compatible" in the file names.
Copy the files into a subdirectory in ~/.local/share/fonts/. (~/.fonts/ is deprecated, but should still work.) Then run fc-cache -r.
According to the Nerd Fonts Readme file:
- Pick your font family and then select from the
'complete'directory.
- If you are on Windows pick a font with the
'Windows Compatible'suffix.
- This includes specific tweaks to ensure the font works on Windows, in particular monospace identification and font name length limitations
- If you are limited to monospaced fonts (because of your terminal, etc) then pick a font with the
'Mono'suffix.
- This denotes that the Nerd Font glyphs will be monospaced not necessarily that the entire font will be monospaced
If the font still does not show up in font selectors, some terminals have a "Show all fonts" option you can try.
For kitty, you need to edit ~/.config/kitty/kitty.conf. Note that there are no quotation marks around the font name.
font_family DejaVuSansMono NF