Fontconfig

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Original author(s) Keith Packard
Stable release 2.10.2 / November 26, 2012; 6 months ago (2012-11-26)
Preview release 2.10.93 / May 20, 2013; 27 days ago (2013-05-20)
Operating system Unix-like systems
Type Font handling library
Website fontconfig.org

Fontconfig (or fontconfig) is a free software[1] 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.[2]

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

Contents

Usage[edit]

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[edit]

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:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <!-- Enable antialiasing for all fonts -->
    <match target="font">
        <edit mode="assign" name="antialias"><bool>true</bool></edit>
    </match>
</fontconfig>

Utilities[edit]

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 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-match: Matches font-pattern (empty pattern by default) using the normal fontconfig matching rules to find the most appropriate font available.

See also[edit]

References[edit]

  1. ^ "fontconfig-2.6.0.tar.gz (see file "COPYING")". "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 distribution of the software without specific, written prior permission..." 
  2. ^ http://lists.freedesktop.org/archives/fontconfig/2009-June/003177.html
  3. ^ http://behdad.org/text/
  4. ^ "GIMP - Fonts in GIMP". "Font configuration is handled by a small library called Fontconfig." 

External links[edit]