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