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