Fontconfig

Free software library to provide configuration, enumeration and substitution of fonts


title: "Fontconfig" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["free-software-programmed-in-c", "freedesktop.org-libraries", "unix-software", "software-using-the-mit-license"] description: "Free software library to provide configuration, enumeration and substitution of fonts" topic_path: "technology/operating-systems" source: "https://en.wikipedia.org/wiki/Fontconfig" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Free software library to provide configuration, enumeration and substitution of fonts ::

::data[format=table title="Infobox software"]

FieldValue
nameFontconfig
logo
screenshot
authorKeith Packard
released
latest release version
latest release date
latest preview version
latest preview date
programming languageC
operating systemUnix-like systems
language count
genreFont handling library
licenseMIT
website
::

| name = Fontconfig | title = | logo = | logo caption = | screenshot = | caption = | collapsible = | author = Keith Packard | developer = | released = | discontinued = | latest release version = | latest release date = | latest preview version = | latest preview date = | programming language = C | operating system = Unix-like systems | platform = | size = | language = | language count = | language footnote = | genre = Font handling library | license = MIT | alexa = | website = Fontconfig is a free software{{cite web | url = http://fontconfig.org/release/fontconfig-2.6.0.tar.gz | title = fontconfig-2.6.0.tar.gz (see file "COPYING") | quote = Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Keith Packard not be used in advertising or publicity pertaining to distrkeithp.comibution of the software without specific, written prior permission... | url = http://lists.freedesktop.org/archives/fontconfig/2009-June/003177.html | title = [Fontconfig] Fontconfig 2.7.0 released | work = freedesktop.org| date = 24 June 2009

Fontconfig is typically used on graphical Linux (and other Unix-like) desktops, such as Xorg and Wayland, 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.{{cite web | url = https://www.gimp.org/unix/fonts.html | title = GIMP - Fonts in GIMP | quote = Font configuration is handled by a small library called Fontconfig.}}

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, dots per inch (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: ::code[lang=xml]

true ::

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 the 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

References

  1. "About Fontconfig".
  2. "Documentation for XFree86[tm] version 4.0.2".
  3. "COPYING · master · fontconfig / Fontconfig".
  4. "State of Text Rendering". behdad.org.

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

free-software-programmed-in-cfreedesktop.org-librariesunix-softwaresoftware-using-the-mit-license