fontconfig-user.txt revision 953daeba
1953daebaSmrg                               fonts-conf
22c393a42Smrg
32c393a42SmrgName
42c393a42Smrg
5953daebaSmrg   fonts.conf -- Font configuration files
62c393a42Smrg
72c393a42SmrgSynopsis
82c393a42Smrg
9953daebaSmrg   /etc/fonts/fonts.conf
10953daebaSmrg   /etc/fonts/fonts.dtd
11953daebaSmrg   /etc/fonts/conf.d
12953daebaSmrg   $XDG_CONFIG_HOME/fontconfig/conf.d
13953daebaSmrg   $XDG_CONFIG_HOME/fontconfig/fonts.conf
14953daebaSmrg   ~/.fonts.conf.d
15953daebaSmrg   ~/.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
24953daebaSmrg   Fontconfig contains two essential modules, the configuration
25953daebaSmrg   module which builds an internal configuration from XML files
26953daebaSmrg   and the matching module which accepts font patterns and returns
27953daebaSmrg   the nearest matching font.
28953daebaSmrg
29953daebaSmrgFont Configuration
30953daebaSmrg
31953daebaSmrg   The configuration module consists of the FcConfig datatype,
32953daebaSmrg   libexpat and FcConfigParse which walks over an XML tree and
33953daebaSmrg   amends a configuration with data found within. From an external
34953daebaSmrg   perspective, configuration of the library consists of
35953daebaSmrg   generating a valid XML tree and feeding that to FcConfigParse.
36953daebaSmrg   The only other mechanism provided to applications for changing
37953daebaSmrg   the running configuration is to add fonts and directories to
38953daebaSmrg   the list of application-provided font files.
39953daebaSmrg
40953daebaSmrg   The intent is to make font configurations relatively static,
41953daebaSmrg   and shared by as many applications as possible. It is hoped
42953daebaSmrg   that this will lead to more stable font selection when passing
43953daebaSmrg   names from one application to another. XML was chosen as a
44953daebaSmrg   configuration file format because it provides a format which is
45953daebaSmrg   easy for external agents to edit while retaining the correct
46ca08ab68Smrg   structure and syntax.
47ca08ab68Smrg
48953daebaSmrg   Font configuration is separate from font matching; applications
49953daebaSmrg   needing to do their own matching can access the available fonts
50953daebaSmrg   from the library and perform private matching. The intent is to
51953daebaSmrg   permit applications to pick and choose appropriate
52953daebaSmrg   functionality from the library instead of forcing them to
53953daebaSmrg   choose between this library and a private configuration
54953daebaSmrg   mechanism. The hope is that this will ensure that configuration
55953daebaSmrg   of fonts for all applications can be centralized in one place.
56953daebaSmrg   Centralizing font configuration will simplify and regularize
57953daebaSmrg   font installation and customization.
58953daebaSmrg
59953daebaSmrgFont Properties
60953daebaSmrg
61953daebaSmrg   While font patterns may contain essentially any properties,
62953daebaSmrg   there are some well known properties with associated types.
63953daebaSmrg   Fontconfig uses some of these properties for font matching and
64953daebaSmrg   font completion. Others are provided as a convenience for the
65953daebaSmrg   applications' rendering mechanism.
66953daebaSmrg  Property        Type    Description
67953daebaSmrg  --------------------------------------------------------------
68953daebaSmrg  family          String  Font family names
69953daebaSmrg  familylang      String  Languages corresponding to each family
70953daebaSmrg  style           String  Font style. Overrides weight and slant
71953daebaSmrg  stylelang       String  Languages corresponding to each style
72953daebaSmrg  fullname        String  Font full names (often includes style)
73953daebaSmrg  fullnamelang    String  Languages corresponding to each fullname
74953daebaSmrg  slant           Int     Italic, oblique or roman
75953daebaSmrg  weight          Int     Light, medium, demibold, bold or black
76953daebaSmrg  size            Double  Point size
77953daebaSmrg  width           Int     Condensed, normal or expanded
78953daebaSmrg  aspect          Double  Stretches glyphs horizontally before hinting
79953daebaSmrg  pixelsize       Double  Pixel size
80953daebaSmrg  spacing         Int     Proportional, dual-width, monospace or charcel
81953daebaSmrgl
82953daebaSmrg  foundry         String  Font foundry name
83953daebaSmrg  antialias       Bool    Whether glyphs can be antialiased
84953daebaSmrg  hinting         Bool    Whether the rasterizer should use hinting
85953daebaSmrg  hintstyle       Int     Automatic hinting style
86953daebaSmrg  verticallayout  Bool    Use vertical layout
87953daebaSmrg  autohint        Bool    Use autohinter instead of normal hinter
88953daebaSmrg  globaladvance   Bool    Use font global advance data (deprecated)
89953daebaSmrg  file            String  The filename holding the font
90953daebaSmrg  index           Int     The index of the font within the file
91953daebaSmrg  ftface          FT_Face Use the specified FreeType face object
92953daebaSmrg  rasterizer      String  Which rasterizer is in use (deprecated)
93953daebaSmrg  outline         Bool    Whether the glyphs are outlines
94953daebaSmrg  scalable        Bool    Whether glyphs can be scaled
95953daebaSmrg  color           Bool    Whether any glyphs have color
96953daebaSmrg  scale           Double  Scale factor for point->pixel conversions (dep
97953daebaSmrgrecated)
98953daebaSmrg  dpi             Double  Target dots per inch
99953daebaSmrg  rgba            Int     unknown, rgb, bgr, vrgb, vbgr,
100953daebaSmrg                          none - subpixel geometry
101953daebaSmrg  lcdfilter       Int     Type of LCD filter
102953daebaSmrg  minspace        Bool    Eliminate leading from line spacing
103953daebaSmrg  charset         CharSet Unicode chars encoded by the font
104953daebaSmrg  lang            String  List of RFC-3066-style languages this
105953daebaSmrg                          font supports
106953daebaSmrg  fontversion     Int     Version number of the font
107953daebaSmrg  capability      String  List of layout capabilities in the font
108953daebaSmrg  fontformat      String  String name of the font format
109953daebaSmrg  embolden        Bool    Rasterizer should synthetically embolden the f
110953daebaSmrgont
111953daebaSmrg  embeddedbitmap  Bool    Use the embedded bitmap instead of the outline
112953daebaSmrg  decorative      Bool    Whether the style is a decorative variant
113953daebaSmrg  fontfeatures    String  List of the feature tags in OpenType to be ena
114953daebaSmrgbled
115953daebaSmrg  namelang        String  Language name to be used for the default value
116953daebaSmrg of
117953daebaSmrg                          familylang, stylelang, and fullnamelang
118953daebaSmrg  prgname         String  String  Name of the running program
119953daebaSmrg  postscriptname  String  Font family name in PostScript
120953daebaSmrg
121953daebaSmrgFont Matching
122953daebaSmrg
123953daebaSmrg   Fontconfig performs matching by measuring the distance from a
124953daebaSmrg   provided pattern to all of the available fonts in the system.
125953daebaSmrg   The closest matching font is selected. This ensures that a font
126953daebaSmrg   will always be returned, but doesn't ensure that it is anything
127953daebaSmrg   like the requested pattern.
128953daebaSmrg
129953daebaSmrg   Font matching starts with an application constructed pattern.
130953daebaSmrg   The desired attributes of the resulting font are collected
131953daebaSmrg   together in a pattern. Each property of the pattern can contain
132953daebaSmrg   one or more values; these are listed in priority order; matches
133953daebaSmrg   earlier in the list are considered "closer" than matches later
134953daebaSmrg   in the list.
135ca08ab68Smrg
136ca08ab68Smrg   The initial pattern is modified by applying the list of editing
137953daebaSmrg   instructions specific to patterns found in the configuration;
138953daebaSmrg   each consists of a match predicate and a set of editing
139953daebaSmrg   operations. They are executed in the order they appeared in the
140953daebaSmrg   configuration. Each match causes the associated sequence of
141953daebaSmrg   editing operations to be applied.
142953daebaSmrg
143953daebaSmrg   After the pattern has been edited, a sequence of default
144953daebaSmrg   substitutions are performed to canonicalize the set of
145953daebaSmrg   available properties; this avoids the need for the lower layers
146953daebaSmrg   to constantly provide default values for various font
147953daebaSmrg   properties during rendering.
148953daebaSmrg
149953daebaSmrg   The canonical font pattern is finally matched against all
150953daebaSmrg   available fonts. The distance from the pattern to the font is
151953daebaSmrg   measured for each of several properties: foundry, charset,
152953daebaSmrg   family, lang, spacing, pixelsize, style, slant, weight,
153953daebaSmrg   antialias, rasterizer and outline. This list is in priority
154953daebaSmrg   order -- results of comparing earlier elements of this list
155953daebaSmrg   weigh more heavily than later elements.
156953daebaSmrg
157953daebaSmrg   There is one special case to this rule; family names are split
158953daebaSmrg   into two bindings; strong and weak. Strong family names are
159953daebaSmrg   given greater precedence in the match than lang elements while
160953daebaSmrg   weak family names are given lower precedence than lang
161953daebaSmrg   elements. This permits the document language to drive font
162953daebaSmrg   selection when any document specified font is unavailable.
163953daebaSmrg
164953daebaSmrg   The pattern representing that font is augmented to include any
165953daebaSmrg   properties found in the pattern but not found in the font
166953daebaSmrg   itself; this permits the application to pass rendering
167953daebaSmrg   instructions or any other data through the matching system.
168953daebaSmrg   Finally, the list of editing instructions specific to fonts
169953daebaSmrg   found in the configuration are applied to the pattern. This
170953daebaSmrg   modified pattern is returned to the application.
171953daebaSmrg
172953daebaSmrg   The return value contains sufficient information to locate and
173953daebaSmrg   rasterize the font, including the file name, pixel size and
174953daebaSmrg   other rendering data. As none of the information involved
175953daebaSmrg   pertains to the FreeType library, applications are free to use
176953daebaSmrg   any rasterization engine or even to take the identified font
177953daebaSmrg   file and access it directly.
178953daebaSmrg
179953daebaSmrg   The match/edit sequences in the configuration are performed in
180953daebaSmrg   two passes because there are essentially two different
181953daebaSmrg   operations necessary -- the first is to modify how fonts are
182953daebaSmrg   selected; aliasing families and adding suitable defaults. The
183953daebaSmrg   second is to modify how the selected fonts are rasterized.
184953daebaSmrg   Those must apply to the selected font, not the original pattern
185953daebaSmrg   as false matches will often occur.
186953daebaSmrg
187953daebaSmrgFont Names
188953daebaSmrg
189953daebaSmrg   Fontconfig provides a textual representation for patterns that
190953daebaSmrg   the library can both accept and generate. The representation is
191953daebaSmrg   in three parts, first a list of family names, second a list of
192953daebaSmrg   point sizes and finally a list of additional properties:
193953daebaSmrg        <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...
194953daebaSmrg
195953daebaSmrg   Values in a list are separated with commas. The name needn't
196953daebaSmrg   include either families or point sizes; they can be elided. In
197953daebaSmrg   addition, there are symbolic constants that simultaneously
198953daebaSmrg   indicate both a name and a value. Here are some examples:
199953daebaSmrg  Name                            Meaning
200953daebaSmrg  ----------------------------------------------------------
201953daebaSmrg  Times-12                        12 point Times Roman
202953daebaSmrg  Times-12:bold                   12 point Times Bold
203953daebaSmrg  Courier:italic                  Courier Italic in the default size
204953daebaSmrg  Monospace:matrix=1 .1 0 1       The users preferred monospace font
205953daebaSmrg                                  with artificial obliquing
206953daebaSmrg
207953daebaSmrg   The '\', '-', ':' and ',' characters in family names must be
208953daebaSmrg   preceded by a '\' character to avoid having them
209953daebaSmrg   misinterpreted. Similarly, values containing '\', '=', '_', ':'
210953daebaSmrg   and ',' must also have them preceded by a '\' character. The
211953daebaSmrg   '\' characters are stripped out of the family name and values
212953daebaSmrg   as the font name is read.
2132c393a42Smrg
2142c393a42SmrgDebugging Applications
2152c393a42Smrg
216953daebaSmrg   To help diagnose font and applications problems, fontconfig is
217953daebaSmrg   built with a large amount of internal debugging left enabled.
218953daebaSmrg   It is controlled by means of the FC_DEBUG environment variable.
219953daebaSmrg   The value of this variable is interpreted as a number, and each
220953daebaSmrg   bit within that value controls different debugging messages.
221953daebaSmrg  Name         Value    Meaning
222953daebaSmrg  ---------------------------------------------------------
223953daebaSmrg  MATCH            1    Brief information about font matching
224953daebaSmrg  MATCHV           2    Extensive font matching information
225953daebaSmrg  EDIT             4    Monitor match/test/edit execution
226953daebaSmrg  FONTSET          8    Track loading of font information at startup
227953daebaSmrg  CACHE           16    Watch cache files being written
228953daebaSmrg  CACHEV          32    Extensive cache file writing information
229953daebaSmrg  PARSE           64    (no longer in use)
230953daebaSmrg  SCAN           128    Watch font files being scanned to build caches
231953daebaSmrg  SCANV          256    Verbose font file scanning information
232953daebaSmrg  MEMORY         512    Monitor fontconfig memory usage
233953daebaSmrg  CONFIG        1024    Monitor which config files are loaded
234953daebaSmrg  LANGSET       2048    Dump char sets used to construct lang values
235953daebaSmrg  MATCH2        4096    Display font-matching transformation in patterns
236953daebaSmrg
237953daebaSmrg   Add the value of the desired debug levels together and assign
238953daebaSmrg   that (in base 10) to the FC_DEBUG environment variable before
239953daebaSmrg   running the application. Output from these statements is sent
240953daebaSmrg   to stdout.
2412c393a42Smrg
2422c393a42SmrgLang Tags
2432c393a42Smrg
244953daebaSmrg   Each font in the database contains a list of languages it
245953daebaSmrg   supports. This is computed by comparing the Unicode coverage of
246953daebaSmrg   the font with the orthography of each language. Languages are
247953daebaSmrg   tagged using an RFC-3066 compatible naming and occur in two
248953daebaSmrg   parts -- the ISO 639 language tag followed a hyphen and then by
249953daebaSmrg   the ISO 3166 country code. The hyphen and country code may be
250953daebaSmrg   elided.
251953daebaSmrg
252953daebaSmrg   Fontconfig has orthographies for several languages built into
253953daebaSmrg   the library. No provision has been made for adding new ones
254953daebaSmrg   aside from rebuilding the library. It currently supports 122 of
255953daebaSmrg   the 139 languages named in ISO 639-1, 141 of the languages with
256953daebaSmrg   two-letter codes from ISO 639-2 and another 30 languages with
257953daebaSmrg   only three-letter codes. Languages with both two and three
258953daebaSmrg   letter codes are provided with only the two letter code.
259953daebaSmrg
260953daebaSmrg   For languages used in multiple territories with radically
261953daebaSmrg   different character sets, fontconfig includes per-territory
262953daebaSmrg   orthographies. This includes Azerbaijani, Kurdish, Pashto,
263953daebaSmrg   Tigrinya and Chinese.
264a6844aabSmrg
265953daebaSmrgConfiguration File Format
266a6844aabSmrg
267953daebaSmrg   Configuration files for fontconfig are stored in XML format;
268953daebaSmrg   this format makes external configuration tools easier to write
269953daebaSmrg   and ensures that they will generate syntactically correct
270953daebaSmrg   configuration files. As XML files are plain text, they can also
271953daebaSmrg   be manipulated by the expert user using a text editor.
272953daebaSmrg
273953daebaSmrg   The fontconfig document type definition resides in the external
274953daebaSmrg   entity "fonts.dtd"; this is normally stored in the default font
275953daebaSmrg   configuration directory (/etc/fonts). Each configuration file
276953daebaSmrg   should contain the following structure:
277953daebaSmrg        <?xml version="1.0"?>
278953daebaSmrg        <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
279953daebaSmrg        <fontconfig>
280953daebaSmrg        ...
281953daebaSmrg        </fontconfig>
2822c393a42Smrg
283953daebaSmrg<fontconfig>
2842c393a42Smrg
285953daebaSmrg   This is the top level element for a font configuration and can
286953daebaSmrg   contain <dir>, <cachedir>, <include>, <match> and <alias>
287953daebaSmrg   elements in any order.
288953daebaSmrg
289953daebaSmrg<dir prefix="default">
290953daebaSmrg
291953daebaSmrg   This element contains a directory name which will be scanned
292953daebaSmrg   for font files to include in the set of available fonts. If
293953daebaSmrg   'prefix' is set to "xdg", the value in the XDG_DATA_HOME
294953daebaSmrg   environment variable will be added as the path prefix. please
295953daebaSmrg   see XDG Base Directory Specification for more details.
296953daebaSmrg
297953daebaSmrg<cachedir prefix="default">
298953daebaSmrg
299953daebaSmrg   This element contains a directory name that is supposed to be
300953daebaSmrg   stored or read the cache of font information. If multiple
301953daebaSmrg   elements are specified in the configuration file, the directory
302953daebaSmrg   that can be accessed first in the list will be used to store
303953daebaSmrg   the cache files. If it starts with '~', it refers to a
304953daebaSmrg   directory in the users home directory. If 'prefix' is set to
305953daebaSmrg   "xdg", the value in the XDG_CACHE_HOME environment variable
306953daebaSmrg   will be added as the path prefix. please see XDG Base Directory
307953daebaSmrg   Specification for more details. The default directory is
308953daebaSmrg   ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
309953daebaSmrg   named ``<hash value>-<architecture>.cache-<version>'', where
310953daebaSmrg   <version> is the fontconfig cache file version number
311953daebaSmrg   (currently 7).
312953daebaSmrg
313953daebaSmrg<include ignore_missing="no" prefix="default">
314953daebaSmrg
315953daebaSmrg   This element contains the name of an additional configuration
316953daebaSmrg   file or directory. If a directory, every file within that
317953daebaSmrg   directory starting with an ASCII digit (U+0030 - U+0039) and
318953daebaSmrg   ending with the string ``.conf'' will be processed in sorted
319953daebaSmrg   order. When the XML datatype is traversed by FcConfigParse, the
320953daebaSmrg   contents of the file(s) will also be incorporated into the
321953daebaSmrg   configuration by passing the filename(s) to
322953daebaSmrg   FcConfigLoadAndParse. If 'ignore_missing' is set to "yes"
323953daebaSmrg   instead of the default "no", a missing file or directory will
324953daebaSmrg   elicit no warning message from the library. If 'prefix' is set
325953daebaSmrg   to "xdg", the value in the XDG_CONFIG_HOME environment variable
326953daebaSmrg   will be added as the path prefix. please see XDG Base Directory
327ca08ab68Smrg   Specification for more details.
328ca08ab68Smrg
329953daebaSmrg<config>
330953daebaSmrg
331953daebaSmrg   This element provides a place to consolidate additional
332953daebaSmrg   configuration information. <config> can contain <blank> and
333953daebaSmrg   <rescan> elements in any order.
334953daebaSmrg
335953daebaSmrg<blank>
336953daebaSmrg
337953daebaSmrg   Fonts often include "broken" glyphs which appear in the
338953daebaSmrg   encoding but are drawn as blanks on the screen. Within the
339953daebaSmrg   <blank> element, place each Unicode characters which is
340953daebaSmrg   supposed to be blank in an <int> element. Characters outside of
341953daebaSmrg   this set which are drawn as blank will be elided from the set
342953daebaSmrg   of characters supported by the font.
343953daebaSmrg
344953daebaSmrg<rescan>
345953daebaSmrg
346953daebaSmrg   The <rescan> element holds an <int> element which indicates the
347953daebaSmrg   default interval between automatic checks for font
348953daebaSmrg   configuration changes. Fontconfig will validate all of the
349953daebaSmrg   configuration files and directories and automatically rebuild
350953daebaSmrg   the internal datastructures when this interval passes.
351953daebaSmrg
352953daebaSmrg<selectfont>
353953daebaSmrg
354953daebaSmrg   This element is used to black/white list fonts from being
355953daebaSmrg   listed or matched against. It holds acceptfont and rejectfont
356953daebaSmrg   elements.
357953daebaSmrg
358953daebaSmrg<acceptfont>
359ca08ab68Smrg
360953daebaSmrg   Fonts matched by an acceptfont element are "whitelisted"; such
361953daebaSmrg   fonts are explicitly included in the set of fonts used to
362953daebaSmrg   resolve list and match requests; including them in this list
363953daebaSmrg   protects them from being "blacklisted" by a rejectfont element.
364953daebaSmrg   Acceptfont elements include glob and pattern elements which are
365953daebaSmrg   used to match fonts.
366ca08ab68Smrg
367953daebaSmrg<rejectfont>
368ca08ab68Smrg
369953daebaSmrg   Fonts matched by an rejectfont element are "blacklisted"; such
370953daebaSmrg   fonts are excluded from the set of fonts used to resolve list
371953daebaSmrg   and match requests as if they didn't exist in the system.
372953daebaSmrg   Rejectfont elements include glob and pattern elements which are
373953daebaSmrg   used to match fonts.
3742c393a42Smrg
375953daebaSmrg<glob>
3762c393a42Smrg
377953daebaSmrg   Glob elements hold shell-style filename matching patterns
378953daebaSmrg   (including ? and *) which match fonts based on their complete
379953daebaSmrg   pathnames. This can be used to exclude a set of directories
380953daebaSmrg   (/usr/share/fonts/uglyfont*), or particular font file types
381953daebaSmrg   (*.pcf.gz), but the latter mechanism relies rather heavily on
382953daebaSmrg   filenaming conventions which can't be relied upon. Note that
383953daebaSmrg   globs only apply to directories, not to individual fonts.
384ca08ab68Smrg
385953daebaSmrg<pattern>
386ca08ab68Smrg
387953daebaSmrg   Pattern elements perform list-style matching on incoming fonts;
388953daebaSmrg   that is, they hold a list of elements and associated values. If
389953daebaSmrg   all of those elements have a matching value, then the pattern
390953daebaSmrg   matches the font. This can be used to select fonts based on
391953daebaSmrg   attributes of the font (scalable, bold, etc), which is a more
392953daebaSmrg   reliable mechanism than using file extensions. Pattern elements
393953daebaSmrg   include patelt elements.
394953daebaSmrg
395953daebaSmrg<patelt name="property">
396953daebaSmrg
397953daebaSmrg   Patelt elements hold a single pattern element and list of
398953daebaSmrg   values. They must have a 'name' attribute which indicates the
399953daebaSmrg   pattern element name. Patelt elements include int, double,
400953daebaSmrg   string, matrix, bool, charset and const elements.
401953daebaSmrg
402953daebaSmrg<match target="pattern">
403953daebaSmrg
404953daebaSmrg   This element holds first a (possibly empty) list of <test>
405953daebaSmrg   elements and then a (possibly empty) list of <edit> elements.
406953daebaSmrg   Patterns which match all of the tests are subjected to all the
407953daebaSmrg   edits. If 'target' is set to "font" instead of the default
408953daebaSmrg   "pattern", then this element applies to the font name resulting
409953daebaSmrg   from a match rather than a font pattern to be matched. If
410953daebaSmrg   'target' is set to "scan", then this element applies when the
411953daebaSmrg   font is scanned to build the fontconfig database.
412953daebaSmrg
413953daebaSmrg<test qual="any" name="property" target="default" compare="eq">
414953daebaSmrg
415953daebaSmrg   This element contains a single value which is compared with the
416953daebaSmrg   target ('pattern', 'font', 'scan' or 'default') property
417953daebaSmrg   "property" (substitute any of the property names seen above).
418953daebaSmrg   'compare' can be one of "eq", "not_eq", "less", "less_eq",
419953daebaSmrg   "more", "more_eq", "contains" or "not_contains". 'qual' may
420953daebaSmrg   either be the default, "any", in which case the match succeeds
421953daebaSmrg   if any value associated with the property matches the test
422953daebaSmrg   value, or "all", in which case all of the values associated
423953daebaSmrg   with the property must match the test value. 'ignore-blanks'
424953daebaSmrg   takes a boolean value. if 'ignore-blanks' is set "true", any
425953daebaSmrg   blanks in the string will be ignored on its comparison. this
426953daebaSmrg   takes effects only when compare="eq" or compare="not_eq". When
427953daebaSmrg   used in a <match target="font"> element, the target= attribute
428953daebaSmrg   in the <test> element selects between matching the original
429953daebaSmrg   pattern or the font. "default" selects whichever target the
430953daebaSmrg   outer <match> element has selected.
431953daebaSmrg
432953daebaSmrg<edit name="property" mode="assign" binding="weak">
433953daebaSmrg
434953daebaSmrg   This element contains a list of expression elements (any of the
435953daebaSmrg   value or operator elements). The expression elements are
436953daebaSmrg   evaluated at run-time and modify the property "property". The
437953daebaSmrg   modification depends on whether "property" was matched by one
438953daebaSmrg   of the associated <test> elements, if so, the modification may
439953daebaSmrg   affect the first matched value. Any values inserted into the
440953daebaSmrg   property are given the indicated binding ("strong", "weak" or
441953daebaSmrg   "same") with "same" binding using the value from the matched
442953daebaSmrg   pattern element. 'mode' is one of:
443953daebaSmrg  Mode                    With Match              Without Match
444953daebaSmrg  ---------------------------------------------------------------------
445953daebaSmrg  "assign"                Replace matching value  Replace all values
446953daebaSmrg  "assign_replace"        Replace all values      Replace all values
447953daebaSmrg  "prepend"               Insert before matching  Insert at head of list
448953daebaSmrg  "prepend_first"         Insert at head of list  Insert at head of list
449953daebaSmrg  "append"                Append after matching   Append at end of list
450953daebaSmrg  "append_last"           Append at end of list   Append at end of list
451953daebaSmrg  "delete"                Delete matching value   Delete all values
452953daebaSmrg  "delete_all"            Delete all values       Delete all values
453953daebaSmrg
454953daebaSmrg<int>, <double>, <string>, <bool>
455953daebaSmrg
456953daebaSmrg   These elements hold a single value of the indicated type.
457953daebaSmrg   <bool> elements hold either true or false. An important
458953daebaSmrg   limitation exists in the parsing of floating point numbers --
459953daebaSmrg   fontconfig requires that the mantissa start with a digit, not a
460953daebaSmrg   decimal point, so insert a leading zero for purely fractional
461953daebaSmrg   values (e.g. use 0.5 instead of .5 and -0.5 instead of -.5).
462953daebaSmrg
463953daebaSmrg<matrix>
464953daebaSmrg
465953daebaSmrg   This element holds four numerical expressions of an affine
466953daebaSmrg   transformation. At their simplest these will be four <double>
467953daebaSmrg   elements but they can also be more involved expressions.
468953daebaSmrg
469953daebaSmrg<range>
470953daebaSmrg
471953daebaSmrg   This element holds the two <int> elements of a range
472953daebaSmrg   representation.
473953daebaSmrg
474953daebaSmrg<charset>
475953daebaSmrg
476953daebaSmrg   This element holds at least one <int> element of an Unicode
477953daebaSmrg   code point or more.
478953daebaSmrg
479953daebaSmrg<langset>
480953daebaSmrg
481953daebaSmrg   This element holds at least one <string> element of a
482953daebaSmrg   RFC-3066-style languages or more.
483953daebaSmrg
484953daebaSmrg<name>
485953daebaSmrg
486953daebaSmrg   Holds a property name. Evaluates to the first value from the
487953daebaSmrg   property of the pattern. If the 'target' attribute is not
488953daebaSmrg   present, it will default to 'default', in which case the
489953daebaSmrg   property is returned from the font pattern during a
490953daebaSmrg   target="font" match, and to the pattern during a
491953daebaSmrg   target="pattern" match. The attribute can also take the values
492953daebaSmrg   'font' or 'pattern' to explicitly choose which pattern to use.
493953daebaSmrg   It is an error to use a target of 'font' in a match that has
494953daebaSmrg   target="pattern".
495953daebaSmrg
496953daebaSmrg<const>
497953daebaSmrg
498953daebaSmrg   Holds the name of a constant; these are always integers and
499953daebaSmrg   serve as symbolic names for common font values:
500953daebaSmrg  Constant        Property        Value
501953daebaSmrg  -------------------------------------
502953daebaSmrg  thin            weight          0
503953daebaSmrg  extralight      weight          40
504953daebaSmrg  ultralight      weight          40
505953daebaSmrg  light           weight          50
506953daebaSmrg  demilight       weight          55
507953daebaSmrg  semilight       weight          55
508953daebaSmrg  book            weight          75
509953daebaSmrg  regular         weight          80
510953daebaSmrg  normal          weight          80
511953daebaSmrg  medium          weight          100
512953daebaSmrg  demibold        weight          180
513953daebaSmrg  semibold        weight          180
514953daebaSmrg  bold            weight          200
515953daebaSmrg  extrabold       weight          205
516953daebaSmrg  black           weight          210
517953daebaSmrg  heavy           weight          210
518953daebaSmrg  roman           slant           0
519953daebaSmrg  italic          slant           100
520953daebaSmrg  oblique         slant           110
521953daebaSmrg  ultracondensed  width           50
522953daebaSmrg  extracondensed  width           63
523953daebaSmrg  condensed       width           75
524953daebaSmrg  semicondensed   width           87
525953daebaSmrg  normal          width           100
526953daebaSmrg  semiexpanded    width           113
527953daebaSmrg  expanded        width           125
528953daebaSmrg  extraexpanded   width           150
529953daebaSmrg  ultraexpanded   width           200
530953daebaSmrg  proportional    spacing         0
531953daebaSmrg  dual            spacing         90
532953daebaSmrg  mono            spacing         100
533953daebaSmrg  charcell        spacing         110
534953daebaSmrg  unknown         rgba            0
535953daebaSmrg  rgb             rgba            1
536953daebaSmrg  bgr             rgba            2
537953daebaSmrg  vrgb            rgba            3
538953daebaSmrg  vbgr            rgba            4
539953daebaSmrg  none            rgba            5
540953daebaSmrg  lcdnone         lcdfilter       0
541953daebaSmrg  lcddefault      lcdfilter       1
542953daebaSmrg  lcdlight        lcdfilter       2
543953daebaSmrg  lcdlegacy       lcdfilter       3
544953daebaSmrg  hintnone        hintstyle       0
545953daebaSmrg  hintslight      hintstyle       1
546953daebaSmrg  hintmedium      hintstyle       2
547953daebaSmrg  hintfull        hintstyle       3
548953daebaSmrg
549953daebaSmrg<or>, <and>, <plus>, <minus>, <times>, <divide>
550953daebaSmrg
551953daebaSmrg   These elements perform the specified operation on a list of
552953daebaSmrg   expression elements. <or> and <and> are boolean, not bitwise.
553953daebaSmrg
554953daebaSmrg<eq>, <not_eq>, <less>, <less_eq>, <more>, <more_eq>, <contains>,
555953daebaSmrg<not_contains
5562c393a42Smrg
557ca08ab68Smrg   These elements compare two values, producing a boolean result.
5582c393a42Smrg
559953daebaSmrg<not>
5602c393a42Smrg
561ca08ab68Smrg   Inverts the boolean sense of its one expression element
5622c393a42Smrg
563953daebaSmrg<if>
5642c393a42Smrg
565953daebaSmrg   This element takes three expression elements; if the value of
566953daebaSmrg   the first is true, it produces the value of the second,
567953daebaSmrg   otherwise it produces the value of the third.
5682c393a42Smrg
569953daebaSmrg<alias>
5702c393a42Smrg
571953daebaSmrg   Alias elements provide a shorthand notation for the set of
572953daebaSmrg   common match operations needed to substitute one font family
573953daebaSmrg   for another. They contain a <family> element followed by
574953daebaSmrg   optional <prefer>, <accept> and <default> elements. Fonts
575953daebaSmrg   matching the <family> element are edited to prepend the list of
576953daebaSmrg   <prefer>ed families before the matching <family>, append the
577953daebaSmrg   <accept>able families after the matching <family> and append
578953daebaSmrg   the <default> families to the end of the family list.
579ca08ab68Smrg
580953daebaSmrg<family>
581ca08ab68Smrg
582ca08ab68Smrg   Holds a single font family name
583ca08ab68Smrg
584953daebaSmrg<prefer>, <accept>, <default>
585ca08ab68Smrg
586953daebaSmrg   These hold a list of <family> elements to be used by the
587953daebaSmrg   <alias> element.
5882c393a42Smrg
5892c393a42SmrgEXAMPLE CONFIGURATION FILE
5902c393a42Smrg
591953daebaSmrgSystem configuration file
5922c393a42Smrg
593ca08ab68Smrg   This is an example of a system-wide configuration file
5942c393a42Smrg<?xml version="1.0"?>
5952c393a42Smrg<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
5962c393a42Smrg<!-- /etc/fonts/fonts.conf file to configure system font access -->
5972c393a42Smrg<fontconfig>
5982c393a42Smrg<!--
5992c393a42Smrg        Find fonts in these directories
6002c393a42Smrg-->
6012c393a42Smrg<dir>/usr/share/fonts</dir>
6022c393a42Smrg<dir>/usr/X11R6/lib/X11/fonts</dir>
6032c393a42Smrg
6042c393a42Smrg<!--
6052c393a42Smrg        Accept deprecated 'mono' alias, replacing it with 'monospace'
6062c393a42Smrg-->
6072c393a42Smrg<match target="pattern">
6082c393a42Smrg        <test qual="any" name="family"><string>mono</string></test>
609953daebaSmrg        <edit name="family" mode="assign"><string>monospace</string></ed
610953daebaSmrgit>
6112c393a42Smrg</match>
6122c393a42Smrg
6132c393a42Smrg<!--
614ca08ab68Smrg        Names not including any well known alias are given 'sans-serif'
6152c393a42Smrg-->
6162c393a42Smrg<match target="pattern">
617953daebaSmrg        <test qual="all" name="family" mode="not_eq"><string>sans-serif<
618953daebaSmrg/string></test>
619953daebaSmrg        <test qual="all" name="family" mode="not_eq"><string>serif</stri
620953daebaSmrgng></test>
621953daebaSmrg        <test qual="all" name="family" mode="not_eq"><string>monospace</
622953daebaSmrgstring></test>
623953daebaSmrg        <edit name="family" mode="append_last"><string>sans-serif</strin
624953daebaSmrgg></edit>
6252c393a42Smrg</match>
6262c393a42Smrg
6272c393a42Smrg<!--
6282c393a42Smrg        Load per-user customization file, but don't complain
6292c393a42Smrg        if it doesn't exist
6302c393a42Smrg-->
631953daebaSmrg<include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</includ
632953daebaSmrge>
6332c393a42Smrg
6342c393a42Smrg<!--
6352c393a42Smrg        Load local customization files, but don't complain
6362c393a42Smrg        if there aren't any
6372c393a42Smrg-->
6382c393a42Smrg<include ignore_missing="yes">conf.d</include>
6392c393a42Smrg<include ignore_missing="yes">local.conf</include>
6402c393a42Smrg
6412c393a42Smrg<!--
6422c393a42Smrg        Alias well known font names to available TrueType fonts.
6432c393a42Smrg        These substitute TrueType faces for similar Type1
6442c393a42Smrg        faces to improve screen appearance.
6452c393a42Smrg-->
6462c393a42Smrg<alias>
6472c393a42Smrg        <family>Times</family>
6482c393a42Smrg        <prefer><family>Times New Roman</family></prefer>
6492c393a42Smrg        <default><family>serif</family></default>
6502c393a42Smrg</alias>
6512c393a42Smrg<alias>
6522c393a42Smrg        <family>Helvetica</family>
6532c393a42Smrg        <prefer><family>Arial</family></prefer>
6542c393a42Smrg        <default><family>sans</family></default>
6552c393a42Smrg</alias>
6562c393a42Smrg<alias>
6572c393a42Smrg        <family>Courier</family>
6582c393a42Smrg        <prefer><family>Courier New</family></prefer>
6592c393a42Smrg        <default><family>monospace</family></default>
6602c393a42Smrg</alias>
6612c393a42Smrg
6622c393a42Smrg<!--
6632c393a42Smrg        Provide required aliases for standard names
6642c393a42Smrg        Do these after the users configuration file so that
6652c393a42Smrg        any aliases there are used preferentially
6662c393a42Smrg-->
6672c393a42Smrg<alias>
6682c393a42Smrg        <family>serif</family>
6692c393a42Smrg        <prefer><family>Times New Roman</family></prefer>
6702c393a42Smrg</alias>
6712c393a42Smrg<alias>
6722c393a42Smrg        <family>sans</family>
6732c393a42Smrg        <prefer><family>Arial</family></prefer>
6742c393a42Smrg</alias>
6752c393a42Smrg<alias>
6762c393a42Smrg        <family>monospace</family>
6772c393a42Smrg        <prefer><family>Andale Mono</family></prefer>
6782c393a42Smrg</alias>
679ca08ab68Smrg
680ca08ab68Smrg<--
681ca08ab68Smrg        The example of the requirements of OR operator;
682ca08ab68Smrg        If the 'family' contains 'Courier New' OR 'Courier'
683ca08ab68Smrg        add 'monospace' as the alternative
684ca08ab68Smrg-->
685ca08ab68Smrg<match target="pattern">
686ca08ab68Smrg        <test name="family" mode="eq">
687ca08ab68Smrg                <string>Courier New</string>
688ca08ab68Smrg        </test>
689ca08ab68Smrg        <edit name="family" mode="prepend">
690ca08ab68Smrg                <string>monospace</string>
691ca08ab68Smrg        </edit>
692ca08ab68Smrg</match>
693ca08ab68Smrg<match target="pattern">
694ca08ab68Smrg        <test name="family" mode="eq">
695ca08ab68Smrg                <string>Courier</string>
696ca08ab68Smrg        </test>
697ca08ab68Smrg        <edit name="family" mode="prepend">
698ca08ab68Smrg                <string>monospace</string>
699ca08ab68Smrg        </edit>
700ca08ab68Smrg</match>
701ca08ab68Smrg
7022c393a42Smrg</fontconfig>
7032c393a42Smrg
704953daebaSmrgUser configuration file
705a6844aabSmrg
706953daebaSmrg   This is an example of a per-user configuration file that lives
707953daebaSmrg   in $XDG_CONFIG_HOME/fontconfig/fonts.conf
708953daebaSmrg<?xml version="1.0"?>
709953daebaSmrg<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
710953daebaSmrg<!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configurat
711953daebaSmrgion -->
712953daebaSmrg<fontconfig>
713ca08ab68Smrg
714953daebaSmrg<!--
715953daebaSmrg        Private font directory
716953daebaSmrg-->
717953daebaSmrg<dir prefix="xdg">fonts</dir>
7182c393a42Smrg
719953daebaSmrg<!--
720953daebaSmrg        use rgb sub-pixel ordering to improve glyph appearance on
721953daebaSmrg        LCD screens.  Changes affecting rendering, but not matching
722953daebaSmrg        should always use target="font".
723953daebaSmrg-->
724953daebaSmrg<match target="font">
725953daebaSmrg        <edit name="rgba" mode="assign"><const>rgb</const></edit>
726953daebaSmrg</match>
727953daebaSmrg<!--
728953daebaSmrg        use WenQuanYi Zen Hei font when serif is requested for Chinese
729953daebaSmrg-->
730953daebaSmrg<match>
731953daebaSmrg        <!--
732953daebaSmrg                If you don't want to use WenQuanYi Zen Hei font for zh-t
733953daebaSmrgw etc,
734953daebaSmrg                you can use zh-cn instead of zh.
735953daebaSmrg                Please note, even if you set zh-cn, it still matches zh.
736953daebaSmrg                if you don't like it, you can use compare="eq"
737953daebaSmrg                instead of compare="contains".
738953daebaSmrg        -->
739953daebaSmrg        <test name="lang" compare="contains">
740953daebaSmrg                <string>zh</string>
741953daebaSmrg        </test>
742953daebaSmrg        <test name="family">
743953daebaSmrg                <string>serif</string>
744953daebaSmrg        </test>
745953daebaSmrg        <edit name="family" mode="prepend">
746953daebaSmrg                <string>WenQuanYi Zen Hei</string>
747953daebaSmrg        </edit>
748953daebaSmrg</match>
749953daebaSmrg<!--
750953daebaSmrg        use VL Gothic font when sans-serif is requested for Japanese
751953daebaSmrg-->
752953daebaSmrg<match>
753953daebaSmrg        <test name="lang" compare="contains">
754953daebaSmrg                <string>ja</string>
755953daebaSmrg        </test>
756953daebaSmrg        <test name="family">
757953daebaSmrg                <string>sans-serif</string>
758953daebaSmrg        </test>
759953daebaSmrg        <edit name="family" mode="prepend">
760953daebaSmrg                <string>VL Gothic</string>
761953daebaSmrg        </edit>
762953daebaSmrg</match>
763953daebaSmrg</fontconfig>
764a6844aabSmrg
765ca08ab68SmrgFiles
7662c393a42Smrg
767953daebaSmrg   fonts.conf contains configuration information for the
768953daebaSmrg   fontconfig library consisting of directories to look at for
769953daebaSmrg   font information as well as instructions on editing program
770953daebaSmrg   specified font patterns before attempting to match the
771953daebaSmrg   available fonts. It is in XML format.
7722c393a42Smrg
773ca08ab68Smrg   conf.d is the conventional name for a directory of additional
774953daebaSmrg   configuration files managed by external applications or the
775953daebaSmrg   local administrator. The filenames starting with decimal digits
776953daebaSmrg   are sorted in lexicographic order and used as additional
777953daebaSmrg   configuration files. All of these files are in XML format. The
778953daebaSmrg   master fonts.conf file references this directory in an
779953daebaSmrg   <include> directive.
780953daebaSmrg
781953daebaSmrg   fonts.dtd is a DTD that describes the format of the
782953daebaSmrg   configuration files.
783953daebaSmrg
784953daebaSmrg   $XDG_CONFIG_HOME/fontconfig/conf.d and ~/.fonts.conf.d is the
785953daebaSmrg   conventional name for a per-user directory of (typically
786953daebaSmrg   auto-generated) configuration files, although the actual
787953daebaSmrg   location is specified in the global fonts.conf file. please
788953daebaSmrg   note that ~/.fonts.conf.d is deprecated now. it will not be
789ca08ab68Smrg   read by default in the future version.
790ca08ab68Smrg
791ca08ab68Smrg   $XDG_CONFIG_HOME/fontconfig/fonts.conf and ~/.fonts.conf is the
792953daebaSmrg   conventional location for per-user font configuration, although
793953daebaSmrg   the actual location is specified in the global fonts.conf file.
794953daebaSmrg   please note that ~/.fonts.conf is deprecated now. it will not
795953daebaSmrg   be read by default in the future version.
796953daebaSmrg
797953daebaSmrg   $XDG_CACHE_HOME/fontconfig/*.cache-* and
798953daebaSmrg   ~/.fontconfig/*.cache-* is the conventional repository of font
799953daebaSmrg   information that isn't found in the per-directory caches. This
800953daebaSmrg   file is automatically maintained by fontconfig. please note
801953daebaSmrg   that ~/.fontconfig/*.cache-* is deprecated now. it will not be
802ca08ab68Smrg   read by default in the future version.
8032c393a42Smrg
804ca08ab68SmrgEnvironment variables
8052c393a42Smrg
806953daebaSmrg   FONTCONFIG_FILE is used to override the default configuration
807953daebaSmrg   file.
8082c393a42Smrg
809953daebaSmrg   FONTCONFIG_PATH is used to override the default configuration
810953daebaSmrg   directory.
8112c393a42Smrg
812ca08ab68Smrg   FC_DEBUG is used to output the detailed debugging messages. see
813953daebaSmrg   Debugging Applications section for more details.
814953daebaSmrg
815953daebaSmrg   FC_DBG_MATCH_FILTER is used to filter out the patterns. this
816953daebaSmrg   takes a comma-separated list of object names and effects only
817953daebaSmrg   when FC_DEBUG has MATCH2. see Debugging Applications section
818953daebaSmrg   for more details.
819a6844aabSmrg
820953daebaSmrg   FC_LANG is used to specify the default language as the weak
821953daebaSmrg   binding in the query. if this isn't set, the default language
822953daebaSmrg   will be determined from current locale.
823953daebaSmrg
824953daebaSmrg   FONTCONFIG_USE_MMAP is used to control the use of mmap(2) for
825953daebaSmrg   the cache files if available. this take a boolean value.
826953daebaSmrg   fontconfig will checks if the cache files are stored on the
827953daebaSmrg   filesystem that is safe to use mmap(2). explicitly setting this
828953daebaSmrg   environment variable will causes skipping this check and
829953daebaSmrg   enforce to use or not use mmap(2) anyway.
8302c393a42Smrg
8312c393a42SmrgSee Also
8322c393a42Smrg
833ca08ab68Smrg   fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1)
8342c393a42Smrg
8352c393a42SmrgVersion
8362c393a42Smrg
837953daebaSmrg   Fontconfig version 2.12.4
838