Score:0

Installing custom fonts on Ubuntu Server

fr flag

I would like to install a custom TTF or OTF font on Ubuntu Server, but I don't want to have to install a GUI or desktop environment. Is there a way to get this custom font (Fira Code Nerd Font) to be used as the terminal font for Ubuntu Server?

Terrance avatar
id flag
Is your server going to be headless and only access via SSH? If so, there is no need for the font on the server level since it is controlled by the terminal application that is running.
user535733 avatar
cn flag
Seems like a duplicate of https://unix.stackexchange.com/questions/49779/can-i-change-the-font-of-the-text-mode-console
Score:0
in flag

There are a couple of things you will need to do to make this work. So long as you don't mind fiddling around with fonts, follow these steps:

I – Convert the .ttf font to a .psf

  1. Install the bdf2psf package:

    sudo apt install bdf2psf
    
  2. Convert the font to an intermediary .bdf:

    otf2bdf -p 18 -r 96 -o fc-nerd.bdf fc-nerd.ttf
    

    Note: Be sure to replace fc-nerd with the actual font name.

    You may need to modify the -p value to match the glyph size, as it's not standard.

  3. Convert the .bdf to a .psf:

    bdf2psf --fb fc-nerd.bdf /usr/share/bdf2psf/standard.equivalents /usr/share/bdf2psf/fontsets/Uni2.512 512 fc-nerd.psf
    
  4. Move the file to the appropriate location:

    mv fc-nerd.psf /usr/share/consolefonts/fc-nerd.psf
    

II – Set the Font

  1. Use setfont to configure the console:
    setfont fc-nerd 
    

If the font doesn't look right, go back to the first set of steps and modify that -p value until it looks better.

If you would like to use the font every time you sign into the console, you can add the setfont command to the end of your ~/.bashrc file.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.