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