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