1 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
2 <!ENTITY version SYSTEM "version.sgml">
3 <!ENTITY confdir SYSTEM "confdir.sgml">
6 Copyright © 2003 Keith Packard
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.
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.
28 <refentrytitle>fonts-conf</refentrytitle>
29 <manvolnum>5</manvolnum>
32 <refname>fonts.conf</refname>
33 <refpurpose>Font configuration files</refpurpose>
40 $XDG_CONFIG_HOME/fontconfig/conf.d
41 $XDG_CONFIG_HOME/fontconfig/fonts.conf
46 <refsect1><title>Description</title>
48 Fontconfig is a library designed to provide system-wide font configuration,
49 customization and application access.
52 <refsect1><title>Functional Overview</title>
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.
58 <refsect2><title>Font Configuration</title>
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.
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
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.
86 <title>Font Properties</title>
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.
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 color Bool Whether any glyphs have color
123 scale Double Scale factor for point->pixel conversions (deprecated)
124 dpi Double Target dots per inch
125 rgba Int unknown, rgb, bgr, vrgb, vbgr,
126 none - subpixel geometry
127 lcdfilter Int Type of LCD filter
128 minspace Bool Eliminate leading from line spacing
129 charset CharSet Unicode chars encoded by the font
130 lang String List of RFC-3066-style languages this
132 fontversion Int Version number of the font
133 capability String List of layout capabilities in the font
134 fontformat String String name of the font format
135 embolden Bool Rasterizer should synthetically embolden the font
136 embeddedbitmap Bool Use the embedded bitmap instead of the outline
137 decorative Bool Whether the style is a decorative variant
138 fontfeatures String List of the feature tags in OpenType to be enabled
139 namelang String Language name to be used for the default value of
140 familylang, stylelang, and fullnamelang
141 prgname String String Name of the running program
142 postscriptname String Font family name in PostScript
146 <title>Font Matching</title>
148 Fontconfig performs matching by measuring the distance from a provided
149 pattern to all of the available fonts in the system. The closest matching
150 font is selected. This ensures that a font will always be returned, but
151 doesn't ensure that it is anything like the requested pattern.
153 Font matching starts with an application constructed pattern. The desired
154 attributes of the resulting font are collected together in a pattern. Each
155 property of the pattern can contain one or more values; these are listed in
156 priority order; matches earlier in the list are considered "closer" than
157 matches later in the list.
159 The initial pattern is modified by applying the list of editing instructions
160 specific to patterns found in the configuration; each consists of a match
161 predicate and a set of editing operations. They are executed in the order
162 they appeared in the configuration. Each match causes the associated
163 sequence of editing operations to be applied.
165 After the pattern has been edited, a sequence of default substitutions are
166 performed to canonicalize the set of available properties; this avoids the
167 need for the lower layers to constantly provide default values for various
168 font properties during rendering.
170 The canonical font pattern is finally matched against all available fonts.
171 The distance from the pattern to the font is measured for each of several
172 properties: foundry, charset, family, lang, spacing, pixelsize, style,
173 slant, weight, antialias, rasterizer and outline. This list is in priority
174 order -- results of comparing earlier elements of this list weigh more
175 heavily than later elements.
177 There is one special case to this rule; family names are split into two
178 bindings; strong and weak. Strong family names are given greater precedence
179 in the match than lang elements while weak family names are given lower
180 precedence than lang elements. This permits the document language to drive
181 font selection when any document specified font is unavailable.
183 The pattern representing that font is augmented to include any properties
184 found in the pattern but not found in the font itself; this permits the
185 application to pass rendering instructions or any other data through the
186 matching system. Finally, the list of editing instructions specific to
187 fonts found in the configuration are applied to the pattern. This modified
188 pattern is returned to the application.
190 The return value contains sufficient information to locate and rasterize the
191 font, including the file name, pixel size and other rendering data. As
192 none of the information involved pertains to the FreeType library,
193 applications are free to use any rasterization engine or even to take
194 the identified font file and access it directly.
196 The match/edit sequences in the configuration are performed in two passes
197 because there are essentially two different operations necessary -- the
198 first is to modify how fonts are selected; aliasing families and adding
199 suitable defaults. The second is to modify how the selected fonts are
200 rasterized. Those must apply to the selected font, not the original pattern
201 as false matches will often occur.
204 <refsect2><title>Font Names</title>
206 Fontconfig provides a textual representation for patterns that the library
207 can both accept and generate. The representation is in three parts, first a
208 list of family names, second a list of point sizes and finally a list of
209 additional properties:
212 <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...
215 Values in a list are separated with commas. The name needn't include either
216 families or point sizes; they can be elided. In addition, there are
217 symbolic constants that simultaneously indicate both a name and a value.
218 Here are some examples:
222 ----------------------------------------------------------
223 Times-12 12 point Times Roman
224 Times-12:bold 12 point Times Bold
225 Courier:italic Courier Italic in the default size
226 Monospace:matrix=1 .1 0 1 The users preferred monospace font
227 with artificial obliquing
230 The '\', '-', ':' and ',' characters in family names must be preceded by a
231 '\' character to avoid having them misinterpreted. Similarly, values
232 containing '\', '=', '_', ':' and ',' must also have them preceded by a
233 '\' character. The '\' characters are stripped out of the family name and
234 values as the font name is read.
238 <refsect1 id="debug"><title>Debugging Applications</title>
240 To help diagnose font and applications problems, fontconfig is built with a
241 large amount of internal debugging left enabled. It is controlled by means
242 of the FC_DEBUG environment variable. The value of this variable is
243 interpreted as a number, and each bit within that value controls different
248 ---------------------------------------------------------
249 MATCH 1 Brief information about font matching
250 MATCHV 2 Extensive font matching information
251 EDIT 4 Monitor match/test/edit execution
252 FONTSET 8 Track loading of font information at startup
253 CACHE 16 Watch cache files being written
254 CACHEV 32 Extensive cache file writing information
255 PARSE 64 (no longer in use)
256 SCAN 128 Watch font files being scanned to build caches
257 SCANV 256 Verbose font file scanning information
258 MEMORY 512 Monitor fontconfig memory usage
259 CONFIG 1024 Monitor which config files are loaded
260 LANGSET 2048 Dump char sets used to construct lang values
261 MATCH2 4096 Display font-matching transformation in patterns
264 Add the value of the desired debug levels together and assign that (in
265 base 10) to the FC_DEBUG environment variable before running the
266 application. Output from these statements is sent to stdout.
269 <refsect1><title>Lang Tags</title>
271 Each font in the database contains a list of languages it supports. This is
272 computed by comparing the Unicode coverage of the font with the orthography
273 of each language. Languages are tagged using an RFC-3066 compatible naming
274 and occur in two parts -- the ISO 639 language tag followed a hyphen and then
275 by the ISO 3166 country code. The hyphen and country code may be elided.
277 Fontconfig has orthographies for several languages built into the library.
278 No provision has been made for adding new ones aside from rebuilding the
279 library. It currently supports 122 of the 139 languages named in ISO 639-1,
280 141 of the languages with two-letter codes from ISO 639-2 and another 30
281 languages with only three-letter codes. Languages with both two and three
282 letter codes are provided with only the two letter code.
284 For languages used in multiple territories with radically different
285 character sets, fontconfig includes per-territory orthographies. This
286 includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
289 <refsect1><title>Configuration File Format</title>
291 Configuration files for fontconfig are stored in XML format; this
292 format makes external configuration tools easier to write and ensures that
293 they will generate syntactically correct configuration files. As XML
294 files are plain text, they can also be manipulated by the expert user using
297 The fontconfig document type definition resides in the external entity
298 "fonts.dtd"; this is normally stored in the default font configuration
299 directory (&confdir;). Each configuration file should contain the
302 <?xml version="1.0"?>
303 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
309 <refsect2><title><literal><fontconfig></literal></title><para>
310 This is the top level element for a font configuration and can contain
311 <literal><dir></literal>, <literal><cachedir></literal>, <literal><include></literal>, <literal><match></literal> and <literal><alias></literal> elements in any order.
313 <refsect2><title><literal><dir prefix="default"></literal></title><para>
314 This element contains a directory name which will be scanned for font files
315 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.
317 <refsect2><title><literal><cachedir prefix="default"></literal></title><para>
318 This element contains a directory name that is supposed to be stored or read
319 the cache of font information. If multiple elements are specified in
320 the configuration file, the directory that can be accessed first in the list
321 will be used to store the cache files. If it starts with '~', it refers to
322 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.
323 The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
324 named ``<literal><hash value></literal>-<literal><architecture></literal>.cache-<literal><version></literal>'',
325 where <literal><version></literal> is the fontconfig cache file
326 version number (currently 7).
328 <refsect2><title><literal><include ignore_missing="no" prefix="default"></literal></title><para>
329 This element contains the name of an additional configuration file or
330 directory. If a directory, every file within that directory starting with an
331 ASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be processed in sorted order. When
332 the XML datatype is traversed by FcConfigParse, the contents of the file(s)
333 will also be incorporated into the configuration by passing the filename(s) to
334 FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the
335 default "no", a missing file or directory will elicit no warning message from
336 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.
338 <refsect2><title><literal><config></literal></title><para>
339 This element provides a place to consolidate additional configuration
340 information. <literal><config></literal> can contain <literal><blank></literal> and <literal><rescan></literal> elements in any
343 <refsect2><title><literal><blank></literal></title><para>
344 Fonts often include "broken" glyphs which appear in the encoding but are
345 drawn as blanks on the screen. Within the <literal><blank></literal> element, place each
346 Unicode characters which is supposed to be blank in an <literal><int></literal> element.
347 Characters outside of this set which are drawn as blank will be elided from
348 the set of characters supported by the font.
350 <refsect2><title><literal><rescan></literal></title><para>
351 The <literal><rescan></literal> element holds an <literal><int></literal> element which indicates the default
352 interval between automatic checks for font configuration changes.
353 Fontconfig will validate all of the configuration files and directories and
354 automatically rebuild the internal datastructures when this interval passes.
356 <refsect2><title><literal><selectfont></literal></title><para>
357 This element is used to black/white list fonts from being listed or matched
358 against. It holds acceptfont and rejectfont elements.
360 <refsect2><title><literal><acceptfont></literal></title><para>
361 Fonts matched by an acceptfont element are "whitelisted"; such fonts are
362 explicitly included in the set of fonts used to resolve list and match
363 requests; including them in this list protects them from being "blacklisted"
364 by a rejectfont element. Acceptfont elements include glob and pattern
365 elements which are used to match fonts.
367 <refsect2><title><literal><rejectfont></literal></title><para>
368 Fonts matched by an rejectfont element are "blacklisted"; such fonts are
369 excluded from the set of fonts used to resolve list and match requests as if
370 they didn't exist in the system. Rejectfont elements include glob and
371 pattern elements which are used to match fonts.
373 <refsect2><title><literal><glob></literal></title><para>
374 Glob elements hold shell-style filename matching patterns (including ? and
375 *) which match fonts based on their complete pathnames. This can be used to
376 exclude a set of directories (/usr/share/fonts/uglyfont*), or particular
377 font file types (*.pcf.gz), but the latter mechanism relies rather heavily
378 on filenaming conventions which can't be relied upon. Note that globs
379 only apply to directories, not to individual fonts.
381 <refsect2><title><literal><pattern></literal></title><para>
382 Pattern elements perform list-style matching on incoming fonts; that is,
383 they hold a list of elements and associated values. If all of those
384 elements have a matching value, then the pattern matches the font. This can
385 be used to select fonts based on attributes of the font (scalable, bold,
386 etc), which is a more reliable mechanism than using file extensions.
387 Pattern elements include patelt elements.
389 <refsect2><title><literal><patelt name="property"></literal></title><para>
390 Patelt elements hold a single pattern element and list of values. They must
391 have a 'name' attribute which indicates the pattern element name. Patelt
392 elements include int, double, string, matrix, bool, charset and const
395 <refsect2><title><literal><match target="pattern"></literal></title><para>
396 This element holds first a (possibly empty) list of <literal><test></literal> elements and then
397 a (possibly empty) list of <literal><edit></literal> elements. Patterns which match all of the
398 tests are subjected to all the edits. If 'target' is set to "font" instead
399 of the default "pattern", then this element applies to the font name
400 resulting from a match rather than a font pattern to be matched. If 'target'
401 is set to "scan", then this element applies when the font is scanned to
402 build the fontconfig database.
404 <refsect2><title><literal><test qual="any" name="property" target="default" compare="eq"></literal></title><para>
405 This element contains a single value which is compared with the target
406 ('pattern', 'font', 'scan' or 'default') property "property" (substitute any of the property names seen
407 above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", "more_eq", "contains" or
408 "not_contains". 'qual' may either be the default, "any", in which case the match
409 succeeds if any value associated with the property matches the test value, or
410 "all", in which case all of the values associated with the property must
411 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".
412 When used in a <match target="font"> element,
413 the target= attribute in the <test> element selects between matching
414 the original pattern or the font. "default" selects whichever target the
415 outer <match> element has selected.
417 <refsect2><title><literal><edit name="property" mode="assign" binding="weak"></literal></title><para>
418 This element contains a list of expression elements (any of the value or
419 operator elements). The expression elements are evaluated at run-time and
420 modify the property "property". The modification depends on whether
421 "property" was matched by one of the associated <literal><test></literal> elements, if so, the
422 modification may affect the first matched value. Any values inserted into
423 the property are given the indicated binding ("strong", "weak" or "same")
424 with "same" binding using the value from the matched pattern element.
427 Mode With Match Without Match
428 ---------------------------------------------------------------------
429 "assign" Replace matching value Replace all values
430 "assign_replace" Replace all values Replace all values
431 "prepend" Insert before matching Insert at head of list
432 "prepend_first" Insert at head of list Insert at head of list
433 "append" Append after matching Append at end of list
434 "append_last" Append at end of list Append at end of list
435 "delete" Delete matching value Delete all values
436 "delete_all" Delete all values Delete all values
439 <refsect2><title><literal><int></literal>, <literal><double></literal>, <literal><string></literal>, <literal><bool></literal></title><para>
440 These elements hold a single value of the indicated type. <literal><bool></literal>
441 elements hold either true or false. An important limitation exists in
442 the parsing of floating point numbers -- fontconfig requires that
443 the mantissa start with a digit, not a decimal point, so insert a leading
444 zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5
447 <refsect2><title><literal><matrix></literal></title><para>
448 This element holds four numerical expressions of an affine transformation.
449 At their simplest these will be four <literal><double></literal> elements
450 but they can also be more involved expressions.
452 <refsect2><title><literal><range></literal></title><para>
453 This element holds the two <literal><int></literal> elements of a range
456 <refsect2><title><literal><charset></literal></title><para>
457 This element holds at least one <literal><int></literal> element of
458 an Unicode code point or more.
460 <refsect2><title><literal><langset></literal></title><para>
461 This element holds at least one <literal><string></literal> element of
462 a RFC-3066-style languages or more.
464 <refsect2><title><literal><name></literal></title><para>
465 Holds a property name. Evaluates to the first value from the property of
466 the pattern. If the 'target' attribute is not present, it will default to
467 'default', in which case the property is returned from the font pattern
468 during a target="font" match, and to the pattern during a target="pattern"
469 match. The attribute can also take the values 'font' or 'pattern' to
470 explicitly choose which pattern to use. It is an error to use a target
471 of 'font' in a match that has target="pattern".
473 <refsect2><title><literal><const></literal></title><para>
474 Holds the name of a constant; these are always integers and serve as
475 symbolic names for common font values:
477 Constant Property Value
478 -------------------------------------
498 ultracondensed width 50
499 extracondensed width 63
501 semicondensed width 87
503 semiexpanded width 113
505 extraexpanded width 150
506 ultraexpanded width 200
507 proportional spacing 0
518 lcddefault lcdfilter 1
520 lcdlegacy lcdfilter 3
522 hintslight hintstyle 1
523 hintmedium hintstyle 2
529 <title><literal><or></literal>, <literal><and></literal>, <literal><plus></literal>, <literal><minus></literal>, <literal><times></literal>, <literal><divide></literal></title>
531 These elements perform the specified operation on a list of expression
532 elements. <literal><or></literal> and <literal><and></literal> are boolean, not bitwise.
536 <title><literal><eq></literal>, <literal><not_eq></literal>, <literal><less></literal>, <literal><less_eq></literal>, <literal><more></literal>, <literal><more_eq></literal>, <literal><contains></literal>, <literal><not_contains</literal></title>
538 These elements compare two values, producing a boolean result.
540 <refsect2><title><literal><not></literal></title><para>
541 Inverts the boolean sense of its one expression element
543 <refsect2><title><literal><if></literal></title><para>
544 This element takes three expression elements; if the value of the first is
545 true, it produces the value of the second, otherwise it produces the value
548 <refsect2><title><literal><alias></literal></title><para>
549 Alias elements provide a shorthand notation for the set of common match
550 operations needed to substitute one font family for another. They contain a
551 <literal><family></literal> element followed by optional <literal><prefer></literal>, <literal><accept></literal> and <literal><default></literal>
552 elements. Fonts matching the <literal><family></literal> element are edited to prepend the
553 list of <literal><prefer></literal>ed families before the matching <literal><family></literal>, append the
554 <literal><accept></literal>able families after the matching <literal><family></literal> and append the <literal><default></literal>
555 families to the end of the family list.
557 <refsect2><title><literal><family></literal></title><para>
558 Holds a single font family name
560 <refsect2><title><literal><prefer></literal>, <literal><accept></literal>, <literal><default></literal></title><para>
561 These hold a list of <literal><family></literal> elements to be used by the <literal><alias></literal> element.
564 <refsect1><title>EXAMPLE CONFIGURATION FILE</title>
565 <refsect2><title>System configuration file</title>
567 This is an example of a system-wide configuration file
570 <?xml version="1.0"?>
571 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
572 <!-- &confdir;/fonts.conf file to configure system font access -->
575 Find fonts in these directories
577 <dir>/usr/share/fonts</dir>
578 <dir>/usr/X11R6/lib/X11/fonts</dir>
581 Accept deprecated 'mono' alias, replacing it with 'monospace'
583 <match target="pattern">
584 <test qual="any" name="family"><string>mono</string></test>
585 <edit name="family" mode="assign"><string>monospace</string></edit>
589 Names not including any well known alias are given 'sans-serif'
591 <match target="pattern">
592 <test qual="all" name="family" mode="not_eq"><string>sans-serif</string></test>
593 <test qual="all" name="family" mode="not_eq"><string>serif</string></test>
594 <test qual="all" name="family" mode="not_eq"><string>monospace</string></test>
595 <edit name="family" mode="append_last"><string>sans-serif</string></edit>
599 Load per-user customization file, but don't complain
602 <include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</include>
605 Load local customization files, but don't complain
608 <include ignore_missing="yes">conf.d</include>
609 <include ignore_missing="yes">local.conf</include>
612 Alias well known font names to available TrueType fonts.
613 These substitute TrueType faces for similar Type1
614 faces to improve screen appearance.
617 <family>Times</family>
618 <prefer><family>Times New Roman</family></prefer>
619 <default><family>serif</family></default>
622 <family>Helvetica</family>
623 <prefer><family>Arial</family></prefer>
624 <default><family>sans</family></default>
627 <family>Courier</family>
628 <prefer><family>Courier New</family></prefer>
629 <default><family>monospace</family></default>
633 Provide required aliases for standard names
634 Do these after the users configuration file so that
635 any aliases there are used preferentially
638 <family>serif</family>
639 <prefer><family>Times New Roman</family></prefer>
642 <family>sans</family>
643 <prefer><family>Arial</family></prefer>
646 <family>monospace</family>
647 <prefer><family>Andale Mono</family></prefer>
651 The example of the requirements of OR operator;
652 If the 'family' contains 'Courier New' OR 'Courier'
653 add 'monospace' as the alternative
655 <match target="pattern">
656 <test name="family" mode="eq">
657 <string>Courier New</string>
659 <edit name="family" mode="prepend">
660 <string>monospace</string>
663 <match target="pattern">
664 <test name="family" mode="eq">
665 <string>Courier</string>
667 <edit name="family" mode="prepend">
668 <string>monospace</string>
675 <refsect2><title>User configuration file</title>
677 This is an example of a per-user configuration file that lives in
678 $XDG_CONFIG_HOME/fontconfig/fonts.conf
681 <?xml version="1.0"?>
682 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
683 <!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration -->
687 Private font directory
689 <dir prefix="xdg">fonts</dir>
692 use rgb sub-pixel ordering to improve glyph appearance on
693 LCD screens. Changes affecting rendering, but not matching
694 should always use target="font".
696 <match target="font">
697 <edit name="rgba" mode="assign"><const>rgb</const></edit>
700 use WenQuanYi Zen Hei font when serif is requested for Chinese
704 If you don't want to use WenQuanYi Zen Hei font for zh-tw etc,
705 you can use zh-cn instead of zh.
706 Please note, even if you set zh-cn, it still matches zh.
707 if you don't like it, you can use compare="eq"
708 instead of compare="contains".
710 <test name="lang" compare="contains">
711 <string>zh</string>
713 <test name="family">
714 <string>serif</string>
716 <edit name="family" mode="prepend">
717 <string>WenQuanYi Zen Hei</string>
721 use VL Gothic font when sans-serif is requested for Japanese
724 <test name="lang" compare="contains">
725 <string>ja</string>
727 <test name="family">
728 <string>sans-serif</string>
730 <edit name="family" mode="prepend">
731 <string>VL Gothic</string>
738 <refsect1><title>Files</title>
740 <emphasis>fonts.conf</emphasis>
741 contains configuration information for the fontconfig library
742 consisting of directories to look at for font information as well as
743 instructions on editing program specified font patterns before attempting to
744 match the available fonts. It is in XML format.
747 <emphasis>conf.d</emphasis>
748 is the conventional name for a directory of additional configuration files
749 managed by external applications or the local administrator. The
750 filenames starting with decimal digits are sorted in lexicographic order
751 and used as additional configuration files. All of these files are in XML
752 format. The master fonts.conf file references this directory in an
753 <include> directive.
756 <emphasis>fonts.dtd</emphasis>
757 is a DTD that describes the format of the configuration files.
760 <emphasis>$XDG_CONFIG_HOME/fontconfig/conf.d</emphasis> and <emphasis>~/.fonts.conf.d</emphasis>
761 is the conventional name for a per-user directory of (typically
762 auto-generated) configuration files, although the
763 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.
766 <emphasis>$XDG_CONFIG_HOME/fontconfig/fonts.conf</emphasis> and <emphasis>~/.fonts.conf</emphasis>
767 is the conventional location for per-user font configuration, although the
768 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.
771 <emphasis>$XDG_CACHE_HOME/fontconfig/*.cache-*</emphasis> and <emphasis> ~/.fontconfig/*.cache-*</emphasis>
772 is the conventional repository of font information that isn't found in the
773 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.
776 <refsect1><title>Environment variables</title>
778 <emphasis>FONTCONFIG_FILE</emphasis>
779 is used to override the default configuration file.
782 <emphasis>FONTCONFIG_PATH</emphasis>
783 is used to override the default configuration directory.
786 <emphasis>FC_DEBUG</emphasis>
787 is used to output the detailed debugging messages. see <link linkend="debug">Debugging Applications</link> section for more details.
790 <emphasis>FC_DBG_MATCH_FILTER</emphasis>
791 is used to filter out the patterns. this takes a comma-separated list of object names and effects only when FC_DEBUG has MATCH2. see <link linkend="debug">Debugging Applications</link> section for more details.
794 <emphasis>FC_LANG</emphasis>
795 is used to specify the default language as the weak binding in the query. if this isn't set, the default language will be determined from current locale.
798 <emphasis>FONTCONFIG_USE_MMAP</emphasis>
799 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.
802 <refsect1><title>See Also</title>
804 fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1)
807 <refsect1><title>Version</title>
809 Fontconfig version &version;