Fontconfig
Encyclopedia
Fontconfig is a computer program library
designed to provide system-wide font
configuration, customization, and application access. Fontconfig is written and was originally maintained by Keith Packard
. Its current maintainer is Behdad Esfahbod.
Fontconfig is free software
distributed under a permissive free software license.
Applications can use fontconfig in two ways:
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
.
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:
A simple example of a configuration file:
Fontconfig depends on FreeType
, a font renderer, and expat
, an XML parser library, both of which are free software.
Fontconfig is commonly used under GNU
and Unix-like
systems for querying and listing installed fonts and their properties. It is used by toolkits like GTK+
and Qt
, document preparation systems like XeTeX
(which also uses it under MS Windows), font managers like Fontmatrix
, and other applications like Mozilla Firefox
.
Library (computer science)
In computer science, a library is a collection of resources used to develop software. These may include pre-written code and subroutines, classes, values or type specifications....
designed to provide system-wide font
Computer font
A computer font is an electronic data file containing a set of glyphs, characters, or symbols such as dingbats. Although the term font first referred to a set of metal type sorts in one style and size, since the 1990s it is generally used to refer to a scalable set of digital shapes that may be...
configuration, customization, and application access. Fontconfig is written and was originally maintained by Keith Packard
Keith Packard
Keith Packard is a software developer, best known for his work on the X Window System.Packard is responsible for many X extensions and technical papers on X...
. Its current maintainer is Behdad Esfahbod.
Fontconfig is free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
distributed under a permissive free software license.
Applications can use fontconfig in two ways:
- by querying it for the available fonts on the system, or
- by asking it for a font matching certain parameters (pattern). Fontconfig will then return a font whose properties match those specified in the 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
Dots per inch
Dots per inch is a measure of spatial printing or video dot density, in particular the number of individual dots that can be placed in a line within the span of 1 inch . The DPI value tends to correlate with image resolution, but is related only indirectly.- DPI measurement in monitor...
, and Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...
coverage. This information is also used to perform font substitution
Font substitution
Font substitution is the process of using one font in place of another when the intended font either is not available or does not contain glyphs for the required characters.Font substitution can be aided by:...
.
Files
Fontconfig uses XMLXML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
format for its configuration files. The Document Type Definition
Document Type Definition
Document Type Definition is a set of markup declarations that define a document type for SGML-family markup languages...
(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/local.conf
- /etc/fonts/conf.d directory
- ~/.fonts.conf
A simple example of a configuration file:
Utilities
Fontconfig ships with four command line utilities to manage the font configuration:- fc-list: Lists all fonts fontconfig knows about or all fonts matching a pattern.
- fc-cache: Creates a cacheCacheIn computer engineering, a cache is a component that transparently stores data so that future requests for that data can be served faster. The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere...
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 ASCIIASCIIThe American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...
form. - fc-match: Matches font-pattern (empty pattern by default) using the normal fontconfig matching rules to find the most appropriate font available.
Fontconfig depends on FreeType
FreeType
FreeType is a software library written in C that implements a font rasterization engine. It is used to render text on to bitmaps and provides support for other font-related operations.-Details:...
, a font renderer, and expat
Expat (XML)
In computing, Expat is a stream-oriented XML 1.0 parser library, written in C. As one of the first available open-source XML parsers, Expat has found a place in many open-source projects. Such projects include the Apache HTTP Server, Mozilla, Perl, Python and PHP...
, an XML parser library, both of which are free software.
Fontconfig is commonly used under GNU
GNU
GNU is a Unix-like computer operating system developed by the GNU project, ultimately aiming to be a "complete Unix-compatible software system"...
and Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
systems for querying and listing installed fonts and their properties. It is used by toolkits like GTK+
GTK+
GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...
and Qt
Qt (toolkit)
Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface , and also used for developing non-GUI programs such as command-line tools and consoles for servers...
, document preparation systems like XeTeX
XeTeX
XeTeX is a TeX typesetting engine using Unicode and supporting modern font technologies such as OpenType or Apple Advanced Typography...
(which also uses it under MS Windows), font managers like Fontmatrix
Fontmatrix
Fontmatrix is a font manager for Linux desktops. It can manage fonts installed system-wide or for individual user accounts. It relies on FreeType to render font samples, and on Qt for its user interface...
, and other applications like Mozilla Firefox
Mozilla Firefox
Mozilla Firefox is a free and open source web browser descended from the Mozilla Application Suite and managed by Mozilla Corporation. , Firefox is the second most widely used browser, with approximately 25% of worldwide usage share of web browsers...
.