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