The stock fonts in your Linux desktop may not look good or satisfy your requirements. You might want to install new fonts in your Linux distribution. In this brief guide, let me show you how to add fonts in Fedora Linux system.
Table of Contents
1. Introduction
In general, fonts play an important role in designing. They add value to your text. It helps the readers to perceive information from the text.
Whether you’re designing a website, a presentation or simply you'd like to caption an image, choosing the right font is the key to effective communication!
Most Linux distributions ships with several fonts by default. If they don't suit for your taste, you can add new fonts to your Linux distribution as described in the following steps.
2. Add fonts in Fedora Linux
We can add fonts in Fedora and other Linux distributions in two ways.
2.1. Install packaged fonts
Fedora dev team has packaged several freely-licensed fonts. So you can install them using the dnf
package manager.
To list all available packaged fonts from the enabled repositories, run:
$ sudo dnf search fonts
This will list all available from the official repositories.
You can also narrow down the specific type of font using grep
command:
$ sudo dnf search fonts | grep tamil
This will display Tamil language related fonts.
If font is already packaged and you know name of the font, you can directly add it using the dnf
package manager.
For instance, to install bitmap fonts, you would run:
$ sudo dnf install bitmap-console-fonts
Heads Up: Installing packaged font is always recommended. You will receive regular updates and customization when a new version of the installed font is available.
2.2. Install unpackaged fonts (install fonts manually)
Some fonts may not be packaged due to licensing or other reasons. In such cases, you can manually download the fonts and copy them to the fonts
directory in Linux.
You can install fonts system-wide or per-user basis.
If you prefer to install fonts to all users i.e. system-wide, copy the font files to /usr/share/fonts/
or /usr/local/share/fonts/
directory.
If you want to install fonts for individual user only, copy the fonts to ~/.local/share/fonts/
directory. If the fonts directory is not exists, simply create it.
You may want to install more than one font sometimes. Instead of keeping all fonts in a single directory, it is a good practice to keep them in separate directory.
For example, I am going to install Firacode
and Opendyslexic
fonts. So, I created the following two directories for each font type:
$ mkdir -p ~/.local/share/fonts/firacode
$ mkdir -p ~/.local/share/fonts/opendyslexic
If you want to install fonts for all users, then create the necessary directories like below:
$ sudo mkdir -p /usr/share/fonts/firacode
$ sudo mkdir -p /usr/share/fonts/opendyslexic
Now, go to the directory where you downloaded the fonts and copy them to the fonts
directory as shown below.
Per-user font installation:
$ sudo cp ~/Downloads/firacode.ttf ~/.local/share/fonts/firacode
Similarly, add other fonts:
$ sudo cp ~/Downloads/opendyslexic.ttf ~/.local/share/fonts/opendyslexic
System-wide font installation:
$ sudo cp ~/Downloads/firacode.ttf /usr/share/fonts/firacode
$ sudo cp ~/Downloads/opendyslexic.ttf /usr/share/fonts/opendyslexic
Heads Up: Since unpackaged fonts are not installed by the package manager, you will not receive automatic updates. So it is always recommend to install packaged fonts to get regular updates and optimizations.
2.3. Update font cache
Once all the fonts are copied or installed, run the fc-cache
command to build font information cache files for applications using fontconfig
for their font handling:
$ fc-cache -fv
If you have added the fonts to system-wide (i.e. /usr/share/fonts/
or /usr/local/share/fonts/
location), run the fc-cache
command with sudo
or root
privilege:
$ sudo fc-cache -fv
Conclusion
As you can see, installing fonts in Fedora Linux is not a big deal. Even though this guide is specifically written for Fedora, you can follow the same instructions to add fonts in almost all Linux distributions.