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