Linux is Freedom, we all know that. As the end user, we have the freedom to make any changes to the system, including changing the fonts. Every Linux distribution comes with some fonts installed. So, How to install fonts in Linux other than what is already there?
Install Fonts in Linux with Desktop Environment
On Linux, some desktop environments allow installing fonts with a graphical interface. Let's examine the font installation steps for the Gnome(Fedora OS) and KDE(Debian, Pardus OS) desktop environments.
Gnome Desktop
If you have Gnome desktop installed on your system, it comes with the gnome-font-viewer application installed. You can call it by typing "fonts" from the menu.
All fonts are listed on this screen. Click on the font you want to install. If the button on the top right of the screen is "Installed", the font you have chosen is already installed. If “Install” is active, you can click and install it on your system.
By clicking on Info, you can see where the package is installed and all the information about the package. You can install fonts that are not in Gnome Fonts and exist in the package repository.
For example, the saab-fonts package is not installed on the system, so it did not appear in Gnome fonts.
Then let's install the package;
foc@fedora:~$ sudo dnf install saab-fonts
Now let's look at Gnome Fonts again.
You can see it loaded into the system.
To remove the font you have installed from the system, let's first find the font name;
foc@fedora:~$ sudo dnf list installed | grep saab saab-fonts.noarch 0.91-24.fc35 @fedora
Let's remove it from the system;
foc@fedora:~$ sudo dnf remove saab-fonts
Then when you search for the font on Gnome Fonts, you can see that it is deleted.
KDE Desktop
Open the Font Management application from the menu. System fonts and personal fonts are listed on this screen.
Then click the Add button. On the screen that comes up, select the fonts you have downloaded from the internet and click the Open button.
What types of fonts should be installed?
For example, we choose the Personal/System font. Then the fonts are loaded into the system.
To remove the font from the system, simply press the Delete button on the screen.
Install Fonts in Linux Terminal
In Linux, system fonts and personal fonts are in different directories. Let's talk about the font installation steps in two options.
Personal Fonts
Fonts are located in the following directory under each user's home directory;
foc@fedora:~$ ls -l ~/.local/share/fonts total 120 -rw-r--r--. 1 foc foc 58940 Jul 24 2021 1Waree-Oblique.otf -rw-r--r--. 1 foc foc 58940 Jul 24 2021 Waree-Oblique.otf
Create [font_family]
name for newly downloaded fonts;
foc@fedora:~$ mkdir -p ~/.local/share/fonts/linux-biolinum
Copy the fonts you downloaded to this directory;
foc@fedora:~$ cp ~/Downloads/linux-biolinum/*.ttf ~/.local/share/fonts/linux-biolinum/
Update font cache with fc-cache;
foc@fedora:~$ fc-cache -f -v
System Fonts
System fonts are located in the following directory;
foc@fedora:~$ ls -l /usr/share/fonts/ total 0 drwxr-xr-x. 1 root root 232 Apr 21 00:03 aajohan-comfortaa-fonts drwxr-xr-x. 1 root root 698 Oct 26 2021 adobe-source-code-pro drwxr-xr-x. 1 root root 550 Jul 21 16:28 adobe-source-sans-pro-fonts
Create the family directory in the main fonts directory as in Personal fonts. But this time run the command with sudo or apply as root user;
foc@fedora:~$ sudo mkdir -p /usr/share/fonts/linux-biolinum
Then copy the files to this directory;
foc@fedora:~$ sudo cp ~/Downloads/linux-biolinum/*.ttf /usr/share/fonts/linux-biolinum/
Clear and regenerate font cache with the following command:
foc@fedora:~$ fc-cache -f -v
After these steps, you can see these fonts on your system with the following commands;
foc@fedora:~$ fc-list | grep linux-biolinum /usr/share/fonts/linux-biolinum/LinBiolinum_RIah.ttf: Linux Biolinum:style=Italic /usr/share/fonts/linux-biolinum/LinBiolinum_RBah.ttf: Linux Biolinum:style=Bold /usr/share/fonts/linux-biolinum/LinBiolinum_Rah.ttf: Linux Biolinum:style=Regular /usr/share/fonts/linux-biolinum/LinBiolinum_Kah.ttf: Linux Biolinum Keyboard:style=Regular
Uninstall Fonts
To remove the font from your system, the file path where the font is located must first be known;
foc@fedora:~$ fc-list | grep biolinum /usr/share/fonts/linux-biolinum/LinBiolinum_RIah.ttf: Linux Biolinum:style=Italic /usr/share/fonts/linux-biolinum/LinBiolinum_RBah.ttf: Linux Biolinum:style=Bold
Then type the font you want to delete after the rm command. To delete a single font belonging to the font family;
foc@fedora:~$ sudo rm /usr/share/fonts/linux-biolinum/LinBiolinum_Rıah.ttf
To completely delete the font family;
foc@fedora:~$ sudo rm -rf /usr/share/fonts/linux-biolinum/
Now let's list the fonts again;
foc@fedora:~$ fc-list | grep biolinum
After this command, you can see that the fonts are not installed in the system.
Summary
In Linux, the fonts brought by the system and found in the repositories are always stable ones. 3rd party installed fonts can sometimes be a problem. Our recommendation is to use the fonts that are available in the system or that are available for download in the repository for you.
References
Gnome DE - Adding new fonts in Fedora
KDE – Font Management
Related Keywords: install fonts in linux terminal, install font ubuntu command line, linux install ttf font command line, install fonts ubuntu, ubuntu fonts folder, linux fonts, centos install fonts, font manager ubuntu