]> git.wh0rd.org - fontconfig.git/blob - doc/fontconfig-user.sgml
Document FC_DEBUG values (bug 6393). Document name \ escape syntax.
[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 <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>
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><sgmltag>cache</></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-<sgmltag>version</>'', where <sgmltag>version</> is the font configuration
311 file version number (currently 2).
312 </para></refsect2>
313 <refsect2><title><sgmltag>include ignore_missing="no"</></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><sgmltag>config</></title><para>
324 This element provides a place to consolidate additional configuration
325 information. <sgmltag>config</> can contain <sgmltag>blank</> and <sgmltag>rescan</> elements in any
326 order.
327 </para></refsect2>
328 <refsect2><title><sgmltag>blank</></title><para>
329 Fonts often include "broken" glyphs which appear in the encoding but are
330 drawn as blanks on the screen. Within the <sgmltag>blank</> element, place each
331 Unicode characters which is supposed to be blank in an <sgmltag>int</> 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><sgmltag>rescan</></title><para>
336 The <sgmltag>rescan</> element holds an <sgmltag>int</> 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><sgmltag>selectfont</></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><sgmltag>acceptfont</></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><sgmltag>rejectfont</></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><sgmltag>glob</></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><sgmltag>pattern</></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><sgmltag>patelt name="property"</></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><sgmltag>match target="pattern"</></title><para>
381 This element holds first a (possibly empty) list of <sgmltag>test</> elements and then
382 a (possibly empty) list of <sgmltag>edit</> 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.
386 </para></refsect2>
387 <refsect2><title><sgmltag>test qual="any" name="property" target="default" compare="eq"</></title><para>
388 This 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
390 above). '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
392 succeeds 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
394 match the test value. When used in a &lt;match target="font"&gt; element,
395 the target= attribute in the &lt;test&gt; element selects between matching
396 the original pattern or the font. "default" selects whichever target the
397 outer &lt;match&gt; element has selected.
398 </para></refsect2>
399 <refsect2><title><sgmltag>edit name="property" mode="assign" binding="weak"</></title><para>
400 This element contains a list of expression elements (any of the value or
401 operator elements). The expression elements are evaluated at run-time and
402 modify the property "property". The modification depends on whether
403 "property" was matched by one of the associated <sgmltag>test</> elements, if so, the
404 modification may affect the first matched value. Any values inserted into
405 the property are given the indicated binding ("strong", "weak" or "same")
406 with "same" binding using the value from the matched pattern element.
407 'mode' is one of:
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>
420 These elements hold a single value of the indicated type. <sgmltag>bool</>
421 elements hold either true or false. An important limitation exists in
422 the parsing of floating point numbers -- fontconfig requires that
423 the mantissa start with a digit, not a decimal point, so insert a leading
424 zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5
425 instead of -.5).
426 </para></refsect2>
427 <refsect2><title><sgmltag>matrix</></title><para>
428 This element holds the four <sgmltag>double</> elements of an affine
429 transformation.
430 </para></refsect2>
431 <refsect2><title><sgmltag>name</></title><para>
432 Holds a property name. Evaluates to the first value from the property of
433 the font, not the pattern.
434 </para></refsect2>
435 <refsect2><title><sgmltag>const</></title><para>
436 Holds the name of a constant; these are always integers and serve as
437 symbolic names for common font values:
438 <programlisting>
439 Constant Property Value
440 -------------------------------------
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
448 medium weight 100
449 demibold weight 180
450 semibold weight 180
451 bold weight 200
452 extrabold weight 205
453 black weight 210
454 heavy weight 210
455 roman slant 0
456 italic slant 100
457 oblique slant 110
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
467 proportional spacing 0
468 dual spacing 90
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
477 hintnone hintstyle 0
478 hintslight hintstyle 1
479 hintmedium hintstyle 2
480 hintfull hintstyle 3
481 </programlisting>
482 </para>
483 </refsect2>
484 <refsect2>
485 <title><sgmltag>or</>, <sgmltag>and</>, <sgmltag>plus</>, <sgmltag>minus</>, <sgmltag>times</>, <sgmltag>divide</></title>
486 <para>
487 These elements perform the specified operation on a list of expression
488 elements. <sgmltag>or</> and <sgmltag>and</> are boolean, not bitwise.
489 </para>
490 </refsect2>
491 <refsect2>
492 <title><sgmltag>eq</>, <sgmltag>not_eq</>, <sgmltag>less</>, <sgmltag>less_eq</>, <sgmltag>more</>, <sgmltag>more_eq</></title>
493 <para>
494 These elements compare two values, producing a boolean result.
495 </para></refsect2>
496 <refsect2><title><sgmltag>not</></title><para>
497 Inverts the boolean sense of its one expression element
498 </para></refsect2>
499 <refsect2><title><sgmltag>if</></title><para>
500 This element takes three expression elements; if the value of the first is
501 true, it produces the value of the second, otherwise it produces the value
502 of the third.
503 </para></refsect2>
504 <refsect2><title><sgmltag>alias</></title><para>
505 Alias elements provide a shorthand notation for the set of common match
506 operations needed to substitute one font family for another. They contain a
507 <sgmltag>family</> element followed by optional <sgmltag>prefer</>, <sgmltag>accept</> and <sgmltag>default</>
508 elements. Fonts matching the <sgmltag>family</> element are edited to prepend the
509 list of <sgmltag>prefer</>ed families before the matching <sgmltag>family</>, append the
510 <sgmltag>accept</>able families after the matching <sgmltag>family</> and append the <sgmltag>default</>
511 families to the end of the family list.
512 </para></refsect2>
513 <refsect2><title><sgmltag>family</></title><para>
514 Holds a single font family name
515 </para></refsect2>
516 <refsect2><title><sgmltag>prefer</>, <sgmltag>accept</>, <sgmltag>default</></title><para>
517 These 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>
523 <para>
524 This 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;
529 &lt;!-- &confdir;/fonts.conf file to configure system font access --&gt;
530 &lt;fontconfig&gt;
531 &lt;!--
532 Find fonts in these directories
533 --&gt;
534 &lt;dir&gt;/usr/share/fonts&lt;/dir&gt;
535 &lt;dir&gt;/usr/X11R6/lib/X11/fonts&lt;/dir&gt;
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
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
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;
580 &lt;prefer&gt;&lt;family&gt;Arial&lt;/family&gt;&lt;/prefer&gt;
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;
600 &lt;prefer&gt;&lt;family&gt;Arial&lt;/family&gt;&lt;/prefer&gt;
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>
608 </refsect2>
609 <refsect2><title>User configuration file</title>
610 <para>
611 This 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;
623 &lt;dir&gt;~/.fonts&lt;/dir&gt;
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>
635 </refsect2>
636 </refsect1>
637 <refsect1><title>Files</title>
638 <para>
639 <emphasis>fonts.conf</emphasis>
640 contains configuration information for the fontconfig library
641 consisting of directories to look at for font information as well as
642 instructions on editing program specified font patterns before attempting to
643 match the available fonts. It is in xml format.
644 </para>
645 <para>
646 <emphasis>conf.d</emphasis>
647 is the conventional name for a directory of additional configuration files
648 managed by external applications or the local administrator. The
649 filenames starting with decimal digits are sorted in lexicographic order
650 and used as additional configuration files. All of these files are in xml
651 format. The master fonts.conf file references this directory in an
652 &lt;include&gt; directive.
653 </para>
654 <para>
655 <emphasis>fonts.dtd</emphasis>
656 is a DTD that describes the format of the configuration files.
657 </para>
658 <para>
659 <emphasis>~/.fonts.conf</emphasis>
660 is the conventional location for per-user font configuration, although the
661 actual location is specified in the global fonts.conf file.
662 </para>
663 <para>
664 <emphasis> ~/.fonts.cache-*</emphasis>
665 is the conventional repository of font information that isn't found in the
666 per-directory caches. This file is automatically maintained by fontconfig.
667 </para>
668 </refsect1>
669 <refsect1><title>See Also</title>
670 <para>
671 fc-cache(1), fc-match(1), fc-list(1)
672 </para>
673 </refsect1>
674 <refsect1><title>Version</title>
675 <para>
676 Fontconfig version &version;
677 </para>
678 </refsect1>
679 </refentry>