This tutorial explains Linux “fc-cache” command, options and its usage with examples.
DESCRIPTION
fc-cache scans the font directories on the system and builds font information cache files for applications using fontconfig for their font handling. If directory arguments are not given, fc-cache uses each directory in the current font configuration. Each directory is scanned for font files readable by FreeType. A cache is created which contains properties of each font and the associated filename. This cache is used to speed up application startup when using the fontconfig library.
SYNOPSIS
fc-cache [ -fsvVh ] [ –force ] [ –system-only ] [ –verbose ] [ dir… ]
OPTIONS
-f
Force re-generation of apparently up-to-date cache files, overriding the timestamp checking.
-s
Only scan system-wide directories, omitting the places located in the user’s home directory.
-v
Display status information while busy.
dir
Directory to scan for fonts.
EXAMPLES
1. Once you have your handy collection of True Type fonts, you are going to want to create a directory to hold them. Installing the fonts system-wide will give all users access to them. First, create a font directory in /usr/share/fonts/truetype. Call this directory newfonts. Issue the command sudo mkdir /usr/share/fonts/truetype/newfonts. You will have to enter your sudo password to complete this task.
Once this directory is created, place all your *ttf or *TTF files in the newfonts directory. With the fonts in place you will then need to issue the command
# fc-cache -f -v
to make the system aware of the new fonts. Once this is done, the system knows about the new fonts and all the system users will have access to them.
2. If you want to make these fonts available only to specific users, then you will follow the same directions except you will add the fonts only to the users’ ~/.fonts directory. If the ~/.fonts directory doesn’t exist, create it with mkdir ~/.fonts (while logged into the specific users’ accounts). Now move (or copy) all of the *ttf and/or *TTF files into the new directory and run
# fc-cache -f -v
to make the users’ accounts aware of the fonts.
If you have a single-user machine, go with the latter version.
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.
- Check Information Technology Books
- Check Linux Books
- Practice Programming MCQs
- Apply for Programming Internship