12c393a42Smrg<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
22c393a42Smrg<!ENTITY version SYSTEM "version.sgml">
32c393a42Smrg<!ENTITY confdir SYSTEM "confdir.sgml">
42c393a42Smrg]>
52c393a42Smrg<!--
62c393a42Smrg    Copyright © 2003 Keith Packard
7ae02b298Smrg
82c393a42Smrg    Permission to use, copy, modify, distribute, and sell this software and its
92c393a42Smrg    documentation for any purpose is hereby granted without fee, provided that
102c393a42Smrg    the above copyright notice appear in all copies and that both that
112c393a42Smrg    copyright notice and this permission notice appear in supporting
12ca08ab68Smrg    documentation, and that the name of the author(s) not be used in
132c393a42Smrg    advertising or publicity pertaining to distribution of the software without
14ca08ab68Smrg    specific, written prior permission.  The authors make no
152c393a42Smrg    representations about the suitability of this software for any purpose.  It
162c393a42Smrg    is provided "as is" without express or implied warranty.
17ae02b298Smrg
18a6844aabSmrg    THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
192c393a42Smrg    INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
20a6844aabSmrg    EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
212c393a42Smrg    CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
222c393a42Smrg    DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
232c393a42Smrg    TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
242c393a42Smrg    PERFORMANCE OF THIS SOFTWARE.
252c393a42Smrg-->
262c393a42Smrg<refentry>
272c393a42Smrg<refmeta>
282c393a42Smrg  <refentrytitle>fonts-conf</refentrytitle>
292c393a42Smrg  <manvolnum>5</manvolnum>
302c393a42Smrg</refmeta>
312c393a42Smrg<refnamediv>
32ae02b298Smrg        <refname>fonts.conf</refname>
33ae02b298Smrg        <refpurpose>Font configuration files</refpurpose>
342c393a42Smrg</refnamediv>
352c393a42Smrg<refsynopsisdiv>
362c393a42Smrg<synopsis>
372c393a42Smrg   &confdir;/fonts.conf
382c393a42Smrg   &confdir;/fonts.dtd
392c393a42Smrg   &confdir;/conf.d
40ca08ab68Smrg   $XDG_CONFIG_HOME/fontconfig/conf.d
41ca08ab68Smrg   $XDG_CONFIG_HOME/fontconfig/fonts.conf
42a6844aabSmrg   ~/.fonts.conf.d
432c393a42Smrg   ~/.fonts.conf
442c393a42Smrg</synopsis>
452c393a42Smrg</refsynopsisdiv>
462c393a42Smrg<refsect1><title>Description</title>
472c393a42Smrg  <para>
482c393a42SmrgFontconfig is a library designed to provide system-wide font configuration,
492c393a42Smrgcustomization and application access.
502c393a42Smrg  </para>
512c393a42Smrg</refsect1>
522c393a42Smrg<refsect1><title>Functional Overview</title>
532c393a42Smrg  <para>
542c393a42SmrgFontconfig contains two essential modules, the configuration module which
552c393a42Smrgbuilds an internal configuration from XML files and the matching module
562c393a42Smrgwhich accepts font patterns and returns the nearest matching font.
572c393a42Smrg  </para>
582c393a42Smrg  <refsect2><title>Font Configuration</title>
592c393a42Smrg    <para>
602c393a42SmrgThe configuration module consists of the FcConfig datatype, libexpat and
612c393a42SmrgFcConfigParse which walks over an XML tree and amends a configuration with
622c393a42Smrgdata found within.  From an external perspective, configuration of the
632c393a42Smrglibrary consists of generating a valid XML tree and feeding that to
642c393a42SmrgFcConfigParse.  The only other mechanism provided to applications for
652c393a42Smrgchanging the running configuration is to add fonts and directories to the
66ae02b298Smrglist of application-provided font files.
672c393a42Smrg    </para><para>
682c393a42SmrgThe intent is to make font configurations relatively static, and shared by
692c393a42Smrgas many applications as possible.  It is hoped that this will lead to more
702c393a42Smrgstable font selection when passing names from one application to another.
712c393a42SmrgXML was chosen as a configuration file format because it provides a format
722c393a42Smrgwhich is easy for external agents to edit while retaining the correct
732c393a42Smrgstructure and syntax.
742c393a42Smrg    </para><para>
752c393a42SmrgFont configuration is separate from font matching; applications needing to
762c393a42Smrgdo their own matching can access the available fonts from the library and
772c393a42Smrgperform private matching.  The intent is to permit applications to pick and
782c393a42Smrgchoose appropriate functionality from the library instead of forcing them to
792c393a42Smrgchoose between this library and a private configuration mechanism.  The hope
802c393a42Smrgis that this will ensure that configuration of fonts for all applications
812c393a42Smrgcan be centralized in one place.  Centralizing font configuration will
822c393a42Smrgsimplify and regularize font installation and customization.
832c393a42Smrg    </para>
842c393a42Smrg  </refsect2>
852c393a42Smrg  <refsect2>
862c393a42Smrg    <title>Font Properties</title>
872c393a42Smrg    <para>
882c393a42SmrgWhile font patterns may contain essentially any properties, there are some
892c393a42Smrgwell known properties with associated types.  Fontconfig uses some of these
902c393a42Smrgproperties for font matching and font completion.  Others are provided as a
912c393a42Smrgconvenience for the applications' rendering mechanism.
922c393a42Smrg    </para>
932c393a42Smrg    <programlisting>
94ae02b298SmrgProperty        Type    Description
95ae02b298Smrg--------------------------------------------------------------
96ae02b298Smrgfamily          String  Font family names
97ae02b298Smrgfamilylang      String  Languages corresponding to each family
98ae02b298Smrgstyle           String  Font style. Overrides weight and slant
99ae02b298Smrgstylelang       String  Languages corresponding to each style
100ae02b298Smrgfullname        String  Font full names (often includes style)
101ae02b298Smrgfullnamelang    String  Languages corresponding to each fullname
102ae02b298Smrgslant           Int     Italic, oblique or roman
103ae02b298Smrgweight          Int     Light, medium, demibold, bold or black
104ae02b298Smrgsize            Double  Point size
105ae02b298Smrgwidth           Int     Condensed, normal or expanded
106ae02b298Smrgaspect          Double  Stretches glyphs horizontally before hinting
107ae02b298Smrgpixelsize       Double  Pixel size
108ae02b298Smrgspacing         Int     Proportional, dual-width, monospace or charcell
109ae02b298Smrgfoundry         String  Font foundry name
110ae02b298Smrgantialias       Bool    Whether glyphs can be antialiased
111ae02b298Smrghinting         Bool    Whether the rasterizer should use hinting
112ae02b298Smrghintstyle       Int     Automatic hinting style
113ae02b298Smrgverticallayout  Bool    Use vertical layout
114ae02b298Smrgautohint        Bool    Use autohinter instead of normal hinter
115ae02b298Smrgglobaladvance   Bool    Use font global advance data (deprecated)
116ae02b298Smrgfile            String  The filename holding the font
117ae02b298Smrgindex           Int     The index of the font within the file
118ae02b298Smrgftface          FT_Face Use the specified FreeType face object
119ae02b298Smrgrasterizer      String  Which rasterizer is in use (deprecated)
120ae02b298Smrgoutline         Bool    Whether the glyphs are outlines
121ae02b298Smrgscalable        Bool    Whether glyphs can be scaled
122ae02b298Smrgcolor           Bool    Whether any glyphs have color
123ae02b298Smrgscale           Double  Scale factor for point->pixel conversions
124ae02b298Smrg                        (deprecated)
125ae02b298Smrgdpi             Double  Target dots per inch
126ae02b298Smrgrgba            Int     unknown, rgb, bgr, vrgb, vbgr,
127ae02b298Smrg                        none - subpixel geometry
128ae02b298Smrglcdfilter       Int     Type of LCD filter
129ae02b298Smrgminspace        Bool    Eliminate leading from line spacing
130ae02b298Smrgcharset         CharSet Unicode chars encoded by the font
131ae02b298Smrglang            String  List of RFC-3066-style languages this
132ae02b298Smrg                        font supports
133ae02b298Smrgfontversion     Int     Version number of the font
134ae02b298Smrgcapability      String  List of layout capabilities in the font
135ae02b298Smrgfontformat      String  String name of the font format
136ae02b298Smrgembolden        Bool    Rasterizer should synthetically embolden the font
137ae02b298Smrgembeddedbitmap  Bool    Use the embedded bitmap instead of the outline
138ae02b298Smrgdecorative      Bool    Whether the style is a decorative variant
139ae02b298Smrgfontfeatures    String  List of the feature tags in OpenType to be enabled
140ae02b298Smrgnamelang        String  Language name to be used for the default value of
141ae02b298Smrg                        familylang, stylelang, and fullnamelang
142ae02b298Smrgprgname         String  String  Name of the running program
143ae02b298Smrgpostscriptname  String  Font family name in PostScript
144ae02b298Smrgfonthashint     Bool    Whether the font has hinting
145ae02b298Smrgorder           Int     Order number of the font
1462c393a42Smrg    </programlisting>
1472c393a42Smrg  </refsect2>
1482c393a42Smrg  <refsect2>
1492c393a42Smrg  <title>Font Matching</title>
1502c393a42Smrg    <para>
1512c393a42SmrgFontconfig performs matching by measuring the distance from a provided
1522c393a42Smrgpattern to all of the available fonts in the system.  The closest matching
1532c393a42Smrgfont is selected.  This ensures that a font will always be returned, but
1542c393a42Smrgdoesn't ensure that it is anything like the requested pattern.
155ae02b298Smrg    </para><para>
1562c393a42SmrgFont matching starts with an application constructed pattern.  The desired
1572c393a42Smrgattributes of the resulting font are collected together in a pattern.  Each
1582c393a42Smrgproperty of the pattern can contain one or more values; these are listed in
1592c393a42Smrgpriority order; matches earlier in the list are considered "closer" than
1602c393a42Smrgmatches later in the list.
1612c393a42Smrg    </para><para>
1622c393a42SmrgThe initial pattern is modified by applying the list of editing instructions
1632c393a42Smrgspecific to patterns found in the configuration; each consists of a match
1642c393a42Smrgpredicate and a set of editing operations.  They are executed in the order
1652c393a42Smrgthey appeared in the configuration.  Each match causes the associated
1662c393a42Smrgsequence of editing operations to be applied.
1672c393a42Smrg    </para><para>
1682c393a42SmrgAfter the pattern has been edited, a sequence of default substitutions are
1692c393a42Smrgperformed to canonicalize the set of available properties; this avoids the
1702c393a42Smrgneed for the lower layers to constantly provide default values for various
1712c393a42Smrgfont properties during rendering.
1722c393a42Smrg    </para><para>
1732c393a42SmrgThe canonical font pattern is finally matched against all available fonts.
1742c393a42SmrgThe distance from the pattern to the font is measured for each of several
1752c393a42Smrgproperties: foundry, charset, family, lang, spacing, pixelsize, style,
1762c393a42Smrgslant, weight, antialias, rasterizer and outline.  This list is in priority
1772c393a42Smrgorder -- results of comparing earlier elements of this list weigh more
1782c393a42Smrgheavily than later elements.
1792c393a42Smrg    </para><para>
1802c393a42SmrgThere is one special case to this rule; family names are split into two
1812c393a42Smrgbindings; strong and weak.  Strong family names are given greater precedence
1822c393a42Smrgin the match than lang elements while weak family names are given lower
1832c393a42Smrgprecedence than lang elements.  This permits the document language to drive
1842c393a42Smrgfont selection when any document specified font is unavailable.
1852c393a42Smrg    </para><para>
1862c393a42SmrgThe pattern representing that font is augmented to include any properties
1872c393a42Smrgfound in the pattern but not found in the font itself; this permits the
1882c393a42Smrgapplication to pass rendering instructions or any other data through the
1892c393a42Smrgmatching system.  Finally, the list of editing instructions specific to
1902c393a42Smrgfonts found in the configuration are applied to the pattern.  This modified
1912c393a42Smrgpattern is returned to the application.
1922c393a42Smrg    </para><para>
1932c393a42SmrgThe return value contains sufficient information to locate and rasterize the
1942c393a42Smrgfont, including the file name, pixel size and other rendering data.  As
1952c393a42Smrgnone of the information involved pertains to the FreeType library,
1962c393a42Smrgapplications are free to use any rasterization engine or even to take
1972c393a42Smrgthe identified font file and access it directly.
1982c393a42Smrg    </para><para>
1992c393a42SmrgThe match/edit sequences in the configuration are performed in two passes
2002c393a42Smrgbecause there are essentially two different operations necessary -- the
2012c393a42Smrgfirst is to modify how fonts are selected; aliasing families and adding
2022c393a42Smrgsuitable defaults.  The second is to modify how the selected fonts are
2032c393a42Smrgrasterized.  Those must apply to the selected font, not the original pattern
2042c393a42Smrgas false matches will often occur.
2052c393a42Smrg    </para>
2062c393a42Smrg  </refsect2>
2072c393a42Smrg  <refsect2><title>Font Names</title>
2082c393a42Smrg    <para>
2092c393a42SmrgFontconfig provides a textual representation for patterns that the library
2102c393a42Smrgcan both accept and generate.  The representation is in three parts, first a
2112c393a42Smrglist of family names, second a list of point sizes and finally a list of
2122c393a42Smrgadditional properties:
2132c393a42Smrg    </para>
2142c393a42Smrg    <programlisting>
215ae02b298Smrg&lt;families&gt;-&lt;point sizes&gt;:&lt;name1&gt;=&lt;values1&gt;:&lt;name2&gt;=&lt;values2&gt;...
2162c393a42Smrg    </programlisting>
2172c393a42Smrg    <para>
2182c393a42SmrgValues in a list are separated with commas.  The name needn't include either
2192c393a42Smrgfamilies or point sizes; they can be elided.  In addition, there are
2202c393a42Smrgsymbolic constants that simultaneously indicate both a name and a value.
2212c393a42SmrgHere are some examples:
2222c393a42Smrg    </para>
2232c393a42Smrg    <programlisting>
224ae02b298SmrgName                            Meaning
225ae02b298Smrg----------------------------------------------------------
226ae02b298SmrgTimes-12                        12 point Times Roman
227ae02b298SmrgTimes-12:bold                   12 point Times Bold
228ae02b298SmrgCourier:italic                  Courier Italic in the default size
229ae02b298SmrgMonospace:matrix=1 .1 0 1       The users preferred monospace font
230ae02b298Smrg                                with artificial obliquing
2312c393a42Smrg    </programlisting>
2322c393a42Smrg    <para>
233ca08ab68SmrgThe '\', '-', ':' and ',' characters in family names must be preceded by a
2342c393a42Smrg'\' character to avoid having them misinterpreted. Similarly, values
235ca08ab68Smrgcontaining '\', '=', '_', ':' and ',' must also have them preceded by a
2362c393a42Smrg'\' character. The '\' characters are stripped out of the family name and
2372c393a42Smrgvalues as the font name is read.
2382c393a42Smrg    </para>
2392c393a42Smrg  </refsect2>
2402c393a42Smrg</refsect1>
241ca08ab68Smrg<refsect1 id="debug"><title>Debugging Applications</title>
2422c393a42Smrg  <para>
2432c393a42SmrgTo help diagnose font and applications problems, fontconfig is built with a
2442c393a42Smrglarge amount of internal debugging left enabled. It is controlled by means
2452c393a42Smrgof the FC_DEBUG environment variable. The value of this variable is
2462c393a42Smrginterpreted as a number, and each bit within that value controls different
2472c393a42Smrgdebugging messages.
2482c393a42Smrg  </para>
2492c393a42Smrg  <programlisting>
250ae02b298SmrgName         Value    Meaning
251ae02b298Smrg---------------------------------------------------------
252ae02b298SmrgMATCH            1    Brief information about font matching
253ae02b298SmrgMATCHV           2    Extensive font matching information
254ae02b298SmrgEDIT             4    Monitor match/test/edit execution
255ae02b298SmrgFONTSET          8    Track loading of font information at startup
256ae02b298SmrgCACHE           16    Watch cache files being written
257ae02b298SmrgCACHEV          32    Extensive cache file writing information
258ae02b298SmrgPARSE           64    (no longer in use)
259ae02b298SmrgSCAN           128    Watch font files being scanned to build caches
260ae02b298SmrgSCANV          256    Verbose font file scanning information
261ae02b298SmrgMEMORY         512    Monitor fontconfig memory usage
262ae02b298SmrgCONFIG        1024    Monitor which config files are loaded
263ae02b298SmrgLANGSET       2048    Dump char sets used to construct lang values
264ae02b298SmrgMATCH2        4096    Display font-matching transformation in patterns
2652c393a42Smrg  </programlisting>
2662c393a42Smrg  <para>
2672c393a42SmrgAdd the value of the desired debug levels together and assign that (in
2682c393a42Smrgbase 10) to the FC_DEBUG environment variable before running the
2692c393a42Smrgapplication. Output from these statements is sent to stdout.
2702c393a42Smrg  </para>
2712c393a42Smrg</refsect1>
2722c393a42Smrg<refsect1><title>Lang Tags</title>
2732c393a42Smrg  <para>
2742c393a42SmrgEach font in the database contains a list of languages it supports.  This is
2752c393a42Smrgcomputed by comparing the Unicode coverage of the font with the orthography
2762c393a42Smrgof each language.  Languages are tagged using an RFC-3066 compatible naming
2772c393a42Smrgand occur in two parts -- the ISO 639 language tag followed a hyphen and then
2782c393a42Smrgby the ISO 3166 country code.  The hyphen and country code may be elided.
2792c393a42Smrg  </para><para>
2802c393a42SmrgFontconfig has orthographies for several languages built into the library.
2812c393a42SmrgNo provision has been made for adding new ones aside from rebuilding the
2822c393a42Smrglibrary.  It currently supports 122 of the 139 languages named in ISO 639-1,
2832c393a42Smrg141 of the languages with two-letter codes from ISO 639-2 and another 30
2842c393a42Smrglanguages with only three-letter codes.  Languages with both two and three
2852c393a42Smrgletter codes are provided with only the two letter code.
2862c393a42Smrg  </para><para>
2872c393a42SmrgFor languages used in multiple territories with radically different
2882c393a42Smrgcharacter sets, fontconfig includes per-territory orthographies.  This
2892c393a42Smrgincludes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
2902c393a42Smrg  </para>
2912c393a42Smrg</refsect1>
2922c393a42Smrg<refsect1><title>Configuration File Format</title>
2932c393a42Smrg  <para>
2942c393a42SmrgConfiguration files for fontconfig are stored in XML format; this
2952c393a42Smrgformat makes external configuration tools easier to write and ensures that
2962c393a42Smrgthey will generate syntactically correct configuration files.  As XML
2972c393a42Smrgfiles are plain text, they can also be manipulated by the expert user using
2982c393a42Smrga text editor.
2992c393a42Smrg  </para><para>
3002c393a42SmrgThe fontconfig document type definition resides in the external entity
3012c393a42Smrg"fonts.dtd"; this is normally stored in the default font configuration
3022c393a42Smrgdirectory (&confdir;).  Each configuration file should contain the
3032c393a42Smrgfollowing structure:
3042c393a42Smrg    <programlisting>
305ae02b298Smrg&lt;?xml version="1.0"?&gt;
306ae02b298Smrg&lt;!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"&gt;
307ae02b298Smrg&lt;fontconfig&gt;
308ae02b298Smrg...
309ae02b298Smrg&lt;/fontconfig&gt;
3102c393a42Smrg    </programlisting>
3112c393a42Smrg  </para>
3122c393a42Smrg<refsect2><title><literal>&lt;fontconfig&gt;</literal></title><para>
3132c393a42SmrgThis is the top level element for a font configuration and can contain
314ca08ab68Smrg<literal>&lt;dir&gt;</literal>, <literal>&lt;cachedir&gt;</literal>, <literal>&lt;include&gt;</literal>, <literal>&lt;match&gt;</literal> and <literal>&lt;alias&gt;</literal> elements in any order.
3152c393a42Smrg  </para></refsect2>
316a4e54154Smrg  <refsect2><title><literal>&lt;dir prefix="default" salt=""&gt;</literal></title><para>
3172c393a42SmrgThis element contains a directory name which will be scanned for font files
318a4e54154Smrgto include in the set of available fonts.
319a4e54154Smrg  </para><para>
320a4e54154SmrgIf 'prefix' is set to "default" or "cwd", the current working directory will be added as the path prefix prior to the value. If 'prefix' is set to "xdg", the value in the XDG_DATA_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details. If 'prefix' is set to "relative", the path of current file will be added prior to the value.
321a4e54154Smrg  </para><para>
322a4e54154Smrg'salt' property affects to determine cache filename. this is useful for example when having different fonts sets on same path at container and share fonts from host on different font path.
3232c393a42Smrg  </para></refsect2>
324ca08ab68Smrg  <refsect2><title><literal>&lt;cachedir prefix="default"&gt;</literal></title><para>
325ca08ab68SmrgThis element contains a directory name that is supposed to be stored or read
326ca08ab68Smrgthe cache of font information.  If multiple elements are specified in
327ca08ab68Smrgthe configuration file, the directory that can be accessed first in the list
328ca08ab68Smrgwill be used to store the cache files.  If it starts with '~', it refers to
329ca08ab68Smrga directory in the users home directory.  If 'prefix' is set to "xdg", the value in the XDG_CACHE_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details.
330ca08ab68SmrgThe default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
331953daebaSmrgnamed ``<literal>&lt;hash value&gt;</literal>-<literal>&lt;architecture&gt;</literal>.cache-<literal>&lt;version&gt;</literal>'',
332953daebaSmrgwhere <literal>&lt;version&gt;</literal> is the fontconfig cache file
333ae02b298Smrgversion number (currently 8).
3342c393a42Smrg  </para></refsect2>
335ca08ab68Smrg  <refsect2><title><literal>&lt;include ignore_missing="no" prefix="default"&gt;</literal></title><para>
3362c393a42SmrgThis element contains the name of an additional configuration file or
3372c393a42Smrgdirectory.  If a directory, every file within that directory starting with an
3382c393a42SmrgASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be processed in sorted order.  When
3392c393a42Smrgthe XML datatype is traversed by FcConfigParse, the contents of the file(s)
3402c393a42Smrgwill also be incorporated into the configuration by passing the filename(s) to
3412c393a42SmrgFcConfigLoadAndParse.  If 'ignore_missing' is set to "yes" instead of the
3422c393a42Smrgdefault "no", a missing file or directory will elicit no warning message from
343ca08ab68Smrgthe library.  If 'prefix' is set to "xdg", the value in the XDG_CONFIG_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details.
3442c393a42Smrg  </para></refsect2>
3452c393a42Smrg  <refsect2><title><literal>&lt;config&gt;</literal></title><para>
3462c393a42SmrgThis element provides a place to consolidate additional configuration
3472c393a42Smrginformation.  <literal>&lt;config&gt;</literal> can contain <literal>&lt;blank&gt;</literal> and <literal>&lt;rescan&gt;</literal> elements in any
3482c393a42Smrgorder.
349a4e54154Smrg  </para></refsect2>
350a4e54154Smrg  <refsect2><title><literal>&lt;description domain="fontconfig-conf"&gt;</literal></title><para>
351a4e54154SmrgThis element is supposed to hold strings which describe what a config is used for.
352a4e54154SmrgThis string can be translated through gettext. 'domain' needs to be set the proper name to apply then.
353a4e54154Smrgfontconfig will tries to retrieve translations with 'domain' from gettext.
3542c393a42Smrg  </para></refsect2>
3552c393a42Smrg  <refsect2><title><literal>&lt;blank&gt;</literal></title><para>
3562c393a42SmrgFonts often include "broken" glyphs which appear in the encoding but are
3572c393a42Smrgdrawn as blanks on the screen.  Within the <literal>&lt;blank&gt;</literal> element, place each
3582c393a42SmrgUnicode characters which is supposed to be blank in an <literal>&lt;int&gt;</literal> element.
3592c393a42SmrgCharacters outside of this set which are drawn as blank will be elided from
3602c393a42Smrgthe set of characters supported by the font.
361a4e54154Smrg  </para></refsect2>
362a4e54154Smrg  <refsect2><title><literal>&lt;remap-dir prefix="default" as-path="" salt=""&gt;</literal></title><para>
363a4e54154SmrgThis element contains a directory name where will be mapped
364a4e54154Smrgas the path 'as-path' in cached information.
365a4e54154SmrgThis is useful if the directory name is an alias
366a4e54154Smrg(via a bind mount or symlink) to another directory in the system for
367a4e54154Smrgwhich cached font information is likely to exist.
368a4e54154Smrg  </para><para>
369a4e54154Smrg'salt' property affects to determine cache filename as same as <literal>&lt;dir&gt;</literal> element.
370a4e54154Smrg  </para></refsect2>
371a4e54154Smrg  <refsect2><title><literal>&lt;reset-dirs /&gt;</literal></title><para>
372a4e54154SmrgThis element removes all of fonts directories where added by <literal>&lt;dir&gt;</literal> elements.
373a4e54154SmrgThis is useful to override fonts directories from system to own fonts directories only.
3742c393a42Smrg  </para></refsect2>
3752c393a42Smrg  <refsect2><title><literal>&lt;rescan&gt;</literal></title><para>
3762c393a42SmrgThe <literal>&lt;rescan&gt;</literal> element holds an <literal>&lt;int&gt;</literal> element which indicates the default
3772c393a42Smrginterval between automatic checks for font configuration changes.
3782c393a42SmrgFontconfig will validate all of the configuration files and directories and
3792c393a42Smrgautomatically rebuild the internal datastructures when this interval passes.
3802c393a42Smrg  </para></refsect2>
3812c393a42Smrg  <refsect2><title><literal>&lt;selectfont&gt;</literal></title><para>
3822c393a42SmrgThis element is used to black/white list fonts from being listed or matched
3832c393a42Smrgagainst.  It holds acceptfont and rejectfont elements.
3842c393a42Smrg  </para></refsect2>
3852c393a42Smrg  <refsect2><title><literal>&lt;acceptfont&gt;</literal></title><para>
3862c393a42SmrgFonts matched by an acceptfont element are "whitelisted"; such fonts are
3872c393a42Smrgexplicitly included in the set of fonts used to resolve list and match
3882c393a42Smrgrequests; including them in this list protects them from being "blacklisted"
3892c393a42Smrgby a rejectfont element.  Acceptfont elements include glob and pattern
3902c393a42Smrgelements which are used to match fonts.
3912c393a42Smrg  </para></refsect2>
3922c393a42Smrg  <refsect2><title><literal>&lt;rejectfont&gt;</literal></title><para>
3932c393a42SmrgFonts matched by an rejectfont element are "blacklisted"; such fonts are
3942c393a42Smrgexcluded from the set of fonts used to resolve list and match requests as if
3952c393a42Smrgthey didn't exist in the system.  Rejectfont elements include glob and
3962c393a42Smrgpattern elements which are used to match fonts.
3972c393a42Smrg  </para></refsect2>
3982c393a42Smrg  <refsect2><title><literal>&lt;glob&gt;</literal></title><para>
3992c393a42SmrgGlob elements hold shell-style filename matching patterns (including ? and
400ae02b298Smrg*) which match fonts based on their complete pathnames. If it starts with '~',
401ae02b298Smrgit refers to a directory in the users home directory.  This can be used to
4022c393a42Smrgexclude a set of directories (/usr/share/fonts/uglyfont*), or particular
4032c393a42Smrgfont file types (*.pcf.gz), but the latter mechanism relies rather heavily
4042c393a42Smrgon filenaming conventions which can't be relied upon.  Note that globs
4052c393a42Smrgonly apply to directories, not to individual fonts.
4062c393a42Smrg  </para></refsect2>
4072c393a42Smrg  <refsect2><title><literal>&lt;pattern&gt;</literal></title><para>
4082c393a42SmrgPattern elements perform list-style matching on incoming fonts; that is,
4092c393a42Smrgthey hold a list of elements and associated values.  If all of those
4102c393a42Smrgelements have a matching value, then the pattern matches the font.  This can
4112c393a42Smrgbe used to select fonts based on attributes of the font (scalable, bold,
4122c393a42Smrgetc), which is a more reliable mechanism than using file extensions.
4132c393a42SmrgPattern elements include patelt elements.
4142c393a42Smrg  </para></refsect2>
4152c393a42Smrg  <refsect2><title><literal>&lt;patelt name="property"&gt;</literal></title><para>
4162c393a42SmrgPatelt elements hold a single pattern element and list of values.  They must
4172c393a42Smrghave a 'name' attribute which indicates the pattern element name.  Patelt
4182c393a42Smrgelements include int, double, string, matrix, bool, charset and const
4192c393a42Smrgelements.
4202c393a42Smrg  </para></refsect2>
4212c393a42Smrg  <refsect2><title><literal>&lt;match target="pattern"&gt;</literal></title><para>
4222c393a42SmrgThis element holds first a (possibly empty) list of <literal>&lt;test&gt;</literal> elements and then
4232c393a42Smrga (possibly empty) list of <literal>&lt;edit&gt;</literal> elements.  Patterns which match all of the
4242c393a42Smrgtests are subjected to all the edits.  If 'target' is set to "font" instead
4252c393a42Smrgof the default "pattern", then this element applies to the font name
4262c393a42Smrgresulting from a match rather than a font pattern to be matched. If 'target'
4272c393a42Smrgis set to "scan", then this element applies when the font is scanned to
4282c393a42Smrgbuild the fontconfig database.
4292c393a42Smrg  </para></refsect2>
4302c393a42Smrg  <refsect2><title><literal>&lt;test qual="any" name="property" target="default" compare="eq"&gt;</literal></title><para>
4312c393a42SmrgThis element contains a single value which is compared with the target
432ae02b298Smrg('pattern', 'font', 'scan' or 'default') property "property" (substitute any of the property names seen
433ca08ab68Smrgabove). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", "more_eq", "contains" or
434ca08ab68Smrg"not_contains".  'qual' may either be the default, "any", in which case the match
4352c393a42Smrgsucceeds if any value associated with the property matches the test value, or
4362c393a42Smrg"all", in which case all of the values associated with the property must
437ca08ab68Smrgmatch the test value.  'ignore-blanks' takes a boolean value. if 'ignore-blanks' is set "true", any blanks in the string will be ignored on its comparison. this takes effects only when compare="eq" or compare="not_eq".
438ca08ab68SmrgWhen used in a &lt;match target="font"&gt; element,
4392c393a42Smrgthe target= attribute in the &lt;test&gt; element selects between matching
4402c393a42Smrgthe original pattern or the font.  "default" selects whichever target the
4412c393a42Smrgouter &lt;match&gt; element has selected.
4422c393a42Smrg  </para></refsect2>
4432c393a42Smrg  <refsect2><title><literal>&lt;edit name="property" mode="assign" binding="weak"&gt;</literal></title><para>
4442c393a42SmrgThis element contains a list of expression elements (any of the value or
4452c393a42Smrgoperator elements).  The expression elements are evaluated at run-time and
4462c393a42Smrgmodify the property "property".  The modification depends on whether
4472c393a42Smrg"property" was matched by one of the associated <literal>&lt;test&gt;</literal> elements, if so, the
4482c393a42Smrgmodification may affect the first matched value.  Any values inserted into
4492c393a42Smrgthe property are given the indicated binding ("strong", "weak" or "same")
4502c393a42Smrgwith "same" binding using the value from the matched pattern element.
4512c393a42Smrg'mode' is one of:
4522c393a42Smrg    <programlisting>
453ae02b298SmrgMode                    With Match              Without Match
454ae02b298Smrg---------------------------------------------------------------------
455ae02b298Smrg"assign"                Replace matching value  Replace all values
456ae02b298Smrg"assign_replace"        Replace all values      Replace all values
457ae02b298Smrg"prepend"               Insert before matching  Insert at head of list
458ae02b298Smrg"prepend_first"         Insert at head of list  Insert at head of list
459ae02b298Smrg"append"                Append after matching   Append at end of list
460ae02b298Smrg"append_last"           Append at end of list   Append at end of list
461ae02b298Smrg"delete"                Delete matching value   Delete all values
462ae02b298Smrg"delete_all"            Delete all values       Delete all values
4632c393a42Smrg    </programlisting>
4642c393a42Smrg  </para></refsect2>
4652c393a42Smrg  <refsect2><title><literal>&lt;int&gt;</literal>, <literal>&lt;double&gt;</literal>, <literal>&lt;string&gt;</literal>, <literal>&lt;bool&gt;</literal></title><para>
4662c393a42SmrgThese elements hold a single value of the indicated type.  <literal>&lt;bool&gt;</literal>
4672c393a42Smrgelements hold either true or false.  An important limitation exists in
4682c393a42Smrgthe parsing of floating point numbers -- fontconfig requires that
4692c393a42Smrgthe mantissa start with a digit, not a decimal point, so insert a leading
4702c393a42Smrgzero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5
4712c393a42Smrginstead of -.5).
4722c393a42Smrg  </para></refsect2>
4732c393a42Smrg  <refsect2><title><literal>&lt;matrix&gt;</literal></title><para>
474c9710b42SmrgThis element holds four numerical expressions of an affine transformation.
475c9710b42SmrgAt their simplest these will be four <literal>&lt;double&gt;</literal> elements
476c9710b42Smrgbut they can also be more involved expressions.
477ca08ab68Smrg  </para></refsect2>
478ca08ab68Smrg  <refsect2><title><literal>&lt;range&gt;</literal></title><para>
479ca08ab68SmrgThis element holds the two <literal>&lt;int&gt;</literal> elements of a range
480ca08ab68Smrgrepresentation.
481ca08ab68Smrg  </para></refsect2>
482ca08ab68Smrg  <refsect2><title><literal>&lt;charset&gt;</literal></title><para>
483ca08ab68SmrgThis element holds at least one <literal>&lt;int&gt;</literal> element of
484ca08ab68Smrgan Unicode code point or more.
485ca08ab68Smrg  </para></refsect2>
486ca08ab68Smrg  <refsect2><title><literal>&lt;langset&gt;</literal></title><para>
487ca08ab68SmrgThis element holds at least one <literal>&lt;string&gt;</literal> element of
488ca08ab68Smrga RFC-3066-style languages or more.
4892c393a42Smrg  </para></refsect2>
4902c393a42Smrg  <refsect2><title><literal>&lt;name&gt;</literal></title><para>
4912c393a42SmrgHolds a property name.  Evaluates to the first value from the property of
492c9710b42Smrgthe pattern.  If the 'target' attribute is not present, it will default to
493c9710b42Smrg'default', in which case the property is returned from the font pattern
494c9710b42Smrgduring a target="font" match, and to the pattern during a target="pattern"
495c9710b42Smrgmatch.  The attribute can also take the values 'font' or 'pattern' to
496c9710b42Smrgexplicitly choose which pattern to use.  It is an error to use a target
497c9710b42Smrgof 'font' in a match that has target="pattern".
4982c393a42Smrg  </para></refsect2>
4992c393a42Smrg  <refsect2><title><literal>&lt;const&gt;</literal></title><para>
5002c393a42SmrgHolds the name of a constant; these are always integers and serve as
5012c393a42Smrgsymbolic names for common font values:
5022c393a42Smrg    <programlisting>
503ae02b298SmrgConstant        Property        Value
504ae02b298Smrg-------------------------------------
505ae02b298Smrgthin            weight          0
506ae02b298Smrgextralight      weight          40
507ae02b298Smrgultralight      weight          40
508ae02b298Smrglight           weight          50
509ae02b298Smrgdemilight       weight          55
510ae02b298Smrgsemilight       weight          55
511ae02b298Smrgbook            weight          75
512ae02b298Smrgregular         weight          80
513ae02b298Smrgnormal          weight          80
514ae02b298Smrgmedium          weight          100
515ae02b298Smrgdemibold        weight          180
516ae02b298Smrgsemibold        weight          180
517ae02b298Smrgbold            weight          200
518ae02b298Smrgextrabold       weight          205
519ae02b298Smrgultrabold       weight          205
520ae02b298Smrgblack           weight          210
521ae02b298Smrgheavy           weight          210
522ae02b298Smrgextrablack      weight          215
523ae02b298Smrgultrablack      weight          215
524ae02b298Smrgroman           slant           0
525ae02b298Smrgitalic          slant           100
526ae02b298Smrgoblique         slant           110
527ae02b298Smrgultracondensed  width           50
528ae02b298Smrgextracondensed  width           63
529ae02b298Smrgcondensed       width           75
530ae02b298Smrgsemicondensed   width           87
531ae02b298Smrgnormal          width           100
532ae02b298Smrgsemiexpanded    width           113
533ae02b298Smrgexpanded        width           125
534ae02b298Smrgextraexpanded   width           150
535ae02b298Smrgultraexpanded   width           200
536ae02b298Smrgproportional    spacing         0
537ae02b298Smrgdual            spacing         90
538ae02b298Smrgmono            spacing         100
539ae02b298Smrgcharcell        spacing         110
540ae02b298Smrgunknown         rgba            0
541ae02b298Smrgrgb             rgba            1
542ae02b298Smrgbgr             rgba            2
543ae02b298Smrgvrgb            rgba            3
544ae02b298Smrgvbgr            rgba            4
545ae02b298Smrgnone            rgba            5
546ae02b298Smrglcdnone         lcdfilter       0
547ae02b298Smrglcddefault      lcdfilter       1
548ae02b298Smrglcdlight        lcdfilter       2
549ae02b298Smrglcdlegacy       lcdfilter       3
550ae02b298Smrghintnone        hintstyle       0
551ae02b298Smrghintslight      hintstyle       1
552ae02b298Smrghintmedium      hintstyle       2
553ae02b298Smrghintfull        hintstyle       3
5542c393a42Smrg    </programlisting>
5552c393a42Smrg      </para>
5562c393a42Smrg    </refsect2>
5572c393a42Smrg  <refsect2>
5582c393a42Smrg      <title><literal>&lt;or&gt;</literal>, <literal>&lt;and&gt;</literal>, <literal>&lt;plus&gt;</literal>, <literal>&lt;minus&gt;</literal>, <literal>&lt;times&gt;</literal>, <literal>&lt;divide&gt;</literal></title>
5592c393a42Smrg      <para>
5602c393a42SmrgThese elements perform the specified operation on a list of expression
5612c393a42Smrgelements.  <literal>&lt;or&gt;</literal> and <literal>&lt;and&gt;</literal> are boolean, not bitwise.
5622c393a42Smrg      </para>
5632c393a42Smrg    </refsect2>
5642c393a42Smrg  <refsect2>
565ca08ab68Smrg    <title><literal>&lt;eq&gt;</literal>, <literal>&lt;not_eq&gt;</literal>, <literal>&lt;less&gt;</literal>, <literal>&lt;less_eq&gt;</literal>, <literal>&lt;more&gt;</literal>, <literal>&lt;more_eq&gt;</literal>, <literal>&lt;contains&gt;</literal>, <literal>&lt;not_contains</literal></title>
5662c393a42Smrg    <para>
5672c393a42SmrgThese elements compare two values, producing a boolean result.
5682c393a42Smrg  </para></refsect2>
5692c393a42Smrg  <refsect2><title><literal>&lt;not&gt;</literal></title><para>
5702c393a42SmrgInverts the boolean sense of its one expression element
5712c393a42Smrg  </para></refsect2>
5722c393a42Smrg  <refsect2><title><literal>&lt;if&gt;</literal></title><para>
5732c393a42SmrgThis element takes three expression elements; if the value of the first is
5742c393a42Smrgtrue, it produces the value of the second, otherwise it produces the value
5752c393a42Smrgof the third.
5762c393a42Smrg  </para></refsect2>
5772c393a42Smrg  <refsect2><title><literal>&lt;alias&gt;</literal></title><para>
5782c393a42SmrgAlias elements provide a shorthand notation for the set of common match
5792c393a42Smrgoperations needed to substitute one font family for another.  They contain a
5802c393a42Smrg<literal>&lt;family&gt;</literal> element followed by optional <literal>&lt;prefer&gt;</literal>, <literal>&lt;accept&gt;</literal> and <literal>&lt;default&gt;</literal>
5812c393a42Smrgelements.  Fonts matching the <literal>&lt;family&gt;</literal> element are edited to prepend the
5822c393a42Smrglist of <literal>&lt;prefer&gt;</literal>ed families before the matching <literal>&lt;family&gt;</literal>, append the
5832c393a42Smrg<literal>&lt;accept&gt;</literal>able families after the matching <literal>&lt;family&gt;</literal> and append the <literal>&lt;default&gt;</literal>
5842c393a42Smrgfamilies to the end of the family list.
5852c393a42Smrg  </para></refsect2>
5862c393a42Smrg  <refsect2><title><literal>&lt;family&gt;</literal></title><para>
5872c393a42SmrgHolds a single font family name
5882c393a42Smrg  </para></refsect2>
5892c393a42Smrg  <refsect2><title><literal>&lt;prefer&gt;</literal>, <literal>&lt;accept&gt;</literal>, <literal>&lt;default&gt;</literal></title><para>
5902c393a42SmrgThese hold a list of <literal>&lt;family&gt;</literal> elements to be used by the <literal>&lt;alias&gt;</literal> element.
5912c393a42Smrg  </para></refsect2>
5922c393a42Smrg</refsect1>
5932c393a42Smrg<refsect1><title>EXAMPLE CONFIGURATION FILE</title>
5942c393a42Smrg  <refsect2><title>System configuration file</title>
5952c393a42Smrg    <para>
5962c393a42SmrgThis is an example of a system-wide configuration file
5972c393a42Smrg    </para>
5982c393a42Smrg    <programlisting>
5992c393a42Smrg&lt;?xml version="1.0"?&gt;
600a4e54154Smrg&lt;!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"&gt;
6012c393a42Smrg&lt;!-- &confdir;/fonts.conf file to configure system font access --&gt;
6022c393a42Smrg&lt;fontconfig&gt;
603ae02b298Smrg  &lt;!--
604ae02b298Smrg    Find fonts in these directories
605ae02b298Smrg  --&gt;
606ae02b298Smrg  &lt;dir&gt;/usr/share/fonts&lt;/dir&gt;
607ae02b298Smrg  &lt;dir&gt;/usr/X11R6/lib/X11/fonts&lt;/dir&gt;
6082c393a42Smrg
609ae02b298Smrg  &lt;!--
610ae02b298Smrg    Accept deprecated 'mono' alias, replacing it with 'monospace'
611ae02b298Smrg  --&gt;
612ae02b298Smrg  &lt;match target="pattern"&gt;
613ae02b298Smrg    &lt;test qual="any" name="family"&gt;
614ae02b298Smrg      &lt;string&gt;mono&lt;/string&gt;
615ae02b298Smrg    &lt;/test&gt;
616ae02b298Smrg    &lt;edit name="family" mode="assign"&gt;
617ae02b298Smrg      &lt;string&gt;monospace&lt;/string&gt;
618ae02b298Smrg    &lt;/edit&gt;
619ae02b298Smrg  &lt;/match&gt;
6202c393a42Smrg
621ae02b298Smrg  &lt;!--
622ae02b298Smrg    Names not including any well known alias are given 'sans-serif'
623ae02b298Smrg  --&gt;
624ae02b298Smrg  &lt;match target="pattern"&gt;
625ae02b298Smrg    &lt;test qual="all" name="family" compare="not_eq"&gt;
626ae02b298Smrg      &lt;string&gt;sans-serif&lt;/string&gt;
627ae02b298Smrg    &lt;/test&gt;
628ae02b298Smrg    &lt;test qual="all" name="family" compare="not_eq"&gt;
629ae02b298Smrg      &lt;string&gt;serif&lt;/string&gt;
630ae02b298Smrg    &lt;/test&gt;
631ae02b298Smrg    &lt;test qual="all" name="family" compare="not_eq"&gt;
632ae02b298Smrg      &lt;string&gt;monospace&lt;/string&gt;
633ae02b298Smrg    &lt;/test&gt;
634ae02b298Smrg    &lt;edit name="family" mode="append_last"&gt;
635ae02b298Smrg      &lt;string&gt;sans-serif&lt;/string&gt;
636ae02b298Smrg    &lt;/edit&gt;
637ae02b298Smrg  &lt;/match&gt;
6382c393a42Smrg
639ae02b298Smrg  &lt;!--
640ae02b298Smrg    Load per-user customization file, but don't complain
641ae02b298Smrg    if it doesn't exist
642ae02b298Smrg  --&gt;
643ae02b298Smrg  &lt;include ignore_missing="yes" prefix="xdg"&gt;
644ae02b298Smrg    fontconfig/fonts.conf
645ae02b298Smrg  &lt;/include&gt;
6462c393a42Smrg
647ae02b298Smrg  &lt;!--
648ae02b298Smrg    Load local customization files, but don't complain
649ae02b298Smrg    if there aren't any
650ae02b298Smrg  --&gt;
651ae02b298Smrg  &lt;include ignore_missing="yes"&gt;conf.d&lt;/include&gt;
652ae02b298Smrg  &lt;include ignore_missing="yes"&gt;local.conf&lt;/include&gt;
6532c393a42Smrg
654ae02b298Smrg  &lt;!--
655ae02b298Smrg    Alias well known font names to available TrueType fonts.
656ae02b298Smrg    These substitute TrueType faces for similar Type1
657ae02b298Smrg    faces to improve screen appearance.
658ae02b298Smrg  --&gt;
659ae02b298Smrg  &lt;alias&gt;
660ae02b298Smrg    &lt;family&gt;Times&lt;/family&gt;
661ae02b298Smrg    &lt;prefer&gt;
662ae02b298Smrg      &lt;family&gt;Times New Roman&lt;/family&gt;
663ae02b298Smrg    &lt;/prefer&gt;
664ae02b298Smrg    &lt;default&gt;
665ae02b298Smrg      &lt;family&gt;serif&lt;/family&gt;
666ae02b298Smrg    &lt;/default&gt;
667ae02b298Smrg  &lt;/alias&gt;
668ae02b298Smrg  &lt;alias&gt;
669ae02b298Smrg    &lt;family&gt;Helvetica&lt;/family&gt;
670ae02b298Smrg    &lt;prefer&gt;
671ae02b298Smrg      &lt;family&gt;Arial&lt;/family&gt;
672ae02b298Smrg    &lt;/prefer&gt;
673ae02b298Smrg    &lt;default&gt;
674ae02b298Smrg      &lt;family&gt;sans&lt;/family&gt;
675ae02b298Smrg    &lt;/default&gt;
676ae02b298Smrg  &lt;/alias&gt;
677ae02b298Smrg  &lt;alias&gt;
678ae02b298Smrg    &lt;family&gt;Courier&lt;/family&gt;
679ae02b298Smrg    &lt;prefer&gt;
680ae02b298Smrg      &lt;family&gt;Courier New&lt;/family&gt;
681ae02b298Smrg    &lt;/prefer&gt;
682ae02b298Smrg    &lt;default&gt;
683ae02b298Smrg      &lt;family&gt;monospace&lt;/family&gt;
684ae02b298Smrg    &lt;/default&gt;
685ae02b298Smrg  &lt;/alias&gt;
6862c393a42Smrg
687ae02b298Smrg  &lt;!--
688ae02b298Smrg    Provide required aliases for standard names
689ae02b298Smrg    Do these after the users configuration file so that
690ae02b298Smrg    any aliases there are used preferentially
691ae02b298Smrg  --&gt;
692ae02b298Smrg  &lt;alias&gt;
693ae02b298Smrg    &lt;family&gt;serif&lt;/family&gt;
694ae02b298Smrg    &lt;prefer&gt;
695ae02b298Smrg      &lt;family&gt;Times New Roman&lt;/family&gt;
696ae02b298Smrg    &lt;/prefer&gt;
697ae02b298Smrg  &lt;/alias&gt;
698ae02b298Smrg  &lt;alias&gt;
699ae02b298Smrg    &lt;family&gt;sans&lt;/family&gt;
700ae02b298Smrg    &lt;prefer&gt;
701ae02b298Smrg      &lt;family&gt;Arial&lt;/family&gt;
702ae02b298Smrg    &lt;/prefer&gt;
703ae02b298Smrg  &lt;/alias&gt;
704ae02b298Smrg  &lt;alias&gt;
705ae02b298Smrg    &lt;family&gt;monospace&lt;/family&gt;
706ae02b298Smrg    &lt;prefer&gt;
707ae02b298Smrg      &lt;family&gt;Andale Mono&lt;/family&gt;
708ae02b298Smrg    &lt;/prefer&gt;
709ae02b298Smrg  &lt;/alias&gt;
710ca08ab68Smrg
711ae02b298Smrg  &lt;--
712ae02b298Smrg    The example of the requirements of OR operator;
713ae02b298Smrg    If the 'family' contains 'Courier New' OR 'Courier'
714ae02b298Smrg    add 'monospace' as the alternative
715ae02b298Smrg  --&gt;
716ae02b298Smrg  &lt;match target="pattern"&gt;
717ae02b298Smrg    &lt;test name="family" compare="eq"&gt;
718ae02b298Smrg      &lt;string&gt;Courier New&lt;/string&gt;
719ae02b298Smrg    &lt;/test&gt;
720ae02b298Smrg    &lt;edit name="family" mode="prepend"&gt;
721ae02b298Smrg      &lt;string&gt;monospace&lt;/string&gt;
722ae02b298Smrg    &lt;/edit&gt;
723ae02b298Smrg  &lt;/match&gt;
724ae02b298Smrg  &lt;match target="pattern"&gt;
725ae02b298Smrg    &lt;test name="family" compare="eq"&gt;
726ae02b298Smrg      &lt;string&gt;Courier&lt;/string&gt;
727ae02b298Smrg    &lt;/test&gt;
728ae02b298Smrg    &lt;edit name="family" mode="prepend"&gt;
729ae02b298Smrg      &lt;string&gt;monospace&lt;/string&gt;
730ae02b298Smrg    &lt;/edit&gt;
731ae02b298Smrg  &lt;/match&gt;
732ca08ab68Smrg
7332c393a42Smrg&lt;/fontconfig&gt;
7342c393a42Smrg    </programlisting>
7352c393a42Smrg  </refsect2>
7362c393a42Smrg  <refsect2><title>User configuration file</title>
7372c393a42Smrg    <para>
7382c393a42SmrgThis is an example of a per-user configuration file that lives in
739ca08ab68Smrg$XDG_CONFIG_HOME/fontconfig/fonts.conf
7402c393a42Smrg    </para>
7412c393a42Smrg    <programlisting>
7422c393a42Smrg&lt;?xml version="1.0"?&gt;
743a4e54154Smrg&lt;!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"&gt;
7442c393a42Smrg&lt;!--
745ae02b298Smrg  $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration
7462c393a42Smrg--&gt;
747ae02b298Smrg&lt;fontconfig&gt;
7482c393a42Smrg
749ae02b298Smrg  &lt;!--
750ae02b298Smrg    Private font directory
751ae02b298Smrg  --&gt;
752ae02b298Smrg  &lt;dir prefix="xdg"&gt;fonts&lt;/dir&gt;
753ae02b298Smrg
754ae02b298Smrg  &lt;!--
755ae02b298Smrg    use rgb sub-pixel ordering to improve glyph appearance on
756ae02b298Smrg    LCD screens.  Changes affecting rendering, but not matching
757ae02b298Smrg    should always use target="font".
758ae02b298Smrg  --&gt;
759ae02b298Smrg  &lt;match target="font"&gt;
760ae02b298Smrg    &lt;edit name="rgba" mode="assign"&gt;
761ae02b298Smrg      &lt;const&gt;rgb&lt;/const&gt;
762ae02b298Smrg    &lt;/edit&gt;
763ae02b298Smrg  &lt;/match&gt;
764ae02b298Smrg  &lt;!--
765ae02b298Smrg    use WenQuanYi Zen Hei font when serif is requested for Chinese
766ae02b298Smrg  --&gt;
767ae02b298Smrg  &lt;match&gt;
768ae02b298Smrg    &lt;!--
769ae02b298Smrg      If you don't want to use WenQuanYi Zen Hei font for zh-tw etc,
770ae02b298Smrg      you can use zh-cn instead of zh.
771ae02b298Smrg      Please note, even if you set zh-cn, it still matches zh.
772ae02b298Smrg      if you don't like it, you can use compare="eq"
773ae02b298Smrg      instead of compare="contains".
774ae02b298Smrg    --&gt;
775ae02b298Smrg    &lt;test name="lang" compare="contains"&gt;
776ae02b298Smrg      &lt;string&gt;zh&lt;/string&gt;
777ae02b298Smrg    &lt;/test&gt;
778ae02b298Smrg    &lt;test name="family"&gt;
779ae02b298Smrg      &lt;string&gt;serif&lt;/string&gt;
780ae02b298Smrg    &lt;/test&gt;
781ae02b298Smrg    &lt;edit name="family" mode="prepend"&gt;
782ae02b298Smrg      &lt;string&gt;WenQuanYi Zen Hei&lt;/string&gt;
783ae02b298Smrg    &lt;/edit&gt;
784ae02b298Smrg  &lt;/match&gt;
785ae02b298Smrg  &lt;!--
786ae02b298Smrg    use VL Gothic font when sans-serif is requested for Japanese
787ae02b298Smrg  --&gt;
788ae02b298Smrg  &lt;match&gt;
789ae02b298Smrg    &lt;test name="lang" compare="contains"&gt;
790ae02b298Smrg      &lt;string&gt;ja&lt;/string&gt;
791ae02b298Smrg    &lt;/test&gt;
792ae02b298Smrg    &lt;test name="family"&gt;
793ae02b298Smrg      &lt;string&gt;sans-serif&lt;/string&gt;
794ae02b298Smrg    &lt;/test&gt;
795ae02b298Smrg    &lt;edit name="family" mode="prepend"&gt;
796ae02b298Smrg      &lt;string&gt;VL Gothic&lt;/string&gt;
797ae02b298Smrg    &lt;/edit&gt;
798ae02b298Smrg  &lt;/match&gt;
7992c393a42Smrg&lt;/fontconfig&gt;
8002c393a42Smrg    </programlisting>
8012c393a42Smrg  </refsect2>
8022c393a42Smrg</refsect1>
8032c393a42Smrg<refsect1><title>Files</title>
8042c393a42Smrg  <para>
8052c393a42Smrg<emphasis>fonts.conf</emphasis>
8062c393a42Smrgcontains configuration information for the fontconfig library
8072c393a42Smrgconsisting of directories to look at for font information as well as
8082c393a42Smrginstructions on editing program specified font patterns before attempting to
809ca08ab68Smrgmatch the available fonts.  It is in XML format.
8102c393a42Smrg  </para>
8112c393a42Smrg  <para>
8122c393a42Smrg<emphasis>conf.d</emphasis>
8132c393a42Smrgis the conventional name for a directory of additional configuration files
8142c393a42Smrgmanaged by external applications or the local administrator.  The
8152c393a42Smrgfilenames starting with decimal digits are sorted in lexicographic order
816ca08ab68Smrgand used as additional configuration files.  All of these files are in XML
817ae02b298Smrgformat.  The master fonts.conf file references this directory in an
8182c393a42Smrg&lt;include&gt; directive.
8192c393a42Smrg  </para>
8202c393a42Smrg  <para>
8212c393a42Smrg<emphasis>fonts.dtd</emphasis>
8222c393a42Smrgis a DTD that describes the format of the configuration files.
8232c393a42Smrg  </para>
8242c393a42Smrg  <para>
825ca08ab68Smrg<emphasis>$XDG_CONFIG_HOME/fontconfig/conf.d</emphasis> and <emphasis>~/.fonts.conf.d</emphasis>
826a6844aabSmrgis the conventional name for a per-user directory of (typically
827a6844aabSmrgauto-generated) configuration files, although the
828ca08ab68Smrgactual location is specified in the global fonts.conf file. please note that ~/.fonts.conf.d is deprecated now. it will not be read by default in the future version.
829a6844aabSmrg  </para>
830a6844aabSmrg  <para>
831ca08ab68Smrg<emphasis>$XDG_CONFIG_HOME/fontconfig/fonts.conf</emphasis> and <emphasis>~/.fonts.conf</emphasis>
8322c393a42Smrgis the conventional location for per-user font configuration, although the
833ca08ab68Smrgactual location is specified in the global fonts.conf file. please note that ~/.fonts.conf is deprecated now. it will not be read by default in the future version.
8342c393a42Smrg  </para>
8352c393a42Smrg  <para>
836ca08ab68Smrg<emphasis>$XDG_CACHE_HOME/fontconfig/*.cache-*</emphasis> and <emphasis> ~/.fontconfig/*.cache-*</emphasis>
8372c393a42Smrgis the conventional repository of font information that isn't found in the
838ca08ab68Smrgper-directory caches.  This file is automatically maintained by fontconfig. please note that ~/.fontconfig/*.cache-* is deprecated now. it will not be read by default in the future version.
839ca08ab68Smrg  </para>
840ca08ab68Smrg</refsect1>
841ca08ab68Smrg<refsect1><title>Environment variables</title>
842ca08ab68Smrg  <para>
843ca08ab68Smrg<emphasis>FONTCONFIG_FILE</emphasis>
844ca08ab68Smrgis used to override the default configuration file.
845ca08ab68Smrg  </para>
846ca08ab68Smrg  <para>
847ca08ab68Smrg<emphasis>FONTCONFIG_PATH</emphasis>
848ca08ab68Smrgis used to override the default configuration directory.
849ca08ab68Smrg  </para>
850ca08ab68Smrg  <para>
851a32e9e42Smrg<emphasis>FONTCONFIG_SYSROOT</emphasis>
852a32e9e42Smrgis used to set a default sysroot directory.
853a32e9e42Smrg  </para>
854a32e9e42Smrg  <para>
855ca08ab68Smrg<emphasis>FC_DEBUG</emphasis>
856ca08ab68Smrgis used to output the detailed debugging messages. see <link linkend="debug">Debugging Applications</link> section for more details.
857ca08ab68Smrg  </para>
858ca08ab68Smrg  <para>
859953daebaSmrg<emphasis>FC_DBG_MATCH_FILTER</emphasis>
860953daebaSmrgis used to filter out the patterns. this takes a comma-separated list of object names and effects only when FC_DEBUG has MATCH2. see <link linkend="debug">Debugging Applications</link> section for more details.
861953daebaSmrg  </para>
862953daebaSmrg  <para>
863953daebaSmrg<emphasis>FC_LANG</emphasis>
864953daebaSmrgis used to specify the default language as the weak binding in the query. if this isn't set, the default language will be determined from current locale.
865953daebaSmrg  </para>
866953daebaSmrg  <para>
867ca08ab68Smrg<emphasis>FONTCONFIG_USE_MMAP</emphasis>
868ca08ab68Smrgis used to control the use of mmap(2) for the cache files if available. this take a boolean value. fontconfig will checks if the cache files are stored on the filesystem that is safe to use mmap(2). explicitly setting this environment variable will causes skipping this check and enforce to use or not use mmap(2) anyway.
8692c393a42Smrg  </para>
870a32e9e42Smrg  <para>
871a32e9e42Smrg<emphasis>SOURCE_DATE_EPOCH</emphasis>
872a32e9e42Smrgis used to ensure <literal>fc-cache(1)</literal> generates files in a deterministic manner in order to support reproducible builds. When set to a numeric representation of UNIX timestamp, fontconfig will prefer this value over using the modification timestamps of the input files in order to identify which cache files require regeneration. If <literal>SOURCE_DATE_EPOCH</literal> is not set (or is newer than the mtime of the directory), the existing behaviour is unchanged.
873a32e9e42Smrg  </para>
8742c393a42Smrg</refsect1>
8752c393a42Smrg<refsect1><title>See Also</title>
8762c393a42Smrg  <para>
877a32e9e42Smrgfc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1), <ulink url="https://reproducible-builds.org/specs/source-date-epoch/">SOURCE_DATE_EPOCH</ulink>.
8782c393a42Smrg  </para>
8792c393a42Smrg</refsect1>
8802c393a42Smrg<refsect1><title>Version</title>
881ae02b298Smrg            <para>
8822c393a42SmrgFontconfig version &version;
883ae02b298Smrg            </para>
8842c393a42Smrg</refsect1>
8852c393a42Smrg</refentry>
886