fontconfig-user.sgml revision a4e54154
1<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
2<!ENTITY version SYSTEM "version.sgml">
3<!ENTITY confdir SYSTEM "confdir.sgml">
4]>
5<!--
6    Copyright © 2003 Keith Packard
7   
8    Permission to use, copy, modify, distribute, and sell this software and its
9    documentation for any purpose is hereby granted without fee, provided that
10    the above copyright notice appear in all copies and that both that
11    copyright notice and this permission notice appear in supporting
12    documentation, and that the name of the author(s) not be used in
13    advertising or publicity pertaining to distribution of the software without
14    specific, written prior permission.  The authors make no
15    representations about the suitability of this software for any purpose.  It
16    is provided "as is" without express or implied warranty.
17   
18    THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19    INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
20    EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
21    CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
22    DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
23    TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24    PERFORMANCE OF THIS SOFTWARE.
25-->
26<refentry>
27<refmeta>
28  <refentrytitle>fonts-conf</refentrytitle>
29  <manvolnum>5</manvolnum>
30</refmeta>
31<refnamediv>
32	<refname>fonts.conf</refname>
33	<refpurpose>Font configuration files</refpurpose>
34</refnamediv>
35<refsynopsisdiv>
36<synopsis>
37   &confdir;/fonts.conf
38   &confdir;/fonts.dtd
39   &confdir;/conf.d
40   $XDG_CONFIG_HOME/fontconfig/conf.d
41   $XDG_CONFIG_HOME/fontconfig/fonts.conf
42   ~/.fonts.conf.d
43   ~/.fonts.conf
44</synopsis>
45</refsynopsisdiv>
46<refsect1><title>Description</title>
47  <para>
48Fontconfig is a library designed to provide system-wide font configuration,
49customization and application access.
50  </para>
51</refsect1>
52<refsect1><title>Functional Overview</title>
53  <para>
54Fontconfig contains two essential modules, the configuration module which
55builds an internal configuration from XML files and the matching module
56which accepts font patterns and returns the nearest matching font.
57  </para>
58  <refsect2><title>Font Configuration</title>
59    <para>
60The configuration module consists of the FcConfig datatype, libexpat and
61FcConfigParse which walks over an XML tree and amends a configuration with
62data found within.  From an external perspective, configuration of the
63library consists of generating a valid XML tree and feeding that to
64FcConfigParse.  The only other mechanism provided to applications for
65changing the running configuration is to add fonts and directories to the
66list of application-provided font files.  
67    </para><para>
68The intent is to make font configurations relatively static, and shared by
69as many applications as possible.  It is hoped that this will lead to more
70stable font selection when passing names from one application to another.
71XML was chosen as a configuration file format because it provides a format
72which is easy for external agents to edit while retaining the correct
73structure and syntax.
74    </para><para>
75Font configuration is separate from font matching; applications needing to
76do their own matching can access the available fonts from the library and
77perform private matching.  The intent is to permit applications to pick and
78choose appropriate functionality from the library instead of forcing them to
79choose between this library and a private configuration mechanism.  The hope
80is that this will ensure that configuration of fonts for all applications
81can be centralized in one place.  Centralizing font configuration will
82simplify and regularize font installation and customization.
83    </para>
84  </refsect2>
85  <refsect2>
86    <title>Font Properties</title>
87    <para>
88While font patterns may contain essentially any properties, there are some
89well known properties with associated types.  Fontconfig uses some of these
90properties for font matching and font completion.  Others are provided as a
91convenience for the applications' rendering mechanism.
92    </para>
93    <programlisting>
94  Property        Type    Description
95  --------------------------------------------------------------
96  family          String  Font family names
97  familylang      String  Languages corresponding to each family
98  style           String  Font style. Overrides weight and slant
99  stylelang       String  Languages corresponding to each style
100  fullname        String  Font full names (often includes style)
101  fullnamelang    String  Languages corresponding to each fullname
102  slant           Int     Italic, oblique or roman
103  weight          Int     Light, medium, demibold, bold or black
104  size            Double  Point size
105  width           Int     Condensed, normal or expanded
106  aspect          Double  Stretches glyphs horizontally before hinting
107  pixelsize       Double  Pixel size
108  spacing         Int     Proportional, dual-width, monospace or charcell
109  foundry         String  Font foundry name
110  antialias       Bool    Whether glyphs can be antialiased
111  hinting         Bool    Whether the rasterizer should use hinting
112  hintstyle       Int     Automatic hinting style
113  verticallayout  Bool    Use vertical layout
114  autohint        Bool    Use autohinter instead of normal hinter
115  globaladvance   Bool    Use font global advance data (deprecated)
116  file            String  The filename holding the font
117  index           Int     The index of the font within the file
118  ftface          FT_Face Use the specified FreeType face object
119  rasterizer      String  Which rasterizer is in use (deprecated)
120  outline         Bool    Whether the glyphs are outlines
121  scalable        Bool    Whether glyphs can be scaled
122  color           Bool    Whether any glyphs have color
123  scale           Double  Scale factor for point->pixel conversions (deprecated)
124  dpi             Double  Target dots per inch
125  rgba            Int     unknown, rgb, bgr, vrgb, vbgr,
126                          none - subpixel geometry
127  lcdfilter       Int     Type of LCD filter
128  minspace        Bool    Eliminate leading from line spacing
129  charset         CharSet Unicode chars encoded by the font
130  lang            String  List of RFC-3066-style languages this
131                          font supports
132  fontversion     Int     Version number of the font
133  capability      String  List of layout capabilities in the font
134  fontformat      String  String name of the font format
135  embolden        Bool    Rasterizer should synthetically embolden the font
136  embeddedbitmap  Bool    Use the embedded bitmap instead of the outline
137  decorative      Bool    Whether the style is a decorative variant
138  fontfeatures    String  List of the feature tags in OpenType to be enabled
139  namelang        String  Language name to be used for the default value of
140                          familylang, stylelang, and fullnamelang
141  prgname         String  String  Name of the running program
142  postscriptname  String  Font family name in PostScript
143  fonthashint     Bool    Whether the font has hinting
144  order           Int     Order number of the font
145    </programlisting>
146  </refsect2>
147  <refsect2>
148  <title>Font Matching</title>
149    <para>
150Fontconfig performs matching by measuring the distance from a provided
151pattern to all of the available fonts in the system.  The closest matching
152font is selected.  This ensures that a font will always be returned, but
153doesn't ensure that it is anything like the requested pattern.
154    </para><para> 
155Font matching starts with an application constructed pattern.  The desired
156attributes of the resulting font are collected together in a pattern.  Each
157property of the pattern can contain one or more values; these are listed in
158priority order; matches earlier in the list are considered "closer" than
159matches later in the list.
160    </para><para>
161The initial pattern is modified by applying the list of editing instructions
162specific to patterns found in the configuration; each consists of a match
163predicate and a set of editing operations.  They are executed in the order
164they appeared in the configuration.  Each match causes the associated
165sequence of editing operations to be applied.
166    </para><para>
167After the pattern has been edited, a sequence of default substitutions are
168performed to canonicalize the set of available properties; this avoids the
169need for the lower layers to constantly provide default values for various
170font properties during rendering.
171    </para><para>
172The canonical font pattern is finally matched against all available fonts.
173The distance from the pattern to the font is measured for each of several
174properties: foundry, charset, family, lang, spacing, pixelsize, style,
175slant, weight, antialias, rasterizer and outline.  This list is in priority
176order -- results of comparing earlier elements of this list weigh more
177heavily than later elements.
178    </para><para>
179There is one special case to this rule; family names are split into two
180bindings; strong and weak.  Strong family names are given greater precedence
181in the match than lang elements while weak family names are given lower
182precedence than lang elements.  This permits the document language to drive
183font selection when any document specified font is unavailable.
184    </para><para>
185The pattern representing that font is augmented to include any properties
186found in the pattern but not found in the font itself; this permits the
187application to pass rendering instructions or any other data through the
188matching system.  Finally, the list of editing instructions specific to
189fonts found in the configuration are applied to the pattern.  This modified
190pattern is returned to the application.
191    </para><para>
192The return value contains sufficient information to locate and rasterize the
193font, including the file name, pixel size and other rendering data.  As
194none of the information involved pertains to the FreeType library,
195applications are free to use any rasterization engine or even to take
196the identified font file and access it directly.
197    </para><para>
198The match/edit sequences in the configuration are performed in two passes
199because there are essentially two different operations necessary -- the
200first is to modify how fonts are selected; aliasing families and adding
201suitable defaults.  The second is to modify how the selected fonts are
202rasterized.  Those must apply to the selected font, not the original pattern
203as false matches will often occur.
204    </para>
205  </refsect2>
206  <refsect2><title>Font Names</title>
207    <para>
208Fontconfig provides a textual representation for patterns that the library
209can both accept and generate.  The representation is in three parts, first a
210list of family names, second a list of point sizes and finally a list of
211additional properties:
212    </para>
213    <programlisting>
214	&lt;families&gt;-&lt;point sizes&gt;:&lt;name1&gt;=&lt;values1&gt;:&lt;name2&gt;=&lt;values2&gt;...
215    </programlisting>
216    <para>
217Values in a list are separated with commas.  The name needn't include either
218families or point sizes; they can be elided.  In addition, there are
219symbolic constants that simultaneously indicate both a name and a value.
220Here are some examples:
221    </para>
222    <programlisting>
223  Name                            Meaning
224  ----------------------------------------------------------
225  Times-12                        12 point Times Roman
226  Times-12:bold                   12 point Times Bold
227  Courier:italic                  Courier Italic in the default size
228  Monospace:matrix=1 .1 0 1       The users preferred monospace font
229                                  with artificial obliquing
230    </programlisting>
231    <para>
232The '\', '-', ':' and ',' characters in family names must be preceded by a
233'\' character to avoid having them misinterpreted. Similarly, values
234containing '\', '=', '_', ':' and ',' must also have them preceded by a
235'\' character. The '\' characters are stripped out of the family name and
236values as the font name is read.
237    </para>
238  </refsect2>
239</refsect1>
240<refsect1 id="debug"><title>Debugging Applications</title>
241  <para>
242To help diagnose font and applications problems, fontconfig is built with a
243large amount of internal debugging left enabled. It is controlled by means
244of the FC_DEBUG environment variable. The value of this variable is
245interpreted as a number, and each bit within that value controls different
246debugging messages.
247  </para>
248  <programlisting>
249  Name         Value    Meaning
250  ---------------------------------------------------------
251  MATCH            1    Brief information about font matching
252  MATCHV           2    Extensive font matching information
253  EDIT             4    Monitor match/test/edit execution
254  FONTSET          8    Track loading of font information at startup
255  CACHE           16    Watch cache files being written
256  CACHEV          32    Extensive cache file writing information
257  PARSE           64    (no longer in use)
258  SCAN           128    Watch font files being scanned to build caches
259  SCANV          256    Verbose font file scanning information
260  MEMORY         512    Monitor fontconfig memory usage
261  CONFIG        1024    Monitor which config files are loaded
262  LANGSET       2048    Dump char sets used to construct lang values
263  MATCH2        4096    Display font-matching transformation in patterns
264  </programlisting>
265  <para>
266Add the value of the desired debug levels together and assign that (in
267base 10) to the FC_DEBUG environment variable before running the
268application. Output from these statements is sent to stdout.
269  </para>
270</refsect1>
271<refsect1><title>Lang Tags</title>
272  <para>
273Each font in the database contains a list of languages it supports.  This is
274computed by comparing the Unicode coverage of the font with the orthography
275of each language.  Languages are tagged using an RFC-3066 compatible naming
276and occur in two parts -- the ISO 639 language tag followed a hyphen and then
277by the ISO 3166 country code.  The hyphen and country code may be elided.
278  </para><para>
279Fontconfig has orthographies for several languages built into the library.
280No provision has been made for adding new ones aside from rebuilding the
281library.  It currently supports 122 of the 139 languages named in ISO 639-1,
282141 of the languages with two-letter codes from ISO 639-2 and another 30
283languages with only three-letter codes.  Languages with both two and three
284letter codes are provided with only the two letter code.
285  </para><para>
286For languages used in multiple territories with radically different
287character sets, fontconfig includes per-territory orthographies.  This
288includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
289  </para>
290</refsect1>
291<refsect1><title>Configuration File Format</title>
292  <para>
293Configuration files for fontconfig are stored in XML format; this
294format makes external configuration tools easier to write and ensures that
295they will generate syntactically correct configuration files.  As XML
296files are plain text, they can also be manipulated by the expert user using
297a text editor.
298  </para><para>
299The fontconfig document type definition resides in the external entity
300"fonts.dtd"; this is normally stored in the default font configuration
301directory (&confdir;).  Each configuration file should contain the
302following structure:
303    <programlisting>
304	&lt;?xml version="1.0"?&gt;
305	&lt;!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"&gt;
306	&lt;fontconfig&gt;
307	...
308	&lt;/fontconfig&gt;
309    </programlisting>
310  </para>
311<refsect2><title><literal>&lt;fontconfig&gt;</literal></title><para>
312This is the top level element for a font configuration and can contain
313<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.
314  </para></refsect2>
315  <refsect2><title><literal>&lt;dir prefix="default" salt=""&gt;</literal></title><para>
316This element contains a directory name which will be scanned for font files
317to include in the set of available fonts.
318  </para><para>
319If '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.
320  </para><para>
321'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.
322  </para></refsect2>
323  <refsect2><title><literal>&lt;cachedir prefix="default"&gt;</literal></title><para>
324This element contains a directory name that is supposed to be stored or read
325the cache of font information.  If multiple elements are specified in
326the configuration file, the directory that can be accessed first in the list
327will be used to store the cache files.  If it starts with '~', it refers to
328a 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.
329The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
330named ``<literal>&lt;hash value&gt;</literal>-<literal>&lt;architecture&gt;</literal>.cache-<literal>&lt;version&gt;</literal>'',
331where <literal>&lt;version&gt;</literal> is the fontconfig cache file
332version number (currently 7).
333  </para></refsect2>
334  <refsect2><title><literal>&lt;include ignore_missing="no" prefix="default"&gt;</literal></title><para>
335This element contains the name of an additional configuration file or
336directory.  If a directory, every file within that directory starting with an
337ASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be processed in sorted order.  When
338the XML datatype is traversed by FcConfigParse, the contents of the file(s)
339will also be incorporated into the configuration by passing the filename(s) to
340FcConfigLoadAndParse.  If 'ignore_missing' is set to "yes" instead of the
341default "no", a missing file or directory will elicit no warning message from
342the 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.
343  </para></refsect2>
344  <refsect2><title><literal>&lt;config&gt;</literal></title><para>
345This element provides a place to consolidate additional configuration
346information.  <literal>&lt;config&gt;</literal> can contain <literal>&lt;blank&gt;</literal> and <literal>&lt;rescan&gt;</literal> elements in any
347order.
348  </para></refsect2>
349  <refsect2><title><literal>&lt;description domain="fontconfig-conf"&gt;</literal></title><para>
350This element is supposed to hold strings which describe what a config is used for.
351This string can be translated through gettext. 'domain' needs to be set the proper name to apply then.
352fontconfig will tries to retrieve translations with 'domain' from gettext.
353  </para></refsect2>
354  <refsect2><title><literal>&lt;blank&gt;</literal></title><para>
355Fonts often include "broken" glyphs which appear in the encoding but are
356drawn as blanks on the screen.  Within the <literal>&lt;blank&gt;</literal> element, place each
357Unicode characters which is supposed to be blank in an <literal>&lt;int&gt;</literal> element.
358Characters outside of this set which are drawn as blank will be elided from
359the set of characters supported by the font.
360  </para></refsect2>
361  <refsect2><title><literal>&lt;remap-dir prefix="default" as-path="" salt=""&gt;</literal></title><para>
362This element contains a directory name where will be mapped
363as the path 'as-path' in cached information.
364This is useful if the directory name is an alias
365(via a bind mount or symlink) to another directory in the system for
366which cached font information is likely to exist.
367  </para><para>
368'salt' property affects to determine cache filename as same as <literal>&lt;dir&gt;</literal> element.
369  </para></refsect2>
370  <refsect2><title><literal>&lt;reset-dirs /&gt;</literal></title><para>
371This element removes all of fonts directories where added by <literal>&lt;dir&gt;</literal> elements.
372This is useful to override fonts directories from system to own fonts directories only.
373  </para></refsect2>
374  <refsect2><title><literal>&lt;rescan&gt;</literal></title><para>
375The <literal>&lt;rescan&gt;</literal> element holds an <literal>&lt;int&gt;</literal> element which indicates the default
376interval between automatic checks for font configuration changes.
377Fontconfig will validate all of the configuration files and directories and
378automatically rebuild the internal datastructures when this interval passes.
379  </para></refsect2>
380  <refsect2><title><literal>&lt;selectfont&gt;</literal></title><para>
381This element is used to black/white list fonts from being listed or matched
382against.  It holds acceptfont and rejectfont elements.
383  </para></refsect2>
384  <refsect2><title><literal>&lt;acceptfont&gt;</literal></title><para>
385Fonts matched by an acceptfont element are "whitelisted"; such fonts are
386explicitly included in the set of fonts used to resolve list and match
387requests; including them in this list protects them from being "blacklisted"
388by a rejectfont element.  Acceptfont elements include glob and pattern
389elements which are used to match fonts.
390  </para></refsect2>
391  <refsect2><title><literal>&lt;rejectfont&gt;</literal></title><para>
392Fonts matched by an rejectfont element are "blacklisted"; such fonts are
393excluded from the set of fonts used to resolve list and match requests as if
394they didn't exist in the system.  Rejectfont elements include glob and
395pattern elements which are used to match fonts.
396  </para></refsect2>
397  <refsect2><title><literal>&lt;glob&gt;</literal></title><para>
398Glob elements hold shell-style filename matching patterns (including ? and
399*) which match fonts based on their complete pathnames.  This can be used to
400exclude a set of directories (/usr/share/fonts/uglyfont*), or particular
401font file types (*.pcf.gz), but the latter mechanism relies rather heavily
402on filenaming conventions which can't be relied upon.  Note that globs
403only apply to directories, not to individual fonts.
404  </para></refsect2>
405  <refsect2><title><literal>&lt;pattern&gt;</literal></title><para>
406Pattern elements perform list-style matching on incoming fonts; that is,
407they hold a list of elements and associated values.  If all of those
408elements have a matching value, then the pattern matches the font.  This can
409be used to select fonts based on attributes of the font (scalable, bold,
410etc), which is a more reliable mechanism than using file extensions.
411Pattern elements include patelt elements.
412  </para></refsect2>
413  <refsect2><title><literal>&lt;patelt name="property"&gt;</literal></title><para>
414Patelt elements hold a single pattern element and list of values.  They must
415have a 'name' attribute which indicates the pattern element name.  Patelt
416elements include int, double, string, matrix, bool, charset and const
417elements.
418  </para></refsect2>
419  <refsect2><title><literal>&lt;match target="pattern"&gt;</literal></title><para>
420This element holds first a (possibly empty) list of <literal>&lt;test&gt;</literal> elements and then
421a (possibly empty) list of <literal>&lt;edit&gt;</literal> elements.  Patterns which match all of the
422tests are subjected to all the edits.  If 'target' is set to "font" instead
423of the default "pattern", then this element applies to the font name
424resulting from a match rather than a font pattern to be matched. If 'target'
425is set to "scan", then this element applies when the font is scanned to
426build the fontconfig database.
427  </para></refsect2>
428  <refsect2><title><literal>&lt;test qual="any" name="property" target="default" compare="eq"&gt;</literal></title><para>
429This element contains a single value which is compared with the target
430('pattern', 'font', 'scan' or 'default') property "property" (substitute any of the property names seen 
431above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", "more_eq", "contains" or
432"not_contains".  'qual' may either be the default, "any", in which case the match
433succeeds if any value associated with the property matches the test value, or
434"all", in which case all of the values associated with the property must
435match 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".
436When used in a &lt;match target="font"&gt; element,
437the target= attribute in the &lt;test&gt; element selects between matching
438the original pattern or the font.  "default" selects whichever target the
439outer &lt;match&gt; element has selected.
440  </para></refsect2>
441  <refsect2><title><literal>&lt;edit name="property" mode="assign" binding="weak"&gt;</literal></title><para>
442This element contains a list of expression elements (any of the value or
443operator elements).  The expression elements are evaluated at run-time and
444modify the property "property".  The modification depends on whether
445"property" was matched by one of the associated <literal>&lt;test&gt;</literal> elements, if so, the
446modification may affect the first matched value.  Any values inserted into
447the property are given the indicated binding ("strong", "weak" or "same")
448with "same" binding using the value from the matched pattern element.
449'mode' is one of:
450    <programlisting>
451  Mode                    With Match              Without Match
452  ---------------------------------------------------------------------
453  "assign"                Replace matching value  Replace all values
454  "assign_replace"        Replace all values      Replace all values
455  "prepend"               Insert before matching  Insert at head of list
456  "prepend_first"         Insert at head of list  Insert at head of list
457  "append"                Append after matching   Append at end of list
458  "append_last"           Append at end of list   Append at end of list
459  "delete"                Delete matching value   Delete all values
460  "delete_all"            Delete all values       Delete all values
461    </programlisting>
462  </para></refsect2>
463  <refsect2><title><literal>&lt;int&gt;</literal>, <literal>&lt;double&gt;</literal>, <literal>&lt;string&gt;</literal>, <literal>&lt;bool&gt;</literal></title><para>
464These elements hold a single value of the indicated type.  <literal>&lt;bool&gt;</literal>
465elements hold either true or false.  An important limitation exists in
466the parsing of floating point numbers -- fontconfig requires that
467the mantissa start with a digit, not a decimal point, so insert a leading
468zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5
469instead of -.5).
470  </para></refsect2>
471  <refsect2><title><literal>&lt;matrix&gt;</literal></title><para>
472This element holds four numerical expressions of an affine transformation.
473At their simplest these will be four <literal>&lt;double&gt;</literal> elements
474but they can also be more involved expressions.
475  </para></refsect2>
476  <refsect2><title><literal>&lt;range&gt;</literal></title><para>
477This element holds the two <literal>&lt;int&gt;</literal> elements of a range
478representation.
479  </para></refsect2>
480  <refsect2><title><literal>&lt;charset&gt;</literal></title><para>
481This element holds at least one <literal>&lt;int&gt;</literal> element of
482an Unicode code point or more.
483  </para></refsect2>
484  <refsect2><title><literal>&lt;langset&gt;</literal></title><para>
485This element holds at least one <literal>&lt;string&gt;</literal> element of
486a RFC-3066-style languages or more.
487  </para></refsect2>
488  <refsect2><title><literal>&lt;name&gt;</literal></title><para>
489Holds a property name.  Evaluates to the first value from the property of
490the pattern.  If the 'target' attribute is not present, it will default to
491'default', in which case the property is returned from the font pattern
492during a target="font" match, and to the pattern during a target="pattern"
493match.  The attribute can also take the values 'font' or 'pattern' to
494explicitly choose which pattern to use.  It is an error to use a target
495of 'font' in a match that has target="pattern".
496  </para></refsect2>
497  <refsect2><title><literal>&lt;const&gt;</literal></title><para>
498Holds the name of a constant; these are always integers and serve as
499symbolic names for common font values:
500    <programlisting>
501  Constant        Property        Value
502  -------------------------------------
503  thin            weight          0
504  extralight      weight          40
505  ultralight      weight          40
506  light           weight          50
507  demilight       weight          55
508  semilight       weight          55
509  book            weight          75
510  regular         weight          80
511  normal          weight          80
512  medium          weight          100
513  demibold        weight          180
514  semibold        weight          180
515  bold            weight          200
516  extrabold       weight          205
517  black           weight          210
518  heavy           weight          210
519  roman           slant           0
520  italic          slant           100
521  oblique         slant           110
522  ultracondensed  width           50
523  extracondensed  width           63
524  condensed       width           75
525  semicondensed   width           87
526  normal          width           100
527  semiexpanded    width           113
528  expanded        width           125
529  extraexpanded   width           150
530  ultraexpanded   width           200
531  proportional    spacing         0
532  dual            spacing         90
533  mono            spacing         100
534  charcell        spacing         110
535  unknown         rgba            0
536  rgb             rgba            1
537  bgr             rgba            2
538  vrgb            rgba            3
539  vbgr            rgba            4
540  none            rgba            5
541  lcdnone         lcdfilter       0
542  lcddefault      lcdfilter       1
543  lcdlight        lcdfilter       2
544  lcdlegacy       lcdfilter       3
545  hintnone        hintstyle       0
546  hintslight      hintstyle       1
547  hintmedium      hintstyle       2
548  hintfull        hintstyle       3
549    </programlisting>
550      </para>
551    </refsect2>
552  <refsect2>
553      <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>
554      <para>
555These elements perform the specified operation on a list of expression
556elements.  <literal>&lt;or&gt;</literal> and <literal>&lt;and&gt;</literal> are boolean, not bitwise.
557      </para>
558    </refsect2>
559  <refsect2>
560    <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>
561    <para>
562These elements compare two values, producing a boolean result.
563  </para></refsect2>
564  <refsect2><title><literal>&lt;not&gt;</literal></title><para>
565Inverts the boolean sense of its one expression element
566  </para></refsect2>
567  <refsect2><title><literal>&lt;if&gt;</literal></title><para>
568This element takes three expression elements; if the value of the first is
569true, it produces the value of the second, otherwise it produces the value
570of the third.
571  </para></refsect2>
572  <refsect2><title><literal>&lt;alias&gt;</literal></title><para>
573Alias elements provide a shorthand notation for the set of common match
574operations needed to substitute one font family for another.  They contain a
575<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>
576elements.  Fonts matching the <literal>&lt;family&gt;</literal> element are edited to prepend the
577list of <literal>&lt;prefer&gt;</literal>ed families before the matching <literal>&lt;family&gt;</literal>, append the
578<literal>&lt;accept&gt;</literal>able families after the matching <literal>&lt;family&gt;</literal> and append the <literal>&lt;default&gt;</literal>
579families to the end of the family list.
580  </para></refsect2>
581  <refsect2><title><literal>&lt;family&gt;</literal></title><para>
582Holds a single font family name
583  </para></refsect2>
584  <refsect2><title><literal>&lt;prefer&gt;</literal>, <literal>&lt;accept&gt;</literal>, <literal>&lt;default&gt;</literal></title><para>
585These hold a list of <literal>&lt;family&gt;</literal> elements to be used by the <literal>&lt;alias&gt;</literal> element.
586  </para></refsect2>
587</refsect1>
588<refsect1><title>EXAMPLE CONFIGURATION FILE</title>
589  <refsect2><title>System configuration file</title>
590    <para>
591This is an example of a system-wide configuration file
592    </para>
593    <programlisting>
594&lt;?xml version="1.0"?&gt;
595&lt;!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"&gt;
596&lt;!-- &confdir;/fonts.conf file to configure system font access --&gt;
597&lt;fontconfig&gt;
598&lt;!-- 
599	Find fonts in these directories
600--&gt;
601&lt;dir&gt;/usr/share/fonts&lt;/dir&gt;
602&lt;dir&gt;/usr/X11R6/lib/X11/fonts&lt;/dir&gt;
603
604&lt;!--
605	Accept deprecated 'mono' alias, replacing it with 'monospace'
606--&gt;
607&lt;match target="pattern"&gt;
608	&lt;test qual="any" name="family"&gt;&lt;string&gt;mono&lt;/string&gt;&lt;/test&gt;
609	&lt;edit name="family" mode="assign"&gt;&lt;string&gt;monospace&lt;/string&gt;&lt;/edit&gt;
610&lt;/match&gt;
611
612&lt;!--
613	Names not including any well known alias are given 'sans-serif'
614--&gt;
615&lt;match target="pattern"&gt;
616	&lt;test qual="all" name="family" compare="not_eq"&gt;&lt;string&gt;sans-serif&lt;/string&gt;&lt;/test&gt;
617	&lt;test qual="all" name="family" compare="not_eq"&gt;&lt;string&gt;serif&lt;/string&gt;&lt;/test&gt;
618	&lt;test qual="all" name="family" compare="not_eq"&gt;&lt;string&gt;monospace&lt;/string&gt;&lt;/test&gt;
619	&lt;edit name="family" mode="append_last"&gt;&lt;string&gt;sans-serif&lt;/string&gt;&lt;/edit&gt;
620&lt;/match&gt;
621
622&lt;!--
623	Load per-user customization file, but don't complain
624	if it doesn't exist
625--&gt;
626&lt;include ignore_missing="yes" prefix="xdg"&gt;fontconfig/fonts.conf&lt;/include&gt;
627
628&lt;!--
629	Load local customization files, but don't complain
630	if there aren't any
631--&gt;
632&lt;include ignore_missing="yes"&gt;conf.d&lt;/include&gt;
633&lt;include ignore_missing="yes"&gt;local.conf&lt;/include&gt;
634
635&lt;!--
636	Alias well known font names to available TrueType fonts.
637	These substitute TrueType faces for similar Type1
638	faces to improve screen appearance.
639--&gt;
640&lt;alias&gt;
641	&lt;family&gt;Times&lt;/family&gt;
642	&lt;prefer&gt;&lt;family&gt;Times New Roman&lt;/family&gt;&lt;/prefer&gt;
643	&lt;default&gt;&lt;family&gt;serif&lt;/family&gt;&lt;/default&gt;
644&lt;/alias&gt;
645&lt;alias&gt;
646	&lt;family&gt;Helvetica&lt;/family&gt;
647	&lt;prefer&gt;&lt;family&gt;Arial&lt;/family&gt;&lt;/prefer&gt;
648	&lt;default&gt;&lt;family&gt;sans&lt;/family&gt;&lt;/default&gt;
649&lt;/alias&gt;
650&lt;alias&gt;
651	&lt;family&gt;Courier&lt;/family&gt;
652	&lt;prefer&gt;&lt;family&gt;Courier New&lt;/family&gt;&lt;/prefer&gt;
653	&lt;default&gt;&lt;family&gt;monospace&lt;/family&gt;&lt;/default&gt;
654&lt;/alias&gt;
655
656&lt;!--
657	Provide required aliases for standard names
658	Do these after the users configuration file so that
659	any aliases there are used preferentially
660--&gt;
661&lt;alias&gt;
662	&lt;family&gt;serif&lt;/family&gt;
663	&lt;prefer&gt;&lt;family&gt;Times New Roman&lt;/family&gt;&lt;/prefer&gt;
664&lt;/alias&gt;
665&lt;alias&gt;
666	&lt;family&gt;sans&lt;/family&gt;
667	&lt;prefer&gt;&lt;family&gt;Arial&lt;/family&gt;&lt;/prefer&gt;
668&lt;/alias&gt;
669&lt;alias&gt;
670	&lt;family&gt;monospace&lt;/family&gt;
671	&lt;prefer&gt;&lt;family&gt;Andale Mono&lt;/family&gt;&lt;/prefer&gt;
672&lt;/alias&gt;
673
674&lt;--
675	The example of the requirements of OR operator;
676	If the 'family' contains 'Courier New' OR 'Courier'
677	add 'monospace' as the alternative
678--&gt;
679&lt;match target="pattern"&gt;
680	&lt;test name="family" compare="eq"&gt;
681		&lt;string&gt;Courier New&lt;/string&gt;
682	&lt;/test&gt;
683	&lt;edit name="family" mode="prepend"&gt;
684		&lt;string&gt;monospace&lt;/string&gt;
685	&lt;/edit&gt;
686&lt;/match&gt;
687&lt;match target="pattern"&gt;
688	&lt;test name="family" compare="eq"&gt;
689		&lt;string&gt;Courier&lt;/string&gt;
690	&lt;/test&gt;
691	&lt;edit name="family" mode="prepend"&gt;
692		&lt;string&gt;monospace&lt;/string&gt;
693	&lt;/edit&gt;
694&lt;/match&gt;
695
696&lt;/fontconfig&gt;
697    </programlisting>
698  </refsect2>
699  <refsect2><title>User configuration file</title>
700    <para>
701This is an example of a per-user configuration file that lives in
702$XDG_CONFIG_HOME/fontconfig/fonts.conf
703    </para>
704    <programlisting>
705&lt;?xml version="1.0"?&gt;
706&lt;!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"&gt;
707&lt;!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration --&gt;
708&lt;fontconfig&gt;
709
710&lt;!--
711	Private font directory
712--&gt;
713&lt;dir prefix="xdg"&gt;fonts&lt;/dir&gt;
714
715&lt;!--
716	use rgb sub-pixel ordering to improve glyph appearance on
717	LCD screens.  Changes affecting rendering, but not matching
718	should always use target="font".
719--&gt;
720&lt;match target="font"&gt;
721	&lt;edit name="rgba" mode="assign"&gt;&lt;const&gt;rgb&lt;/const&gt;&lt;/edit&gt;
722&lt;/match&gt;
723&lt;!--
724	use WenQuanYi Zen Hei font when serif is requested for Chinese
725--&gt;
726&lt;match&gt;
727	&lt;!--
728		If you don't want to use WenQuanYi Zen Hei font for zh-tw etc,
729		you can use zh-cn instead of zh.
730		Please note, even if you set zh-cn, it still matches zh.
731		if you don't like it, you can use compare="eq"
732		instead of compare="contains".
733	--&gt;
734	&lt;test name="lang" compare="contains"&gt;
735		&lt;string&gt;zh&lt;/string&gt;
736	&lt;/test&gt;
737	&lt;test name="family"&gt;
738		&lt;string&gt;serif&lt;/string&gt;
739	&lt;/test&gt;
740	&lt;edit name="family" mode="prepend"&gt;
741		&lt;string&gt;WenQuanYi Zen Hei&lt;/string&gt;
742	&lt;/edit&gt;
743&lt;/match&gt;
744&lt;!--
745	use VL Gothic font when sans-serif is requested for Japanese
746--&gt;
747&lt;match&gt;
748	&lt;test name="lang" compare="contains"&gt;
749		&lt;string&gt;ja&lt;/string&gt;
750	&lt;/test&gt;
751	&lt;test name="family"&gt;
752		&lt;string&gt;sans-serif&lt;/string&gt;
753	&lt;/test&gt;
754	&lt;edit name="family" mode="prepend"&gt;
755		&lt;string&gt;VL Gothic&lt;/string&gt;
756	&lt;/edit&gt;
757&lt;/match&gt;
758&lt;/fontconfig&gt;
759    </programlisting>
760  </refsect2>
761</refsect1>
762<refsect1><title>Files</title>
763  <para>
764<emphasis>fonts.conf</emphasis>
765contains configuration information for the fontconfig library
766consisting of directories to look at for font information as well as
767instructions on editing program specified font patterns before attempting to
768match the available fonts.  It is in XML format.
769  </para>
770  <para>
771<emphasis>conf.d</emphasis>
772is the conventional name for a directory of additional configuration files
773managed by external applications or the local administrator.  The
774filenames starting with decimal digits are sorted in lexicographic order
775and used as additional configuration files.  All of these files are in XML
776format.  The master fonts.conf file references this directory in an 
777&lt;include&gt; directive.
778  </para>
779  <para>
780<emphasis>fonts.dtd</emphasis>
781is a DTD that describes the format of the configuration files.
782  </para>
783  <para>
784<emphasis>$XDG_CONFIG_HOME/fontconfig/conf.d</emphasis> and <emphasis>~/.fonts.conf.d</emphasis>
785is the conventional name for a per-user directory of (typically
786auto-generated) configuration files, although the
787actual 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.
788  </para>
789  <para>
790<emphasis>$XDG_CONFIG_HOME/fontconfig/fonts.conf</emphasis> and <emphasis>~/.fonts.conf</emphasis>
791is the conventional location for per-user font configuration, although the
792actual 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.
793  </para>
794  <para>
795<emphasis>$XDG_CACHE_HOME/fontconfig/*.cache-*</emphasis> and <emphasis> ~/.fontconfig/*.cache-*</emphasis>
796is the conventional repository of font information that isn't found in the
797per-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.
798  </para>
799</refsect1>
800<refsect1><title>Environment variables</title>
801  <para>
802<emphasis>FONTCONFIG_FILE</emphasis>
803is used to override the default configuration file.
804  </para>
805  <para>
806<emphasis>FONTCONFIG_PATH</emphasis>
807is used to override the default configuration directory.
808  </para>
809  <para>
810<emphasis>FONTCONFIG_SYSROOT</emphasis>
811is used to set a default sysroot directory.
812  </para>
813  <para>
814<emphasis>FC_DEBUG</emphasis>
815is used to output the detailed debugging messages. see <link linkend="debug">Debugging Applications</link> section for more details.
816  </para>
817  <para>
818<emphasis>FC_DBG_MATCH_FILTER</emphasis>
819is 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.
820  </para>
821  <para>
822<emphasis>FC_LANG</emphasis>
823is 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.
824  </para>
825  <para>
826<emphasis>FONTCONFIG_USE_MMAP</emphasis>
827is 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.
828  </para>
829  <para>
830<emphasis>SOURCE_DATE_EPOCH</emphasis>
831is 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.
832  </para>
833</refsect1>
834<refsect1><title>See Also</title>
835  <para>
836fc-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>.
837  </para>
838</refsect1>
839<refsect1><title>Version</title>
840	    <para>
841Fontconfig version &version;
842	    </para>
843</refsect1>
844</refentry>
845