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