How to Load Fonts in a Linux Environment

Do follow through the steps below to ensure that fonts are loaded correctly in the font & system cache of your Linux environment:

A/ Open a command line & run the command, fc-list to print out all the font files and their paths found in the system cache. This command will show you all the font files which have been loaded to the font & system cache.

B/ Run fc-list | grep <fontname> command, for e.g. fc-list | grep Arial Unicode MS to ensure that the system returns the font path and location of the declared font.


Do take note that there are no more Java font directories in JDKs from Java 11 onwards including some Java 8 versions.

If both option A & B does not output the desired font path, it means that the font may have not been loaded to the font and system cache.

Steps to load the font files into the font & system cache.

  1. Copy the required fonts to a sub-directory in the default font path, e.g. /usr/share/fonts/, if the OS is unable to detect it in its current path.

  2. Run the fc-cache -f -v command every time a new font is copied to the font directory to load it to the system font cache.

  3. Restart the OS.

  4. Run the fc-list | grep command to ensure the system returns the font path and location.

  5. Additionally, do ensure that font path is configured to point exactly to the directory in which where the new loaded font file resides.