1FONTS-CONF(5) FONTS-CONF(5)
2
3
4
6 fonts.conf - Font configuration files
7
9 /etc/fonts/fonts.conf
10 /etc/fonts/fonts.dtd
11 /etc/fonts/conf.d
12 $XDG_CONFIG_HOME/fontconfig/conf.d
13 $XDG_CONFIG_HOME/fontconfig/fonts.conf
14 ~/.fonts.conf.d
15 ~/.fonts.conf
16
17
19 Fontconfig is a library designed to provide system-wide font configura‐
20 tion, customization and application access.
21
23 Fontconfig contains two essential modules, the configuration module
24 which builds an internal configuration from XML files and the matching
25 module which accepts font patterns and returns the nearest matching
26 font.
27
28 FONT CONFIGURATION
29 The configuration module consists of the FcConfig datatype, libexpat
30 and FcConfigParse which walks over an XML tree and amends a configura‐
31 tion with data found within. From an external perspective, configura‐
32 tion of the library consists of generating a valid XML tree and feeding
33 that to FcConfigParse. The only other mechanism provided to applica‐
34 tions for changing the running configuration is to add fonts and direc‐
35 tories to the list of application-provided font files.
36
37 The intent is to make font configurations relatively static, and shared
38 by as many applications as possible. It is hoped that this will lead to
39 more stable font selection when passing names from one application to
40 another. XML was chosen as a configuration file format because it pro‐
41 vides a format which is easy for external agents to edit while retain‐
42 ing the correct structure and syntax.
43
44 Font configuration is separate from font matching; applications needing
45 to do their own matching can access the available fonts from the li‐
46 brary and perform private matching. The intent is to permit applica‐
47 tions to pick and choose appropriate functionality from the library in‐
48 stead of forcing them to choose between this library and a private con‐
49 figuration mechanism. The hope is that this will ensure that configura‐
50 tion of fonts for all applications can be centralized in one place.
51 Centralizing font configuration will simplify and regularize font in‐
52 stallation and customization.
53
54 FONT PROPERTIES
55 While font patterns may contain essentially any properties, there are
56 some well known properties with associated types. Fontconfig uses some
57 of these properties for font matching and font completion. Others are
58 provided as a convenience for the applications' rendering mechanism.
59
60 Property Type Description
61 --------------------------------------------------------------
62 family String Font family names
63 familylang String Languages corresponding to each family
64 style String Font style. Overrides weight and slant
65 stylelang String Languages corresponding to each style
66 fullname String Font full names (often includes style)
67 fullnamelang String Languages corresponding to each fullname
68 slant Int Italic, oblique or roman
69 weight Int Light, medium, demibold, bold or black
70 size Double Point size
71 width Int Condensed, normal or expanded
72 aspect Double Stretches glyphs horizontally before hinting
73 pixelsize Double Pixel size
74 spacing Int Proportional, dual-width, monospace or charcell
75 foundry String Font foundry name
76 antialias Bool Whether glyphs can be antialiased
77 hinting Bool Whether the rasterizer should use hinting
78 hintstyle Int Automatic hinting style
79 verticallayout Bool Use vertical layout
80 autohint Bool Use autohinter instead of normal hinter
81 globaladvance Bool Use font global advance data (deprecated)
82 file String The filename holding the font
83 index Int The index of the font within the file
84 ftface FT_Face Use the specified FreeType face object
85 rasterizer String Which rasterizer is in use (deprecated)
86 outline Bool Whether the glyphs are outlines
87 scalable Bool Whether glyphs can be scaled
88 color Bool Whether any glyphs have color
89 scale Double Scale factor for point->pixel conversions (deprecated)
90 dpi Double Target dots per inch
91 rgba Int unknown, rgb, bgr, vrgb, vbgr,
92 none - subpixel geometry
93 lcdfilter Int Type of LCD filter
94 minspace Bool Eliminate leading from line spacing
95 charset CharSet Unicode chars encoded by the font
96 lang String List of RFC-3066-style languages this
97 font supports
98 fontversion Int Version number of the font
99 capability String List of layout capabilities in the font
100 fontformat String String name of the font format
101 embolden Bool Rasterizer should synthetically embolden the font
102 embeddedbitmap Bool Use the embedded bitmap instead of the outline
103 decorative Bool Whether the style is a decorative variant
104 fontfeatures String List of the feature tags in OpenType to be enabled
105 namelang String Language name to be used for the default value of
106 familylang, stylelang, and fullnamelang
107 prgname String String Name of the running program
108 postscriptname String Font family name in PostScript
109 fonthashint Bool Whether the font has hinting
110 order Int Order number of the font
111
112
113
114 FONT MATCHING
115 Fontconfig performs matching by measuring the distance from a provided
116 pattern to all of the available fonts in the system. The closest match‐
117 ing font is selected. This ensures that a font will always be returned,
118 but doesn't ensure that it is anything like the requested pattern.
119
120 Font matching starts with an application constructed pattern. The de‐
121 sired attributes of the resulting font are collected together in a pat‐
122 tern. Each property of the pattern can contain one or more values;
123 these are listed in priority order; matches earlier in the list are
124 considered "closer" than matches later in the list.
125
126 The initial pattern is modified by applying the list of editing in‐
127 structions specific to patterns found in the configuration; each con‐
128 sists of a match predicate and a set of editing operations. They are
129 executed in the order they appeared in the configuration. Each match
130 causes the associated sequence of editing operations to be applied.
131
132 After the pattern has been edited, a sequence of default substitutions
133 are performed to canonicalize the set of available properties; this
134 avoids the need for the lower layers to constantly provide default val‐
135 ues for various font properties during rendering.
136
137 The canonical font pattern is finally matched against all available
138 fonts. The distance from the pattern to the font is measured for each
139 of several properties: foundry, charset, family, lang, spacing, pixel‐
140 size, style, slant, weight, antialias, rasterizer and outline. This
141 list is in priority order -- results of comparing earlier elements of
142 this list weigh more heavily than later elements.
143
144 There is one special case to this rule; family names are split into two
145 bindings; strong and weak. Strong family names are given greater prece‐
146 dence in the match than lang elements while weak family names are given
147 lower precedence than lang elements. This permits the document language
148 to drive font selection when any document specified font is unavail‐
149 able.
150
151 The pattern representing that font is augmented to include any proper‐
152 ties found in the pattern but not found in the font itself; this per‐
153 mits the application to pass rendering instructions or any other data
154 through the matching system. Finally, the list of editing instructions
155 specific to fonts found in the configuration are applied to the pat‐
156 tern. This modified pattern is returned to the application.
157
158 The return value contains sufficient information to locate and raster‐
159 ize the font, including the file name, pixel size and other rendering
160 data. As none of the information involved pertains to the FreeType li‐
161 brary, applications are free to use any rasterization engine or even to
162 take the identified font file and access it directly.
163
164 The match/edit sequences in the configuration are performed in two
165 passes because there are essentially two different operations necessary
166 -- the first is to modify how fonts are selected; aliasing families and
167 adding suitable defaults. The second is to modify how the selected
168 fonts are rasterized. Those must apply to the selected font, not the
169 original pattern as false matches will often occur.
170
171 FONT NAMES
172 Fontconfig provides a textual representation for patterns that the li‐
173 brary can both accept and generate. The representation is in three
174 parts, first a list of family names, second a list of point sizes and
175 finally a list of additional properties:
176
177 <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...
178
179
180
181 Values in a list are separated with commas. The name needn't include
182 either families or point sizes; they can be elided. In addition, there
183 are symbolic constants that simultaneously indicate both a name and a
184 value. Here are some examples:
185
186 Name Meaning
187 ----------------------------------------------------------
188 Times-12 12 point Times Roman
189 Times-12:bold 12 point Times Bold
190 Courier:italic Courier Italic in the default size
191 Monospace:matrix=1 .1 0 1 The users preferred monospace font
192 with artificial obliquing
193
194
195
196 The '\', '-', ':' and ',' characters in family names must be preceded
197 by a '\' character to avoid having them misinterpreted. Similarly, val‐
198 ues containing '\', '=', '_', ':' and ',' must also have them preceded
199 by a '\' character. The '\' characters are stripped out of the family
200 name and values as the font name is read.
201
203 To help diagnose font and applications problems, fontconfig is built
204 with a large amount of internal debugging left enabled. It is con‐
205 trolled by means of the FC_DEBUG environment variable. The value of
206 this variable is interpreted as a number, and each bit within that
207 value controls different debugging messages.
208
209 Name Value Meaning
210 ---------------------------------------------------------
211 MATCH 1 Brief information about font matching
212 MATCHV 2 Extensive font matching information
213 EDIT 4 Monitor match/test/edit execution
214 FONTSET 8 Track loading of font information at startup
215 CACHE 16 Watch cache files being written
216 CACHEV 32 Extensive cache file writing information
217 PARSE 64 (no longer in use)
218 SCAN 128 Watch font files being scanned to build caches
219 SCANV 256 Verbose font file scanning information
220 MEMORY 512 Monitor fontconfig memory usage
221 CONFIG 1024 Monitor which config files are loaded
222 LANGSET 2048 Dump char sets used to construct lang values
223 MATCH2 4096 Display font-matching transformation in patterns
224
225
226
227 Add the value of the desired debug levels together and assign that (in
228 base 10) to the FC_DEBUG environment variable before running the appli‐
229 cation. Output from these statements is sent to stdout.
230
232 Each font in the database contains a list of languages it supports.
233 This is computed by comparing the Unicode coverage of the font with the
234 orthography of each language. Languages are tagged using an RFC-3066
235 compatible naming and occur in two parts -- the ISO 639 language tag
236 followed a hyphen and then by the ISO 3166 country code. The hyphen and
237 country code may be elided.
238
239 Fontconfig has orthographies for several languages built into the li‐
240 brary. No provision has been made for adding new ones aside from re‐
241 building the library. It currently supports 122 of the 139 languages
242 named in ISO 639-1, 141 of the languages with two-letter codes from ISO
243 639-2 and another 30 languages with only three-letter codes. Languages
244 with both two and three letter codes are provided with only the two
245 letter code.
246
247 For languages used in multiple territories with radically different
248 character sets, fontconfig includes per-territory orthographies. This
249 includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
250
252 Configuration files for fontconfig are stored in XML format; this for‐
253 mat makes external configuration tools easier to write and ensures that
254 they will generate syntactically correct configuration files. As XML
255 files are plain text, they can also be manipulated by the expert user
256 using a text editor.
257
258 The fontconfig document type definition resides in the external entity
259 "fonts.dtd"; this is normally stored in the default font configuration
260 directory (/etc/fonts). Each configuration file should contain the fol‐
261 lowing structure:
262
263 <?xml version="1.0"?>
264 <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
265 <fontconfig>
266 ...
267 </fontconfig>
268
269
270
271 <FONTCONFIG>
272 This is the top level element for a font configuration and can contain
273 <dir>, <cachedir>, <include>, <match> and <alias> elements in any or‐
274 der.
275
276 <DIR PREFIX="DEFAULT" SALT="">
277 This element contains a directory name which will be scanned for font
278 files to include in the set of available fonts.
279
280 If 'prefix' is set to "default" or "cwd", the current working directory
281 will be added as the path prefix prior to the value. If 'prefix' is set
282 to "xdg", the value in the XDG_DATA_HOME environment variable will be
283 added as the path prefix. please see XDG Base Directory Specification
284 for more details. If 'prefix' is set to "relative", the path of current
285 file will be added prior to the value.
286
287 'salt' property affects to determine cache filename. this is useful for
288 example when having different fonts sets on same path at container and
289 share fonts from host on different font path.
290
291 <CACHEDIR PREFIX="DEFAULT">
292 This element contains a directory name that is supposed to be stored or
293 read the cache of font information. If multiple elements are specified
294 in the configuration file, the directory that can be accessed first in
295 the list will be used to store the cache files. If it starts with '~',
296 it refers to a directory in the users home directory. If 'prefix' is
297 set to "xdg", the value in the XDG_CACHE_HOME environment variable will
298 be added as the path prefix. please see XDG Base Directory Specifica‐
299 tion for more details. The default directory is
300 ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files named
301 ``<hash value>-<architecture>.cache-<version>'', where <version> is the
302 fontconfig cache file version number (currently 7).
303
304 <INCLUDE IGNORE_MISSING="NO" PREFIX="DEFAULT">
305 This element contains the name of an additional configuration file or
306 directory. If a directory, every file within that directory starting
307 with an ASCII digit (U+0030 - U+0039) and ending with the string
308 ``.conf'' will be processed in sorted order. When the XML datatype is
309 traversed by FcConfigParse, the contents of the file(s) will also be
310 incorporated into the configuration by passing the filename(s) to Fc‐
311 ConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the
312 default "no", a missing file or directory will elicit no warning mes‐
313 sage from the library. If 'prefix' is set to "xdg", the value in the
314 XDG_CONFIG_HOME environment variable will be added as the path prefix.
315 please see XDG Base Directory Specification for more details.
316
317 <CONFIG>
318 This element provides a place to consolidate additional configuration
319 information. <config> can contain <blank> and <rescan> elements in any
320 order.
321
322 <DESCRIPTION DOMAIN="FONTCONFIG-CONF">
323 This element is supposed to hold strings which describe what a config
324 is used for. This string can be translated through gettext. 'domain'
325 needs to be set the proper name to apply then. fontconfig will tries
326 to retrieve translations with 'domain' from gettext.
327
328 <BLANK>
329 Fonts often include "broken" glyphs which appear in the encoding but
330 are drawn as blanks on the screen. Within the <blank> element, place
331 each Unicode characters which is supposed to be blank in an <int> ele‐
332 ment. Characters outside of this set which are drawn as blank will be
333 elided from the set of characters supported by the font.
334
335 <REMAP-DIR PREFIX="DEFAULT" AS-PATH="" SALT="">
336 This element contains a directory name where will be mapped as the path
337 'as-path' in cached information. This is useful if the directory name
338 is an alias (via a bind mount or symlink) to another directory in the
339 system for which cached font information is likely to exist.
340
341 'salt' property affects to determine cache filename as same as <dir>
342 element.
343
344 <RESET-DIRS />
345 This element removes all of fonts directories where added by <dir> ele‐
346 ments. This is useful to override fonts directories from system to own
347 fonts directories only.
348
349 <RESCAN>
350 The <rescan> element holds an <int> element which indicates the default
351 interval between automatic checks for font configuration changes.
352 Fontconfig will validate all of the configuration files and directories
353 and automatically rebuild the internal datastructures when this inter‐
354 val passes.
355
356 <SELECTFONT>
357 This element is used to black/white list fonts from being listed or
358 matched against. It holds acceptfont and rejectfont elements.
359
360 <ACCEPTFONT>
361 Fonts matched by an acceptfont element are "whitelisted"; such fonts
362 are explicitly included in the set of fonts used to resolve list and
363 match requests; including them in this list protects them from being
364 "blacklisted" by a rejectfont element. Acceptfont elements include glob
365 and pattern elements which are used to match fonts.
366
367 <REJECTFONT>
368 Fonts matched by an rejectfont element are "blacklisted"; such fonts
369 are excluded from the set of fonts used to resolve list and match re‐
370 quests as if they didn't exist in the system. Rejectfont elements in‐
371 clude glob and pattern elements which are used to match fonts.
372
373 <GLOB>
374 Glob elements hold shell-style filename matching patterns (including ?
375 and *) which match fonts based on their complete pathnames. This can be
376 used to exclude a set of directories (/usr/share/fonts/uglyfont*), or
377 particular font file types (*.pcf.gz), but the latter mechanism relies
378 rather heavily on filenaming conventions which can't be relied upon.
379 Note that globs only apply to directories, not to individual fonts.
380
381 <PATTERN>
382 Pattern elements perform list-style matching on incoming fonts; that
383 is, 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
385 can be used to select fonts based on attributes of the font (scalable,
386 bold, etc), which is a more reliable mechanism than using file exten‐
387 sions. Pattern elements include patelt elements.
388
389 <PATELT NAME="PROPERTY">
390 Patelt elements hold a single pattern element and list of values. They
391 must have a 'name' attribute which indicates the pattern element name.
392 Patelt elements include int, double, string, matrix, bool, charset and
393 const elements.
394
395 <MATCH TARGET="PATTERN">
396 This element holds first a (possibly empty) list of <test> elements and
397 then a (possibly empty) list of <edit> elements. Patterns which match
398 all of the tests are subjected to all the edits. If 'target' is set to
399 "font" instead of the default "pattern", then this element applies to
400 the font name resulting from a match rather than a font pattern to be
401 matched. If 'target' is set to "scan", then this element applies when
402 the font is scanned to build the fontconfig database.
403
404 <TEST QUAL="ANY" NAME="PROPERTY" TARGET="DEFAULT" COMPARE="EQ">
405 This element contains a single value which is compared with the target
406 ('pattern', 'font', 'scan' or 'default') property "property" (substi‐
407 tute any of the property names seen above). 'compare' can be one of
408 "eq", "not_eq", "less", "less_eq", "more", "more_eq", "contains" or
409 "not_contains". 'qual' may either be the default, "any", in which case
410 the match succeeds if any value associated with the property matches
411 the test value, or "all", in which case all of the values associated
412 with the property must match the test value. 'ignore-blanks' takes a
413 boolean value. if 'ignore-blanks' is set "true", any blanks in the
414 string will be ignored on its comparison. this takes effects only when
415 compare="eq" or compare="not_eq". When used in a <match target="font">
416 element, the target= attribute in the <test> element selects between
417 matching the original pattern or the font. "default" selects whichever
418 target the outer <match> element has selected.
419
420 <EDIT NAME="PROPERTY" MODE="ASSIGN" BINDING="WEAK">
421 This element contains a list of expression elements (any of the value
422 or operator elements). The expression elements are evaluated at run-
423 time and modify the property "property". The modification depends on
424 whether "property" was matched by one of the associated <test> ele‐
425 ments, if so, the modification may affect the first matched value. Any
426 values inserted into the property are given the indicated binding
427 ("strong", "weak" or "same") with "same" binding using the value from
428 the matched pattern element. 'mode' is one of:
429
430 Mode With Match Without Match
431 ---------------------------------------------------------------------
432 "assign" Replace matching value Replace all values
433 "assign_replace" Replace all values Replace all values
434 "prepend" Insert before matching Insert at head of list
435 "prepend_first" Insert at head of list Insert at head of list
436 "append" Append after matching Append at end of list
437 "append_last" Append at end of list Append at end of list
438 "delete" Delete matching value Delete all values
439 "delete_all" Delete all values Delete all values
440
441
442
443 <INT>, <DOUBLE>, <STRING>, <BOOL>
444 These elements hold a single value of the indicated type. <bool> ele‐
445 ments hold either true or false. An important limitation exists in the
446 parsing of floating point numbers -- fontconfig requires that the man‐
447 tissa start with a digit, not a decimal point, so insert a leading zero
448 for purely fractional values (e.g. use 0.5 instead of .5 and -0.5 in‐
449 stead of -.5).
450
451 <MATRIX>
452 This element holds four numerical expressions of an affine transforma‐
453 tion. At their simplest these will be four <double> elements but they
454 can also be more involved expressions.
455
456 <RANGE>
457 This element holds the two <int> elements of a range representation.
458
459 <CHARSET>
460 This element holds at least one <int> element of an Unicode code point
461 or more.
462
463 <LANGSET>
464 This element holds at least one <string> element of a RFC-3066-style
465 languages or more.
466
467 <NAME>
468 Holds a property name. Evaluates to the first value from the property
469 of the pattern. If the 'target' attribute is not present, it will de‐
470 fault to 'default', in which case the property is returned from the
471 font pattern during a target="font" match, and to the pattern during a
472 target="pattern" match. The attribute can also take the values 'font'
473 or 'pattern' to explicitly choose which pattern to use. It is an error
474 to use a target of 'font' in a match that has target="pattern".
475
476 <CONST>
477 Holds the name of a constant; these are always integers and serve as
478 symbolic names for common font values:
479
480 Constant Property Value
481 -------------------------------------
482 thin weight 0
483 extralight weight 40
484 ultralight weight 40
485 light weight 50
486 demilight weight 55
487 semilight weight 55
488 book weight 75
489 regular weight 80
490 normal weight 80
491 medium weight 100
492 demibold weight 180
493 semibold weight 180
494 bold weight 200
495 extrabold weight 205
496 black weight 210
497 heavy weight 210
498 roman slant 0
499 italic slant 100
500 oblique slant 110
501 ultracondensed width 50
502 extracondensed width 63
503 condensed width 75
504 semicondensed width 87
505 normal width 100
506 semiexpanded width 113
507 expanded width 125
508 extraexpanded width 150
509 ultraexpanded width 200
510 proportional spacing 0
511 dual spacing 90
512 mono spacing 100
513 charcell spacing 110
514 unknown rgba 0
515 rgb rgba 1
516 bgr rgba 2
517 vrgb rgba 3
518 vbgr rgba 4
519 none rgba 5
520 lcdnone lcdfilter 0
521 lcddefault lcdfilter 1
522 lcdlight lcdfilter 2
523 lcdlegacy lcdfilter 3
524 hintnone hintstyle 0
525 hintslight hintstyle 1
526 hintmedium hintstyle 2
527 hintfull hintstyle 3
528
529
530
531 <OR>, <AND>, <PLUS>, <MINUS>, <TIMES>, <DIVIDE>
532 These elements perform the specified operation on a list of expression
533 elements. <or> and <and> are boolean, not bitwise.
534
535 <EQ>, <NOT_EQ>, <LESS>, <LESS_EQ>, <MORE>, <MORE_EQ>, <CONTAINS>, <NOT_CON‐
536 TAINS
537 These elements compare two values, producing a boolean result.
538
539 <NOT>
540 Inverts the boolean sense of its one expression element
541
542 <IF>
543 This element takes three expression elements; if the value of the first
544 is true, it produces the value of the second, otherwise it produces the
545 value of the third.
546
547 <ALIAS>
548 Alias elements provide a shorthand notation for the set of common match
549 operations needed to substitute one font family for another. They con‐
550 tain a <family> element followed by optional <prefer>, <accept> and
551 <default> elements. Fonts matching the <family> element are edited to
552 prepend the list of <prefer>ed families before the matching <family>,
553 append the <accept>able families after the matching <family> and append
554 the <default> families to the end of the family list.
555
556 <FAMILY>
557 Holds a single font family name
558
559 <PREFER>, <ACCEPT>, <DEFAULT>
560 These hold a list of <family> elements to be used by the <alias> ele‐
561 ment.
562
564 SYSTEM CONFIGURATION FILE
565 This is an example of a system-wide configuration file
566
567 <?xml version="1.0"?>
568 <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
569 <!-- /etc/fonts/fonts.conf file to configure system font access -->
570 <fontconfig>
571 <!--
572 Find fonts in these directories
573 -->
574 <dir>/usr/share/fonts</dir>
575 <dir>/usr/X11R6/lib/X11/fonts</dir>
576
577 <!--
578 Accept deprecated 'mono' alias, replacing it with 'monospace'
579 -->
580 <match target="pattern">
581 <test qual="any" name="family"><string>mono</string></test>
582 <edit name="family" mode="assign"><string>monospace</string></edit>
583 </match>
584
585 <!--
586 Names not including any well known alias are given 'sans-serif'
587 -->
588 <match target="pattern">
589 <test qual="all" name="family" compare="not_eq"><string>sans-serif</string></test>
590 <test qual="all" name="family" compare="not_eq"><string>serif</string></test>
591 <test qual="all" name="family" compare="not_eq"><string>monospace</string></test>
592 <edit name="family" mode="append_last"><string>sans-serif</string></edit>
593 </match>
594
595 <!--
596 Load per-user customization file, but don't complain
597 if it doesn't exist
598 -->
599 <include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</include>
600
601 <!--
602 Load local customization files, but don't complain
603 if there aren't any
604 -->
605 <include ignore_missing="yes">conf.d</include>
606 <include ignore_missing="yes">local.conf</include>
607
608 <!--
609 Alias well known font names to available TrueType fonts.
610 These substitute TrueType faces for similar Type1
611 faces to improve screen appearance.
612 -->
613 <alias>
614 <family>Times</family>
615 <prefer><family>Times New Roman</family></prefer>
616 <default><family>serif</family></default>
617 </alias>
618 <alias>
619 <family>Helvetica</family>
620 <prefer><family>Arial</family></prefer>
621 <default><family>sans</family></default>
622 </alias>
623 <alias>
624 <family>Courier</family>
625 <prefer><family>Courier New</family></prefer>
626 <default><family>monospace</family></default>
627 </alias>
628
629 <!--
630 Provide required aliases for standard names
631 Do these after the users configuration file so that
632 any aliases there are used preferentially
633 -->
634 <alias>
635 <family>serif</family>
636 <prefer><family>Times New Roman</family></prefer>
637 </alias>
638 <alias>
639 <family>sans</family>
640 <prefer><family>Arial</family></prefer>
641 </alias>
642 <alias>
643 <family>monospace</family>
644 <prefer><family>Andale Mono</family></prefer>
645 </alias>
646
647 <--
648 The example of the requirements of OR operator;
649 If the 'family' contains 'Courier New' OR 'Courier'
650 add 'monospace' as the alternative
651 -->
652 <match target="pattern">
653 <test name="family" compare="eq">
654 <string>Courier New</string>
655 </test>
656 <edit name="family" mode="prepend">
657 <string>monospace</string>
658 </edit>
659 </match>
660 <match target="pattern">
661 <test name="family" compare="eq">
662 <string>Courier</string>
663 </test>
664 <edit name="family" mode="prepend">
665 <string>monospace</string>
666 </edit>
667 </match>
668
669 </fontconfig>
670
671
672
673 USER CONFIGURATION FILE
674 This is an example of a per-user configuration file that lives in
675 $XDG_CONFIG_HOME/fontconfig/fonts.conf
676
677 <?xml version="1.0"?>
678 <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
679 <!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration -->
680 <fontconfig>
681
682 <!--
683 Private font directory
684 -->
685 <dir prefix="xdg">fonts</dir>
686
687 <!--
688 use rgb sub-pixel ordering to improve glyph appearance on
689 LCD screens. Changes affecting rendering, but not matching
690 should always use target="font".
691 -->
692 <match target="font">
693 <edit name="rgba" mode="assign"><const>rgb</const></edit>
694 </match>
695 <!--
696 use WenQuanYi Zen Hei font when serif is requested for Chinese
697 -->
698 <match>
699 <!--
700 If you don't want to use WenQuanYi Zen Hei font for zh-tw etc,
701 you can use zh-cn instead of zh.
702 Please note, even if you set zh-cn, it still matches zh.
703 if you don't like it, you can use compare="eq"
704 instead of compare="contains".
705 -->
706 <test name="lang" compare="contains">
707 <string>zh</string>
708 </test>
709 <test name="family">
710 <string>serif</string>
711 </test>
712 <edit name="family" mode="prepend">
713 <string>WenQuanYi Zen Hei</string>
714 </edit>
715 </match>
716 <!--
717 use VL Gothic font when sans-serif is requested for Japanese
718 -->
719 <match>
720 <test name="lang" compare="contains">
721 <string>ja</string>
722 </test>
723 <test name="family">
724 <string>sans-serif</string>
725 </test>
726 <edit name="family" mode="prepend">
727 <string>VL Gothic</string>
728 </edit>
729 </match>
730 </fontconfig>
731
732
733
735 fonts.conf contains configuration information for the fontconfig li‐
736 brary consisting of directories to look at for font information as well
737 as instructions on editing program specified font patterns before at‐
738 tempting to match the available fonts. It is in XML format.
739
740 conf.d is the conventional name for a directory of additional configu‐
741 ration files managed by external applications or the local administra‐
742 tor. The filenames starting with decimal digits are sorted in lexico‐
743 graphic order and used as additional configuration files. All of these
744 files are in XML format. The master fonts.conf file references this di‐
745 rectory in an <include> directive.
746
747 fonts.dtd is a DTD that describes the format of the configuration
748 files.
749
750 $XDG_CONFIG_HOME/fontconfig/conf.d and ~/.fonts.conf.d is the conven‐
751 tional name for a per-user directory of (typically auto-generated) con‐
752 figuration files, although the actual location is specified in the
753 global fonts.conf file. please note that ~/.fonts.conf.d is deprecated
754 now. it will not be read by default in the future version.
755
756 $XDG_CONFIG_HOME/fontconfig/fonts.conf and ~/.fonts.conf is the conven‐
757 tional location for per-user font configuration, although the actual
758 location is specified in the global fonts.conf file. please note that
759 ~/.fonts.conf is deprecated now. it will not be read by default in the
760 future version.
761
762 $XDG_CACHE_HOME/fontconfig/*.cache-* and ~/.fontconfig/*.cache-* is
763 the conventional repository of font information that isn't found in the
764 per-directory caches. This file is automatically maintained by fontcon‐
765 fig. please note that ~/.fontconfig/*.cache-* is deprecated now. it
766 will not be read by default in the future version.
767
769 FONTCONFIG_FILE is used to override the default configuration file.
770
771 FONTCONFIG_PATH is used to override the default configuration direc‐
772 tory.
773
774 FONTCONFIG_SYSROOT is used to set a default sysroot directory.
775
776 FC_DEBUG is used to output the detailed debugging messages. see Debug‐
777 ging Applications section for more details.
778
779 FC_DBG_MATCH_FILTER is used to filter out the patterns. this takes a
780 comma-separated list of object names and effects only when FC_DEBUG has
781 MATCH2. see Debugging Applications section for more details.
782
783 FC_LANG is used to specify the default language as the weak binding in
784 the query. if this isn't set, the default language will be determined
785 from current locale.
786
787 FONTCONFIG_USE_MMAP is used to control the use of mmap(2) for the cache
788 files if available. this take a boolean value. fontconfig will checks
789 if the cache files are stored on the filesystem that is safe to use
790 mmap(2). explicitly setting this environment variable will causes skip‐
791 ping this check and enforce to use or not use mmap(2) anyway.
792
793 SOURCE_DATE_EPOCH is used to ensure fc-cache(1) generates files in a
794 deterministic manner in order to support reproducible builds. When set
795 to a numeric representation of UNIX timestamp, fontconfig will prefer
796 this value over using the modification timestamps of the input files in
797 order to identify which cache files require regeneration. If
798 SOURCE_DATE_EPOCH is not set (or is newer than the mtime of the direc‐
799 tory), the existing behaviour is unchanged.
800
802 fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1),
803 SOURCE_DATE_EPOCH <URL:https://reproducible-builds.org/specs/source-
804 date-epoch/>.
805
807 Fontconfig version 2.14.0
808
809
810
811 31 3月 2022 FONTS-CONF(5)