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