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