]> git.wh0rd.org - fontconfig.git/blob - doc/fontconfig-user.sgml
Sun Mar 2 14:16:17 2003 Owen Taylor <otaylor@redhat.com>
[fontconfig.git] / doc / fontconfig-user.sgml
1 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
2 <!--
3 $Id$
4
5 Copyright © 2003 Keith Packard
6
7 Permission to use, copy, modify, distribute, and sell this software and its
8 documentation for any purpose is hereby granted without fee, provided that
9 the above copyright notice appear in all copies and that both that
10 copyright notice and this permission notice appear in supporting
11 documentation, and that the name of Keith Packard not be used in
12 advertising or publicity pertaining to distribution of the software without
13 specific, written prior permission. Keith Packard makes no
14 representations about the suitability of this software for any purpose. It
15 is provided "as is" without express or implied warranty.
16
17 KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19 EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23 PERFORMANCE OF THIS SOFTWARE.
24 -->
25 <article>
26 <artheader>
27 <title>Fontconfig Users Guide</title>
28 <titleabbrev>Fontconfig</titleabbrev>
29 <author><firstname>Keith</><surname>Packard</></author>
30 <authorinitials>krp</authorinitials>
31 </artheader>
32 <sect1><title>NAME</title>
33 <para>
34 fontconfig - Font configuration and customization library
35 </para>
36 </sect1>
37 <sect1><title>DESCRIPTION</title>
38 <para>
39 Fontconfig is a library designed to provide system-wide font configuration,
40 customization and application access.
41 </para>
42 </sect1>
43 <sect1><title>FUNCTIONAL OVERVIEW</title>
44 <para>
45 Fontconfig contains two essential modules, the configuration module which
46 builds an internal configuration from XML files and the matching module
47 which accepts font patterns and returns the nearest matching font.
48 </para>
49 <sect2><title>FONT CONFIGURATION</title>
50 <para>
51 The configuration module consists of the FcConfig datatype, libexpat and
52 FcConfigParse which walks over an XML tree and ammends a configuration with
53 data found within. From an external perspective, configuration of the
54 library consists of generating a valid XML tree and feeding that to
55 FcConfigParse. The only other mechanism provided to applications for
56 changing the running configuration is to add fonts and directories to the
57 list of application-provided font files.
58 </para><para>
59 The intent is to make font configurations relatively static, and shared by
60 as many applications as possible. It is hoped that this will lead to more
61 stable font selection when passing names from one application to another.
62 XML was chosen as a configuration file format because it provides a format
63 which is easy for external agents to edit while retaining the correct
64 structure and syntax.
65 </para><para>
66 Font configuration is separate from font matching; applications needing to
67 do their own matching can access the available fonts from the library and
68 perform private matching. The intent is to permit applications to pick and
69 choose appropriate functionality from the library instead of forcing them to
70 choose between this library and a private configuration mechanism. The hope
71 is that this will ensure that configuration of fonts for all applications
72 can be centralized in one place. Centralizing font configuration will
73 simplify and regularize font installation and customization.
74 </para>
75 </sect2>
76 <sect2>
77 <title>FONT PROPERTIES</title>
78 <para>
79 While font patterns may contain essentially any properties, there are some
80 well known properties with associated types. Fontconfig uses some of these
81 properties for font matching and font completion. Others are provided as a
82 convenience for the applications rendering mechanism.
83 </para>
84 <table>
85 <title>Property Definitions</title>
86 <tgroup cols=3 align=left colsep=1 rowsep=1>
87 <colspec colname=Property>
88 <colspec colname=Type>
89 <colspec colname=Description>
90 <thead>
91 <row>
92 <entry>Property</entry>
93 <entry>Type</entry>
94 <entry>Description</entry>
95 </row>
96 </thead>
97 <tbody>
98 <row><entry>family</entry><entry>String</entry><entry>Font family name</entry></row>
99 <row><entry>style</entry><entry>String</entry><entry>Font style. Overrides weight and slant</entry></row>
100 <row><entry>slant</entry><entry>Int</entry><entry>Italic, oblique or roman</entry></row>
101 <row><entry>weight</entry><entry>Int</entry><entry>Light, medium, demibold, bold or black</entry></row>
102 <row><entry>size</entry><entry>Double</entry><entry>Point size</entry></row>
103 <row><entry>aspect</entry><entry>Double</entry><entry>Stretches glyphs horizontally before hinting</entry></row>
104 <row><entry>pixelsize</entry><entry>Double</entry><entry>Pixel size</entry></row>
105 <row><entry>spacing</entry><entry>Int</entry><entry>Proportional, monospace or charcell</entry></row>
106 <row><entry>foundry</entry><entry>String</entry><entry>Font foundry name</entry></row>
107 <row><entry>antialias</entry><entry>Bool</entry><entry>Whether glyphs can be antialiased</entry></row>
108 <row><entry>hinting</entry><entry>Bool</entry><entry>Whether the rasterizer should use hinting</entry></row>
109 <row><entry>verticallayout</entry><entry>Bool</entry><entry>Use vertical layout</entry></row>
110 <row><entry>autohint</entry><entry>Bool</entry><entry>Use autohinter instead of normal hinter</entry></row>
111 <row><entry>globaladvance</entry><entry>Bool</entry><entry>Use font global advance data</entry></row>
112 <row><entry>file</entry><entry>String</entry><entry>The filename holding the font</entry></row>
113 <row><entry>index</entry><entry>Int</entry><entry>The index of the font within the file</entry></row>
114 <row><entry>ftface</entry><entry>FT_Face</entry><entry>Use the specified FreeType face object</entry></row>
115 <row><entry>rasterizer</entry><entry>String</entry><entry>Which rasterizer is in use</entry></row>
116 <row><entry>outline</entry><entry>Bool</entry><entry>Whether the glyphs are outlines</entry></row>
117 <row><entry>scalable</entry><entry>Bool</entry><entry>Whether glyphs can be scaled</entry></row>
118 <row><entry>scale</entry><entry>Double</entry><entry>Scale factor for point->pixel conversions</entry></row>
119 <row><entry>dpi</entry><entry>Double</entry><entry>Target dots per inch</entry></row>
120 <row><entry>rgba</entry><entry>Int</entry><entry>unknown, rgb, bgr, vrgb, vbgr, none - subpixel geometry</entry></row>
121 <row><entry>minspace</entry><entry>Bool</entry><entry>Eliminate leading from line spacing</entry></row>
122 <row><entry>charset</entry><entry>CharSet</entry><entry>Unicode chars encoded by the font</entry></row>
123 <row><entry>lang</entry><entry>String</entry><entry>List of RFC-3066-style languages this font supports</entry></row>
124 </tbody>
125 </tgroup>
126 </table>
127 </sect2>
128 <sect2>
129 <title>FONT MATCHING</title>
130 <para>
131 Fontconfig performs matching by measuring the distance from a provided
132 pattern to all of the available fonts in the system. The closest matching
133 font is selected. This ensures that a font will always be returned, but
134 doesn't ensure that it is anything like the requested pattern.
135 </para><para>
136 Font matching starts with an application constructed pattern. The desired
137 attributes of the resulting font are collected together in a pattern. Each
138 property of the pattern can contain one or more values; these are listed in
139 priority order; matches earlier in the list are considered "closer" than
140 matches later in the list.
141 </para><para>
142 The initial pattern is modified by applying the list of editing instructions
143 specific to patterns found in the configuration; each consists of a match
144 predicate and a set of editing operations. They are executed in the order
145 they appeared in the configuration. Each match causes the associated
146 sequence of editing operations to be applied.
147 </para><para>
148 After the pattern has been edited, a sequence of default substitutions are
149 performed to canonicalize the set of available properties; this avoids the
150 need for the lower layers to constantly provide default values for various
151 font properties during rendering.
152 </para><para>
153 The canonical font pattern is finally matched against all available fonts.
154 The distance from the pattern to the font is measured for each of several
155 properties: foundry, charset, family, lang, spacing, pixelsize, style,
156 slant, weight, antialias, rasterizer and outline. This list is in priority
157 order -- results of comparing earlier elements of this list weigh more
158 heavily than later elements.
159 </para><para>
160 There is one special case to this rule; family names are split into two
161 bindings; strong and weak. Strong family names are given greater precedence
162 in the match than lang elements while weak family names are given lower
163 precedence than lang elements. This permits the document language to drive
164 font selection when any document specified font is unavailable.
165 </para><para>
166 The pattern representing that font is augmented to include any properties
167 found in the pattern but not found in the font itself; this permits the
168 application to pass rendering instructions or any other data through the
169 matching system. Finally, the list of editing instructions specific to
170 fonts found in the configuration are applied to the pattern. This modified
171 pattern is returned to the application.
172 </para><para>
173 The return value contains sufficient information to locate and rasterize the
174 font, including the file name, pixel size and other rendering data. As
175 none of the information involved pertains to the FreeType library,
176 applications are free to use any rasterization engine or even to take
177 the identified font file and access it directly.
178 </para><para>
179 The match/edit sequences in the configuration are performed in two passes
180 because there are essentially two different operations necessary -- the
181 first is to modify how fonts are selected; aliasing families and adding
182 suitable defaults. The second is to modify how the selected fonts are
183 rasterized. Those must apply to the selected font, not the original pattern
184 as false matches will often occur.
185 </para>
186 </sect2>
187 <sect2><title>FONT NAMES</title>
188 <para>
189 Fontconfig provides a textual representation for patterns that the library
190 can both accept and generate. The representation is in three parts, first a
191 list of family names, second a list of point sizes and finally a list of
192 additional properties:
193 </para>
194 <programlisting>
195 &lt;families&gt;-&lt;point sizes&gt;:&lt;name1&gt;=&lt;values1&gt;:&lt;name2&gt;=&lt;values2&gt;...
196 </programlisting>
197 <para>
198 Values in a list are separated with commas. The name needn't include either
199 families or point sizes; they can be elided. In addition, there are
200 symbolic constants that simultaneously indicate both a name and a value.
201 Here are some examples:
202 </para>
203 <table colsep=0 rowsep=0>
204 <title>Sample Font Names</title>
205 <tgroup cols=2 align=left colsep=0 rowsep=0>
206 <thead><row>
207 <entry>Name</entry>
208 <entry>Meaning</entry>
209 </row></thead>
210 <tbody>
211 <row><entry>Times-12</entry><entry>12 point Times Roman</entry></row>
212 <row><entry>Times-12:bold</entry><entry>12 point Times Bold</entry></row>
213 <row><entry>Courier:italic</entry><entry>Courier Italic in the default size</entry></row>
214 <row><entry>Monospace:matrix=1 .1 0 1</entry><entry>The users preferred monospace font
215 with artificial obliquing</entry></row>
216 </tbody>
217 </tgroup>
218 </table>
219 </sect2>
220 </sect1>
221 <sect1><title>LANG TAGS</title>
222 <para>
223 Each font in the database contains a list of languages it supports. This is
224 computed by comparing the Unicode coverage of the font with the orthography
225 of each language. Languages are tagged using an RFC-3066 compatible naming
226 and occur in two parts -- the ISO639 language tag followed a hyphen and then
227 by the ISO 3166 country code. The hyphen and country code may be elided.
228 </para><para>
229 Fontconfig has orthographies for several languages built into the library.
230 No provision has been made for adding new ones aside from rebuilding the
231 library. It currently supports 122 of the 139 languages named in ISO 639-1,
232 141 of the languages with two-letter codes from ISO 639-2 and another 30
233 languages with only three-letter codes.
234 </para>
235 </sect1>
236 <sect1><title>CONFIGURATION FILE FORMAT</title>
237 <para>
238 Configuration files for fontconfig are stored in XML format; this
239 format makes external configuration tools easier to write and ensures that
240 they will generate syntactically correct configuration files. As XML
241 files are plain text, they can also be manipulated by the expert user using
242 a text editor.
243 </para><para>
244 The fontconfig document type definition resides in the external entity
245 "fonts.dtd"; this is normally stored in the default font configuration
246 directory (/etc/fonts). Each configuration file should contain the
247 following structure:
248 <programlisting>
249 &lt;?xml version="1.0"?&gt;
250 &lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
251 &lt;fontconfig&gt;
252 ...
253 &lt;/fontconfig&gt;
254 </programlisting>
255 </para>
256 <sect2><title>&lt;fontconfig&gt;</title><para>
257 This is the top level element for a font configuration and can contain
258 &lt;dir&gt;, &lt;cache&gt;, &lt;include&gt;, &lt;match&gt; and &lt;alias&gt; elements in any order.
259 </para></sect2>
260 <sect2><title>&lt;dir&gt;</title><para>
261 This element contains a directory name which will be scanned for font files
262 to include in the set of available fonts.
263 </para></sect2>
264 <sect2><title>&lt;cache&gt;</title><para>
265 This element contains a file name for the per-user cache of font
266 information. If it starts with '~', it refers to a file in the users
267 home directory. This file is used to hold information about fonts that
268 isn't present in the per-directory cache files. It is automatically
269 maintained by the fontconfig library. The default for this file
270 is ``~/.fonts.cache-&lt;version&gt;'', where &lt;version&gt; is the font configuration
271 file version number (currently 1).
272 </para></sect2>
273 <sect2><title>&lt;include ignore_missing="no"&gt;</title><para>
274 This element contains the name of an additional configuration file. When
275 the XML datatype is traversed by FcConfigParse, the contents of the file
276 will also be incorporated into the configuration by passing the filename to
277 FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the
278 default "no", a missing file will elicit no warning message from the library.
279 </para></sect2>
280 <sect2><title>&lt;config&gt;</title><para>
281 This element provides a place to consolodate additional configuration
282 information. &lt;config&gt; can contain &lt;blank&gt; and &lt;rescan&gt; elements in any
283 order.
284 </para></sect2>
285 <sect2><title>&lt;blank&gt;</title><para>
286 Fonts often include "broken" glyphs which appear in the encoding but are
287 drawn as blanks on the screen. Within the &lt;blank&gt; element, place each
288 Unicode characters which is supposed to be blank in an &lt;int&gt; element.
289 Characters outside of this set which are drawn as blank will be elided from
290 the set of characters supported by the font.
291 </para></sect2>
292 <sect2><title>&lt;rescan&gt;</title><para>
293 The &lt;rescan&gt; element holds an &lt;int&gt; element which indicates the default
294 interval between automatic checks for font configuration changes.
295 Fontconfig will validate all of the configuration files and directories and
296 automatically rebuild the internal datastructures when this interval passes.
297 </para></sect2>
298 <sect2><title>&lt;match target="pattern"&gt;</title><para>
299 This element holds first a (possibly empty) list of &lt;test&gt; elements and then
300 a (possibly empty) list of &lt;edit&gt; elements. Patterns which match all of the
301 tests are subjected to all the edits. If 'target' is set to "font" instead
302 of the default "pattern", then this element applies to the font name
303 resulting from a match rather than a font pattern to be matched.
304 </para></sect2>
305 <sect2><title>&lt;test qual="any" name="property" compare="eq"&gt;</title><para>
306 This element contains a single value which is compared with the pattern
307 property "property" (substitute any of the property names seen
308 above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", or
309 "more_eq". 'qual' may either be the default, "any", in which case the match
310 succeeds if any value associated with the property matches the test value, or
311 "all", in which case all of the values associated with the property must
312 match the test value.
313 </para></sect2>
314 <sect2><title>&lt;edit name="property" mode="assign" binding="weak"&gt;</title><para>
315 This element contains a list of expression elements (any of the value or
316 operator elements). The expression elements are evaluated at run-time and
317 modify the property "property". The modification depends on whether
318 "property" was matched by one of the associated &lt;test&gt; elements, if so, the
319 modification may affect the first matched value. Any values inserted into
320 the property are given the indicated binding. 'mode' is one of:
321 <table>
322 <title>Edit Element Modes</title>
323 <tgroup cols=3 align=left colsep=0 rowsep=0>
324 <thead>
325 <row>
326 <entry>Mode</entry>
327 <entry>Operation With Match</entry>
328 <entry>Operation Without Match</entry>
329 </row>
330 </thead>
331 <tbody>
332 <row><entry>"assign"</entry><entry>Replace matching value</entry><entry>Replace all values</entry></row>
333 <row><entry>"assign_replace"</entry><entry>Replace all values</entry><entry>Replace all values</entry></row>
334 <row><entry>"prepend"</entry><entry>Insert before matching value</entry><entry>Insert at head of list</entry></row>
335 <row><entry>"prepend_first"</entry><entry>Insert at head of list</entry><entry>Insert at head of list</entry></row>
336 <row><entry>"append"</entry><entry>Append after matching value</entry><entry>Append at end of list</entry></row>
337 <row><entry>"append_last"</entry><entry>Append at end of list</entry><entry>Append at end of list</entry></row>
338 </tbody>
339 </tgroup>
340 </table>
341 </para></sect2>
342 <sect2><title>&lt;int&gt;, &lt;double&gt;, &lt;string&gt;, &lt;bool&gt;</title><para>
343 These elements hold a single value of the indicated type. &lt;bool&gt; elements
344 hold either true or false.
345 </para></sect2>
346 <sect2><title>&lt;matrix&gt;</title><para>
347 This element holds the four &lt;double&gt; elements of an affine
348 transformation.
349 </para></sect2>
350 <sect2><title>&lt;name&gt;</title><para>
351 Holds a property name. Evaluates to the first value from the property of
352 the font, not the pattern.
353 </para></sect2>
354 <sect2><title>&lt;const&gt;</title><para>
355 Holds the name of a constant; these are always integers and serve as
356 symbolic names for common font values:
357 <table>
358 <title>Symbolic Constants</title>
359 <tgroup cols=3 align=left colsep=0 rowsep=0>
360 <thead>
361 <row>
362 <entry>Constant</entry>
363 <entry>Property</entry>
364 <entry>CPP Symbol</entry>
365 </row>
366 </thead>
367 <tbody>
368 <row><entry>light</entry><entry>weight</entry></row>
369 <row><entry>medium</entry><entry>weight</entry></row>
370 <row><entry>demibold</entry><entry>weight</entry></row>
371 <row><entry>bold</entry><entry>weight</entry></row>
372 <row><entry>black</entry><entry>weight</entry></row>
373 <row><entry>roman</entry><entry>slant</entry></row>
374 <row><entry>italic</entry><entry>slant</entry></row>
375 <row><entry>oblique</entry><entry>slant</entry></row>
376 <row><entry>proportional</entry><entry>spacing</entry></row>
377 <row><entry>mono</entry><entry>spacing</entry></row>
378 <row><entry>charcell</entry><entry>spacing</entry></row>
379 <row><entry>unknown</entry><entry>rgba</entry></row>
380 <row><entry>rgb</entry><entry>rgba</entry></row>
381 <row><entry>bgr</entry><entry>rgba</entry></row>
382 <row><entry>vrgb</entry><entry>rgba</entry></row>
383 <row><entry>vbgr</entry><entry>rgba</entry></row>
384 <row><entry>none</entry><entry>rgba</entry></row>
385 </tbody>
386 </tgroup>
387 </table>
388 </para>
389 </sect2>
390 <sect2><title>&lt;or&gt;,
391 &lt;and&gt;,
392 &lt;plus&gt;,
393 &lt;minus&gt;,
394 &lt;times&gt;,
395 &lt;divide&gt;</title><para>
396 These elements perform the specified operation on a list of expression
397 elements. &lt;or&gt; and &lt;and&gt; are boolean, not bitwise.
398 </para>
399 </sect2>
400 <sect2><title>&lt;eq&gt;,
401 &lt;not_eq&gt;,
402 &lt;less&gt;,
403 &lt;less_eq&gt;,
404 &lt;more&gt;,
405 &lt;more_eq&gt;</title><para>
406 These elements compare two values, producing a boolean result.
407 </para></sect2>
408 <sect2><title>&lt;not&gt;</title><para>
409 Inverts the boolean sense of its one expression element
410 </para></sect2>
411 <sect2><title>&lt;if&gt;</title><para>
412 This element takes three expression elements; if the value of the first is
413 true, it produces the value of the second, otherwise it produces the value
414 of the third.
415 </para></sect2>
416 <sect2><title>&lt;alias&gt;</title><para>
417 Alias elements provide a shorthand notation for the set of common match
418 operations needed to substitute one font family for another. They contain a
419 &lt;family&gt; element followed by optional &lt;prefer&gt;, &lt;accept&gt; and &lt;default&gt;
420 elements. Fonts matching the &lt;family&gt; element are edited to prepend the
421 list of &lt;prefer&gt;ed families before the matching &lt;family&gt;, append the
422 &lt;accept&gt;able familys after the matching &lt;family&gt; and append the &lt;default&gt;
423 families to the end of the family list.
424 </para></sect2>
425 <sect2><title>&lt;family&gt;</title><para>
426 Holds a single font family name
427 </para></sect2>
428 <sect2><title>&lt;prefer&gt;, &lt;accept&gt;, &lt;default&gt;</title><para>
429 These hold a list of &lt;family&gt; elements to be used by the &lt;alias&gt; element.
430 &lt;/article&gt;
431 </para></sect2>
432 </sect1>
433 <sect1><title>EXAMPLE CONFIGURATION FILE</title>
434 <sect2><title>System configuration file</title>
435 <para>
436 This is an example of a system-wide configuration file
437 </para>
438 <programlisting>
439 &lt;?xml version="1.0"?&gt;
440 &lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
441 &lt;!-- /etc/fonts/fonts.conf file to configure system font access --&gt;
442 &lt;fontconfig&gt;
443 &lt;!--
444 Find fonts in these directories
445 --&gt;
446 &lt;dir&gt;/usr/X11R6/lib/X11/fonts/truetype&lt;/dir&gt;
447 &lt;dir&gt;/usr/X11R6/lib/X11/fonts/Type1&lt;/dir&gt;
448
449 &lt;!--
450 Accept deprecated 'mono' alias, replacing it with 'monospace'
451 --&gt;
452 &lt;match target="pattern"&gt;
453 &lt;test qual="any" name="family"&gt;&lt;string&gt;mono&lt;/string&gt;&lt;/test&gt;
454 &lt;edit name="family" mode="assign"&gt;&lt;string&gt;monospace&lt;/string&gt;&lt;/edit&gt;
455 &lt;/match&gt;
456
457 &lt;!--
458 Names not including any well known alias are given 'sans'
459 --&gt;
460 &lt;match target="pattern"&gt;
461 &lt;test qual="all" name="family" mode="not_eq"&gt;sans&lt;/test&gt;
462 &lt;test qual="all" name="family" mode="not_eq"&gt;serif&lt;/test&gt;
463 &lt;test qual="all" name="family" mode="not_eq"&gt;monospace&lt;/test&gt;
464 &lt;edit name="family" mode="append_last"&gt;&lt;string&gt;sans&lt;/string&gt;&lt;/edit&gt;
465 &lt;/match&gt;
466
467 &lt;!--
468 Load per-user customization file, but don't complain
469 if it doesn't exist
470 --&gt;
471 &lt;include ignore_missing="yes"&gt;~/.fonts.conf&lt;/include&gt;
472
473 &lt;!--
474 Alias well known font names to available TrueType fonts.
475 These substitute TrueType faces for similar Type1
476 faces to improve screen appearance.
477 --&gt;
478 &lt;alias&gt;
479 &lt;family&gt;Times&lt;/family&gt;
480 &lt;prefer&gt;&lt;family&gt;Times New Roman&lt;/family&gt;&lt;/prefer&gt;
481 &lt;default&gt;&lt;family&gt;serif&lt;/family&gt;&lt;/default&gt;
482 &lt;/alias&gt;
483 &lt;alias&gt;
484 &lt;family&gt;Helvetica&lt;/family&gt;
485 &lt;prefer&gt;&lt;family&gt;Verdana&lt;/family&gt;&lt;/prefer&gt;
486 &lt;default&gt;&lt;family&gt;sans&lt;/family&gt;&lt;/default&gt;
487 &lt;/alias&gt;
488 &lt;alias&gt;
489 &lt;family&gt;Courier&lt;/family&gt;
490 &lt;prefer&gt;&lt;family&gt;Courier New&lt;/family&gt;&lt;/prefer&gt;
491 &lt;default&gt;&lt;family&gt;monospace&lt;/family&gt;&lt;/default&gt;
492 &lt;/alias&gt;
493
494 &lt;!--
495 Provide required aliases for standard names
496 Do these after the users configuration file so that
497 any aliases there are used preferentially
498 --&gt;
499 &lt;alias&gt;
500 &lt;family&gt;serif&lt;/family&gt;
501 &lt;prefer&gt;&lt;family&gt;Times New Roman&lt;/family&gt;&lt;/prefer&gt;
502 &lt;/alias&gt;
503 &lt;alias&gt;
504 &lt;family&gt;sans&lt;/family&gt;
505 &lt;prefer&gt;&lt;family&gt;Verdana&lt;/family&gt;&lt;/prefer&gt;
506 &lt;/alias&gt;
507 &lt;alias&gt;
508 &lt;family&gt;monospace&lt;/family&gt;
509 &lt;prefer&gt;&lt;family&gt;Andale Mono&lt;/family&gt;&lt;/prefer&gt;
510 &lt;/alias&gt;
511 &lt;/fontconfig&gt;
512 </programlisting>
513 </sect2>
514 <sect2><title>User configuration file</title>
515 <para>
516 This is an example of a per-user configuration file that lives in
517 ~/.fonts.conf
518 </para>
519 <programlisting>
520 &lt;?xml version="1.0"?&gt;
521 &lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
522 &lt;!-- ~/.fonts.conf for per-user font configuration --&gt;
523 &lt;fontconfig&gt;
524
525 &lt;!--
526 Private font directory
527 --&gt;
528 &lt;dir&gt;~/misc/fonts&lt;/dir&gt;
529
530 &lt;!--
531 use rgb sub-pixel ordering to improve glyph appearance on
532 LCD screens. Changes affecting rendering, but not matching
533 should always use target="font".
534 --&gt;
535 &lt;match target="font"&gt;
536 &lt;edit name="rgba" mode="assign"&gt;&lt;const&gt;rgb&lt;/const&gt;&lt;/edit&gt;
537 &lt;/match&gt;
538 &lt;/fontconfig&gt;
539 </programlisting>
540 </sect2>
541 </sect1>
542 <sect1><title>FILES</title>
543 <para>
544 <emphasis>fonts.conf</emphasis>
545 contains configuration information for the fontconfig library
546 consisting of directories to look at for font information as well as
547 instructions on editing program specified font patterns before attempting to
548 match the available fonts. It is in xml format.
549 </para>
550 <para>
551 <emphasis>fonts.dtd</emphasis>
552 is a DTD that describes the format of the configuration files.
553 </para>
554 <para>
555 <emphasis>~/.fonts.conf</emphasis>
556 is the conventional location for per-user font configuration, although the
557 actual location is specified in the global fonts.conf file.
558 </para>
559 <para>
560 <emphasis> ~/.fonts.cache-*</emphasis>
561 is the conventional repository of font information that isn't found in the
562 per-directory caches. This file is automatically maintained by fontconfig.
563 </para>
564 </sect1>
565 </article>