HOWTO Install Fonts

From LinuxReviews
Jump to navigationJump to search

Installing fonts on GNU/Linux machines running the X display server is not as strait forward as it should be yet it is not very hard if you follow the simple steps on this page. The only important step is to make the path where you place font files a known font folder.

Placing The Font Files[edit]

Modern GNU/Linux distributions tend to have a font configuration folder called /etc/X11/fontpath.d full of symbolic links to actual folders where fonts live such as /usr/share/X11/fonts/misc, /usr/share/fonts/liberation-serif and similar.

A trick to that will let you add your own fonts system-wide is to create a custom font folder:

sudo mkdir -p /usr/local/share/fonts/custom

You should make sure that folder is world readable:

sudo chmod -R a+rX /usr/local/share/fonts/

and make X aware of that folder by making a symbolic link in /etc/X11/fontpath.d

sudo ln -s /usr/local/share/fonts/custom /etc/X11/fontpath.d/custom-systemwide-fonts

Next, copy some huge collection of preferably TrueType (.ttf) fonts from your local friendly website or some other operating systems fine font folder into /usr/local/share/fonts/custom (and make sure they are readable with sudo /usr/local/share/fonts/custom/* if they are not).

Sub-folders within a known font path are read, .ttf files placed in /usr/local/share/fonts/custom/myfont will be read automatically if /usr/local/share/fonts/custom is a known font path.

Per-User Font Paths[edit]

You can, alternatively, place fonts in $HOME/.local/share/fonts (you may need to mkdir ~/.local/share/fonts to create it) to make them available only to your user account.

Fonts in sub-folders within $HOME/.local/share/fonts are read and made available automatically.

The folder $HOME/.fonts can also be used for mostly historical reasons. Placing fonts and other files in .local/share is preferable.

Making Installed Fonts Available[edit]

Running the fc-cache command is required to make newly installed fonts available in an existing X session, placing them somewhere where they can be read is not enough. Running fc-cache with no parameters is enough to make it read and create cache for new fonts. However, you may want to add -v to see what directories are actually scanned for fonts. You can add -f to force re-generation of font caches but that is typically required (unless you changed a pre-existing font .ttf or .otf font file).

You can use fc-list to see a (very long) list of available fonts once they have been made available by running fc-cache.

The font cache is (re)-generated when you login so logging out and back in is a perhaps not that great alternative to running fc-cache.

Acquiring The Fonts[edit]

From Random Websites[edit]

There are plenty of websites where you can download random font files or collections of font files. Be aware that while many of those sites advertise fonts as "free" they are in many cases not free.

1001freefonts.com and https://www.fontspace.com/ fontspace.com] are a nice font websites with huge amounts of fonts available. Many of the fonts are nice. However, downloading a dozen of fonts from them revealed that some of the .zip files you get have a info.txt file that says "license: Public Domain" and a misc/ (or other) folder with that says something like "Thank for purchasing and using $fontname".

GitHub[edit]

Microsoft GitHub is, even though it is mostly known for code, a great place to get a lot of actually free fonts.

  • Hack is a MIT-licensed font suitable for editing source code


Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.