How to install custom fonts in Linux desktop

One way to add personalization to the documents or presentations that you create is via using custom fonts. In Linux desktop, you can download and add custom fonts as you wish. Linux desktop supports both TrueType fonts and OpenType fonts. For those wanting to use custom fonts, there are many free, open-source fonts you can download from the web (e.g., TrueType fonts from Google Web Fonts).

In this tutorial, I will describe how to install custom fonts in Linux desktop environment.

Let's say you already downloaded TrueType and OpenType custom fonts (e.g., custom_font.ttf or custom_font.otf) from somewhere. Verify that those fonts are not installed on your system by using this tutorial. Once you verify that those fonts are not available on your Linux desktop, proceed as follows to install them on your system.

Install Custom Fonts System-wide

If you want to make the custom fonts available system-wide (i.e., any user who logs in to your desktop can use the fonts), install the fonts in a system-widely accessible location as follows.

To install a TrueType font (e.g., custom_font.ttf), copy the font under /usr/share/fonts/truetype directory. Make sure to make the fonts readable by others.

$ chmod 644 custom_font.ttf
$ sudo cp custom_font.ttf /usr/share/fonts/truetype

If you want, you can create any sub-directory under /usr/share/fonts/truetype, and copy the font in there instead:

$ chmod 644 custom_font.ttf
$ sudo mkdir /usr/share/fonts/truetype/google_fonts
$ sudo cp custom_font.ttf /usr/share/fonts/truetype/google_fonts

To install an OpenType font (e.g., custom_font.otf), use /usr/share/fonts/opentype directory to install fonts.

$ chmod 644 custom_font.otf
$ sudo cp custom_font.otf /usr/share/fonts/opentype

Similar to TrueType fonts, you can create any number of sub-directories under /usr/share/fonts/opentype:

$ chmod 644 custom_font.otf
$ sudo mkdir /usr/share/fonts/opentype/my_custom_fonts
$ sudo cp custom_font.otf /usr/share/fonts/opentype/my_custom_fonts

After copying your font to an appropriate font directory as described above, rebuild a system-wide font cache, simply by running:

$ sudo fc-cache -fv

At this point, you should be able to use the installed fonts in office suites like LibreOffice.

Install Custom Fonts on a Per-User Basis

If you want to install custom fonts per-user (i.e., make custom fonts available to you only), you can install the fonts in your home directory.

For this, create .fonts directory in your home directory.

$ mkdir ~/.fonts

Then (optionally) create any number of sub-directories, and copy any types of fonts (e.g., TrueType or OpenType) under ~/.fonts. For example:

$ mkdir ~/.fonts/my_truetype_fonts
$ mkdir ~/.fonts/my_opentype_fonts
$ cp custom_fonts.ttf ~/.fonts/my_truetype_fonts
$ cp custom_fonts.otf ~/.fonts/my_opentype_fonts

Once you have copies custom fonts in ~/.fonts directory, rebuild your font cache, without using sudo.

$ fc-cache -fv

The installed fonts can only be accessible when you log in to your Linux desktop.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

Leave a comment

Your email address will not be published. Required fields are marked *