Documentation: Installing Google Fonts on Linux

Preston OsoroPreston Osoro
2 min read

This guide provides systematic steps to download and install Google Fonts on a Linux system that are not included by default. This process involves downloading the fonts, extracting them, and moving them to the system fonts directory.

Prerequisites

  • A Linux system (Ubuntu 20.04 or similar).

  • Terminal access.

  • unzip and fc-cache tools installed (these can be installed via the package manager if not already present).

Steps

  1. Download the Google Fonts ZIP File

    • Navigate to the Google Fonts website.

    • Search for and select the desired font.

    • Click the download button to get the ZIP file containing the font files.

  2. Extract the ZIP File

    • Open a terminal.

    • Navigate to the directory where the ZIP file was downloaded. For example, if the file is in Downloads:

        cd ~/Downloads
      
    • Extract the ZIP file using unzip:

        unzip <font-name>.zip -d <font-name>
      

      Replace <font-name> with the name of the downloaded ZIP file and extracted folder.

  3. Move the Fonts to the System Directory

    • Navigate to the extracted folder containing the .ttf or .otf font files:

        cd <font-name>
      
    • Move the font files to the system-wide fonts directory. You will need superuser permissions:

        sudo mv *.ttf /usr/share/fonts/
        sudo mv *.otf /usr/share/fonts/
      

      If you have different types of font files, adjust the command accordingly.

  4. Update the Font Cache

    • Refresh the font cache to ensure the new fonts are recognized by the system:

        sudo fc-cache -fv
      
  5. Verify the Installation

    • Confirm that the fonts are installed correctly:

        fc-list | grep <font-name>
      

      Replace <font-name> with the name of the font to verify its installation.

Notes

  • If you prefer to install fonts only for your user account, follow the same steps but move the fonts to ~/.local/share/fonts/ instead of /usr/share/fonts/. You don’t need superuser permissions in this case.

  • Ensure that the directory structure and font file names are correct when performing the mv and unzip operations.

This guide helps you systematically install Google Fonts on a Linux system, ensuring they are available for use in all applications.

0
Subscribe to my newsletter

Read articles from Preston Osoro directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Preston Osoro
Preston Osoro