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