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