Rahul Sharma (Editor)

Fontconfig

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Original author(s)
  
Keith Packard

Type
  
Font handling library

Operating system
  
Unix-like systems

Website
  
fontconfig.org

Fontconfig

Stable release
  
2.12.1 / 5 August 2016; 6 months ago (2016-08-05)

Fontconfig (or fontconfig) is a free software program library designed to provide configuration, enumeration and substitution of fonts to other programs. Fontconfig was originally written and maintained by Keith Packard, and is currently maintained by Behdad Esfahbod.

Contents

Fontconfig is typically used on graphical Linux (and other Unix-like) desktops, where it remains an important part of handling fonts. However, it is also sometimes used on other platforms, notably including Windows versions of software that use Pango for laying out and rendering text, such as GIMP.

Usage

End-users can use fontconfig, directly or indirectly, to customize and configure fonts on the system.

Applications can use fontconfig in two ways:

  1. by querying it for the available fonts on the system, or
  2. by querying it for a font matching certain parameters (comprising a pattern) as closely as possible.

To perform font matching, fontconfig stores typesetting information about all of the installed fonts, including the name of the font family, style, weight, DPI, and Unicode coverage. This information is also used to perform font substitution.

Configuration

Fontconfig uses XML format for its configuration files. The Document Type Definition (DTD) for fontconfig files is normally located at /etc/fonts/fonts.dtd.

The master configuration file - usually /etc/fonts/fonts.conf - references a few other configuration locations which may or may not exist:

  • /etc/fonts/fonts.conf
  • /etc/fonts/conf.d
  • $XDG_CONFIG_HOME/fontconfig/conf.d
  • $XDG_CONFIG_HOME/fontconfig/fonts.conf
  • ~/.fonts.conf.d
  • ~/.fonts.conf
  • A simple example of a configuration file:

    Utilities

    Fontconfig ships with eight command line utilities to manage and query fonts and the font configuration of the system:

  • fc-list: Lists all fonts fontconfig knows about or all fonts matching a pattern.
  • fc-match: Matches font-pattern (empty pattern by default) using the normal fontconfig matching rules to find the most appropriate font available.
  • fc-cache: Creates a cache of all FreeType readable fonts in a specified directory or create a cache of all FreeType readable fonts from all directories specified in Configuration files.
  • fc-cat: Reads the font information from cache files or related to font directories and emits it in ASCII form.
  • fc-query: Querys font files and reports resulting pattern(s).
  • fc-scan: Scans font files and directories and reports resulting pattern(s).
  • fc-pattern: Lists best font(s) matching the supplied pattern(s).
  • fc-validate: Validate font file(s) and reports the results.
  • References

    Fontconfig Wikipedia