Fontconfig is designed to configure and customize the use of fonts stored within the local filesystem. As the requirements and expectations of applications using the font configuration mechanism differ, Fontconfig is designed to be useful at several levels. Applications can get just the list of font directories or can use the complete font naming and matching system. Porting an existing system with a custom font configuration mechanism can start with the lowest level and migrate in the future to using more of the capabilities of this system, supplanting existing mechanisms within the application.
The library is designed to solve a specific set of tasks:
The most basic requirement for the font configuration system is the ability to locate fonts on the system. Fonts are stored in files, so locating fonts is a matter of identifying the directories holding the font files.
Applications looking for particular fonts need to have information about the characteristics of each available font ready for inspection during the selection process. Such information can be gleaned from the font files, but that process involves reading the font file, which can be a time consuming process when many fonts are available.
Fontconfig looks in cache files in each font directory for saved information about the available fonts. Information about fonts found in directories without cache files is saved in a per-user font cache. This per-user cache is managed automatically by the library to ensure it remains accurate.
Beyond simply making fonts available to the application, Fontconfig provides mechanisms for customizing which font is selected by particular application requests and how that font is rendered on the screen. This provides the ability for users to map generic names like ``sans-serif'' and ``monospace'' to one of the available fonts. The customization mechanism also allows users to substitute selected fonts for missing or poorly rendered ones.