fontconfig-user.txt revision a6844aab
1a6844aabSmrgfonts-conf
22c393a42Smrg
32c393a42SmrgName
42c393a42Smrg
5a6844aabSmrgfonts.conf -- Font configuration files
62c393a42Smrg
72c393a42SmrgSynopsis
82c393a42Smrg
92c393a42Smrg   /etc/fonts/fonts.conf
102c393a42Smrg   /etc/fonts/fonts.dtd
112c393a42Smrg   /etc/fonts/conf.d
12a6844aabSmrg   ~/.fonts.conf.d
132c393a42Smrg   ~/.fonts.conf
142c393a42Smrg
152c393a42SmrgDescription
162c393a42Smrg
17a6844aabSmrgFontconfig is a library designed to provide system-wide font configuration,
18a6844aabSmrgcustomization and application access.
192c393a42Smrg
202c393a42SmrgFunctional Overview
212c393a42Smrg
22a6844aabSmrgFontconfig contains two essential modules, the configuration module which
23a6844aabSmrgbuilds an internal configuration from XML files and the matching module which
24a6844aabSmrgaccepts font patterns and returns the nearest matching font.
252c393a42Smrg
262c393a42SmrgFont Configuration
272c393a42Smrg
28a6844aabSmrgThe configuration module consists of the FcConfig datatype, libexpat and
29a6844aabSmrgFcConfigParse which walks over an XML tree and amends a configuration with data
30a6844aabSmrgfound within. From an external perspective, configuration of the library
31a6844aabSmrgconsists of generating a valid XML tree and feeding that to FcConfigParse. The
32a6844aabSmrgonly other mechanism provided to applications for changing the running
33a6844aabSmrgconfiguration is to add fonts and directories to the list of
34a6844aabSmrgapplication-provided font files.
35a6844aabSmrg
36a6844aabSmrgThe intent is to make font configurations relatively static, and shared by as
37a6844aabSmrgmany applications as possible. It is hoped that this will lead to more stable
38a6844aabSmrgfont selection when passing names from one application to another. XML was
39a6844aabSmrgchosen as a configuration file format because it provides a format which is
40a6844aabSmrgeasy for external agents to edit while retaining the correct structure and
41a6844aabSmrgsyntax.
42a6844aabSmrg
43a6844aabSmrgFont configuration is separate from font matching; applications needing to do
44a6844aabSmrgtheir own matching can access the available fonts from the library and perform
45a6844aabSmrgprivate matching. The intent is to permit applications to pick and choose
46a6844aabSmrgappropriate functionality from the library instead of forcing them to choose
47a6844aabSmrgbetween this library and a private configuration mechanism. The hope is that
48a6844aabSmrgthis will ensure that configuration of fonts for all applications can be
49a6844aabSmrgcentralized in one place. Centralizing font configuration will simplify and
50a6844aabSmrgregularize font installation and customization.
512c393a42Smrg
522c393a42SmrgFont Properties
532c393a42Smrg
54a6844aabSmrgWhile font patterns may contain essentially any properties, there are some well
55a6844aabSmrgknown properties with associated types. Fontconfig uses some of these
56a6844aabSmrgproperties for font matching and font completion. Others are provided as a
57a6844aabSmrgconvenience for the applications' rendering mechanism.
58a6844aabSmrg
592c393a42Smrg  Property        Type    Description
602c393a42Smrg  --------------------------------------------------------------
612c393a42Smrg  family          String  Font family names
622c393a42Smrg  familylang      String  Languages corresponding to each family
632c393a42Smrg  style           String  Font style. Overrides weight and slant
642c393a42Smrg  stylelang       String  Languages corresponding to each style
652c393a42Smrg  fullname        String  Font full names (often includes style)
662c393a42Smrg  fullnamelang    String  Languages corresponding to each fullname
672c393a42Smrg  slant           Int     Italic, oblique or roman
682c393a42Smrg  weight          Int     Light, medium, demibold, bold or black
692c393a42Smrg  size            Double  Point size
702c393a42Smrg  width           Int     Condensed, normal or expanded
712c393a42Smrg  aspect          Double  Stretches glyphs horizontally before hinting
722c393a42Smrg  pixelsize       Double  Pixel size
73a6844aabSmrg  spacing         Int     Proportional, dual-width, monospace or charcell
742c393a42Smrg  foundry         String  Font foundry name
752c393a42Smrg  antialias       Bool    Whether glyphs can be antialiased
762c393a42Smrg  hinting         Bool    Whether the rasterizer should use hinting
772c393a42Smrg  hintstyle       Int     Automatic hinting style
782c393a42Smrg  verticallayout  Bool    Use vertical layout
792c393a42Smrg  autohint        Bool    Use autohinter instead of normal hinter
802c393a42Smrg  globaladvance   Bool    Use font global advance data
812c393a42Smrg  file            String  The filename holding the font
822c393a42Smrg  index           Int     The index of the font within the file
832c393a42Smrg  ftface          FT_Face Use the specified FreeType face object
842c393a42Smrg  rasterizer      String  Which rasterizer is in use
852c393a42Smrg  outline         Bool    Whether the glyphs are outlines
862c393a42Smrg  scalable        Bool    Whether glyphs can be scaled
872c393a42Smrg  scale           Double  Scale factor for point->pixel conversions
882c393a42Smrg  dpi             Double  Target dots per inch
892c393a42Smrg  rgba            Int     unknown, rgb, bgr, vrgb, vbgr,
902c393a42Smrg                          none - subpixel geometry
912c393a42Smrg  lcdfilter       Int     Type of LCD filter
922c393a42Smrg  minspace        Bool    Eliminate leading from line spacing
932c393a42Smrg  charset         CharSet Unicode chars encoded by the font
942c393a42Smrg  lang            String  List of RFC-3066-style languages this
952c393a42Smrg                          font supports
962c393a42Smrg  fontversion     Int     Version number of the font
972c393a42Smrg  capability      String  List of layout capabilities in the font
98a6844aabSmrg  embolden        Bool    Rasterizer should synthetically embolden the font
99a6844aabSmrg
1002c393a42Smrg
1012c393a42SmrgFont Matching
1022c393a42Smrg
103a6844aabSmrgFontconfig performs matching by measuring the distance from a provided pattern
104a6844aabSmrgto all of the available fonts in the system. The closest matching font is
105a6844aabSmrgselected. This ensures that a font will always be returned, but doesn't ensure
106a6844aabSmrgthat it is anything like the requested pattern.
107a6844aabSmrg
108a6844aabSmrgFont matching starts with an application constructed pattern. The desired
109a6844aabSmrgattributes of the resulting font are collected together in a pattern. Each
110a6844aabSmrgproperty of the pattern can contain one or more values; these are listed in
111a6844aabSmrgpriority order; matches earlier in the list are considered "closer" than
112a6844aabSmrgmatches later in the list.
113a6844aabSmrg
114a6844aabSmrgThe initial pattern is modified by applying the list of editing instructions
115a6844aabSmrgspecific to patterns found in the configuration; each consists of a match
116a6844aabSmrgpredicate and a set of editing operations. They are executed in the order they
117a6844aabSmrgappeared in the configuration. Each match causes the associated sequence of
118a6844aabSmrgediting operations to be applied.
119a6844aabSmrg
120a6844aabSmrgAfter the pattern has been edited, a sequence of default substitutions are
121a6844aabSmrgperformed to canonicalize the set of available properties; this avoids the need
122a6844aabSmrgfor the lower layers to constantly provide default values for various font
123a6844aabSmrgproperties during rendering.
124a6844aabSmrg
125a6844aabSmrgThe canonical font pattern is finally matched against all available fonts. The
126a6844aabSmrgdistance from the pattern to the font is measured for each of several
127a6844aabSmrgproperties: foundry, charset, family, lang, spacing, pixelsize, style, slant,
128a6844aabSmrgweight, antialias, rasterizer and outline. This list is in priority order --
129a6844aabSmrgresults of comparing earlier elements of this list weigh more heavily than
130a6844aabSmrglater elements.
131a6844aabSmrg
132a6844aabSmrgThere is one special case to this rule; family names are split into two
133a6844aabSmrgbindings; strong and weak. Strong family names are given greater precedence in
134a6844aabSmrgthe match than lang elements while weak family names are given lower precedence
135a6844aabSmrgthan lang elements. This permits the document language to drive font selection
136a6844aabSmrgwhen any document specified font is unavailable.
137a6844aabSmrg
138a6844aabSmrgThe pattern representing that font is augmented to include any properties found
139a6844aabSmrgin the pattern but not found in the font itself; this permits the application
140a6844aabSmrgto pass rendering instructions or any other data through the matching system.
141a6844aabSmrgFinally, the list of editing instructions specific to fonts found in the
142a6844aabSmrgconfiguration are applied to the pattern. This modified pattern is returned to
143a6844aabSmrgthe application.
144a6844aabSmrg
145a6844aabSmrgThe return value contains sufficient information to locate and rasterize the
146a6844aabSmrgfont, including the file name, pixel size and other rendering data. As none of
147a6844aabSmrgthe information involved pertains to the FreeType library, applications are
148a6844aabSmrgfree to use any rasterization engine or even to take the identified font file
149a6844aabSmrgand access it directly.
150a6844aabSmrg
151a6844aabSmrgThe match/edit sequences in the configuration are performed in two passes
152a6844aabSmrgbecause there are essentially two different operations necessary -- the first
153a6844aabSmrgis to modify how fonts are selected; aliasing families and adding suitable
154a6844aabSmrgdefaults. The second is to modify how the selected fonts are rasterized. Those
155a6844aabSmrgmust apply to the selected font, not the original pattern as false matches will
156a6844aabSmrgoften occur.
1572c393a42Smrg
1582c393a42SmrgFont Names
1592c393a42Smrg
160a6844aabSmrgFontconfig provides a textual representation for patterns that the library can
161a6844aabSmrgboth accept and generate. The representation is in three parts, first a list of
162a6844aabSmrgfamily names, second a list of point sizes and finally a list of additional
163a6844aabSmrgproperties:
164a6844aabSmrg
1652c393a42Smrg        <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...
1662c393a42Smrg
167a6844aabSmrg
168a6844aabSmrgValues in a list are separated with commas. The name needn't include either
169a6844aabSmrgfamilies or point sizes; they can be elided. In addition, there are symbolic
170a6844aabSmrgconstants that simultaneously indicate both a name and a value. Here are some
171a6844aabSmrgexamples:
172a6844aabSmrg
1732c393a42Smrg  Name                            Meaning
1742c393a42Smrg  ----------------------------------------------------------
1752c393a42Smrg  Times-12                        12 point Times Roman
1762c393a42Smrg  Times-12:bold                   12 point Times Bold
1772c393a42Smrg  Courier:italic                  Courier Italic in the default size
1782c393a42Smrg  Monospace:matrix=1 .1 0 1       The users preferred monospace font
1792c393a42Smrg                                  with artificial obliquing
1802c393a42Smrg
181a6844aabSmrg
182a6844aabSmrgThe '\', '-', ':' and ',' characters in family names must be preceeded by a '\'
183a6844aabSmrgcharacter to avoid having them misinterpreted. Similarly, values containing '\
184a6844aabSmrg', '=', '_', ':' and ',' must also have them preceeded by a '\' character. The
185a6844aabSmrg'\' characters are stripped out of the family name and values as the font name
186a6844aabSmrgis read.
1872c393a42Smrg
1882c393a42SmrgDebugging Applications
1892c393a42Smrg
190a6844aabSmrgTo help diagnose font and applications problems, fontconfig is built with a
191a6844aabSmrglarge amount of internal debugging left enabled. It is controlled by means of
192a6844aabSmrgthe FC_DEBUG environment variable. The value of this variable is interpreted as
193a6844aabSmrga number, and each bit within that value controls different debugging messages.
194a6844aabSmrg
1952c393a42Smrg  Name         Value    Meaning
1962c393a42Smrg  ---------------------------------------------------------
1972c393a42Smrg  MATCH            1    Brief information about font matching
1982c393a42Smrg  MATCHV           2    Extensive font matching information
1992c393a42Smrg  EDIT             4    Monitor match/test/edit execution
2002c393a42Smrg  FONTSET          8    Track loading of font information at startup
2012c393a42Smrg  CACHE           16    Watch cache files being written
2022c393a42Smrg  CACHEV          32    Extensive cache file writing information
2032c393a42Smrg  PARSE           64    (no longer in use)
2042c393a42Smrg  SCAN           128    Watch font files being scanned to build caches
2052c393a42Smrg  SCANV          256    Verbose font file scanning information
2062c393a42Smrg  MEMORY         512    Monitor fontconfig memory usage
2072c393a42Smrg  CONFIG        1024    Monitor which config files are loaded
2082c393a42Smrg  LANGSET       2048    Dump char sets used to construct lang values
2092c393a42Smrg  OBJTYPES      4096    Display message when value typechecks fail
2102c393a42Smrg
211a6844aabSmrg
212a6844aabSmrgAdd the value of the desired debug levels together and assign that (in base 10)
213a6844aabSmrgto the FC_DEBUG environment variable before running the application. Output
214a6844aabSmrgfrom these statements is sent to stdout.
2152c393a42Smrg
2162c393a42SmrgLang Tags
2172c393a42Smrg
218a6844aabSmrgEach font in the database contains a list of languages it supports. This is
219a6844aabSmrgcomputed by comparing the Unicode coverage of the font with the orthography of
220a6844aabSmrgeach language. Languages are tagged using an RFC-3066 compatible naming and
221a6844aabSmrgoccur in two parts -- the ISO 639 language tag followed a hyphen and then by
222a6844aabSmrgthe ISO 3166 country code. The hyphen and country code may be elided.
223a6844aabSmrg
224a6844aabSmrgFontconfig has orthographies for several languages built into the library. No
225a6844aabSmrgprovision has been made for adding new ones aside from rebuilding the library.
226a6844aabSmrgIt currently supports 122 of the 139 languages named in ISO 639-1, 141 of the
227a6844aabSmrglanguages with two-letter codes from ISO 639-2 and another 30 languages with
228a6844aabSmrgonly three-letter codes. Languages with both two and three letter codes are
229a6844aabSmrgprovided with only the two letter code.
230a6844aabSmrg
231a6844aabSmrgFor languages used in multiple territories with radically different character
232a6844aabSmrgsets, fontconfig includes per-territory orthographies. This includes
233a6844aabSmrgAzerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
2342c393a42Smrg
2352c393a42SmrgConfiguration File Format
2362c393a42Smrg
237a6844aabSmrgConfiguration files for fontconfig are stored in XML format; this format makes
238a6844aabSmrgexternal configuration tools easier to write and ensures that they will
239a6844aabSmrggenerate syntactically correct configuration files. As XML files are plain
240a6844aabSmrgtext, they can also be manipulated by the expert user using a text editor.
241a6844aabSmrg
242a6844aabSmrgThe fontconfig document type definition resides in the external entity
243a6844aabSmrg"fonts.dtd"; this is normally stored in the default font configuration
244a6844aabSmrgdirectory (/etc/fonts). Each configuration file should contain the following
245a6844aabSmrgstructure:
2462c393a42Smrg
2472c393a42Smrg        <?xml version="1.0"?>
2482c393a42Smrg        <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
2492c393a42Smrg        <fontconfig>
2502c393a42Smrg        ...
2512c393a42Smrg        </fontconfig>
2522c393a42Smrg
253a6844aabSmrg
2542c393a42Smrg<fontconfig>
2552c393a42Smrg
256a6844aabSmrgThis is the top level element for a font configuration and can contain <dir>,
257a6844aabSmrg<cache>, <include>, <match> and <alias> elements in any order.
2582c393a42Smrg
2592c393a42Smrg<dir>
2602c393a42Smrg
261a6844aabSmrgThis element contains a directory name which will be scanned for font files to
262a6844aabSmrginclude in the set of available fonts.
2632c393a42Smrg
2642c393a42Smrg<cache>
2652c393a42Smrg
266a6844aabSmrgThis element contains a file name for the per-user cache of font information.
267a6844aabSmrgIf it starts with '~', it refers to a file in the users home directory. This
268a6844aabSmrgfile is used to hold information about fonts that isn't present in the
269a6844aabSmrgper-directory cache files. It is automatically maintained by the fontconfig
270a6844aabSmrglibrary. The default for this file is ``~/.fonts.cache-<version>'', where
271a6844aabSmrg<version> is the font configuration file version number (currently 2).
2722c393a42Smrg
2732c393a42Smrg<include ignore_missing="no">
2742c393a42Smrg
275a6844aabSmrgThis element contains the name of an additional configuration file or
276a6844aabSmrgdirectory. If a directory, every file within that directory starting with an
277a6844aabSmrgASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be
278a6844aabSmrgprocessed in sorted order. When the XML datatype is traversed by FcConfigParse,
279a6844aabSmrgthe contents of the file(s) will also be incorporated into the configuration by
280a6844aabSmrgpassing the filename(s) to FcConfigLoadAndParse. If 'ignore_missing' is set to
281a6844aabSmrg"yes" instead of the default "no", a missing file or directory will elicit no
282a6844aabSmrgwarning message from the library.
2832c393a42Smrg
2842c393a42Smrg<config>
2852c393a42Smrg
286a6844aabSmrgThis element provides a place to consolidate additional configuration
287a6844aabSmrginformation. <config> can contain <blank> and <rescan> elements in any order.
2882c393a42Smrg
2892c393a42Smrg<blank>
2902c393a42Smrg
291a6844aabSmrgFonts often include "broken" glyphs which appear in the encoding but are drawn
292a6844aabSmrgas blanks on the screen. Within the <blank> element, place each Unicode
293a6844aabSmrgcharacters which is supposed to be blank in an <int> element. Characters
294a6844aabSmrgoutside of this set which are drawn as blank will be elided from the set of
295a6844aabSmrgcharacters supported by the font.
2962c393a42Smrg
2972c393a42Smrg<rescan>
2982c393a42Smrg
299a6844aabSmrgThe <rescan> element holds an <int> element which indicates the default
300a6844aabSmrginterval between automatic checks for font configuration changes. Fontconfig
301a6844aabSmrgwill validate all of the configuration files and directories and automatically
302a6844aabSmrgrebuild the internal datastructures when this interval passes.
3032c393a42Smrg
3042c393a42Smrg<selectfont>
3052c393a42Smrg
306a6844aabSmrgThis element is used to black/white list fonts from being listed or matched
307a6844aabSmrgagainst. It holds acceptfont and rejectfont elements.
3082c393a42Smrg
3092c393a42Smrg<acceptfont>
3102c393a42Smrg
311a6844aabSmrgFonts matched by an acceptfont element are "whitelisted"; such fonts are
312a6844aabSmrgexplicitly included in the set of fonts used to resolve list and match
313a6844aabSmrgrequests; including them in this list protects them from being "blacklisted" by
314a6844aabSmrga rejectfont element. Acceptfont elements include glob and pattern elements
315a6844aabSmrgwhich are used to match fonts.
3162c393a42Smrg
3172c393a42Smrg<rejectfont>
3182c393a42Smrg
319a6844aabSmrgFonts matched by an rejectfont element are "blacklisted"; such fonts are
320a6844aabSmrgexcluded from the set of fonts used to resolve list and match requests as if
321a6844aabSmrgthey didn't exist in the system. Rejectfont elements include glob and pattern
322a6844aabSmrgelements which are used to match fonts.
3232c393a42Smrg
3242c393a42Smrg<glob>
3252c393a42Smrg
326a6844aabSmrgGlob elements hold shell-style filename matching patterns (including ? and *)
327a6844aabSmrgwhich match fonts based on their complete pathnames. This can be used to
328a6844aabSmrgexclude a set of directories (/usr/share/fonts/uglyfont*), or particular font
329a6844aabSmrgfile types (*.pcf.gz), but the latter mechanism relies rather heavily on
330a6844aabSmrgfilenaming conventions which can't be relied upon. Note that globs only apply
331a6844aabSmrgto directories, not to individual fonts.
3322c393a42Smrg
3332c393a42Smrg<pattern>
3342c393a42Smrg
335a6844aabSmrgPattern elements perform list-style matching on incoming fonts; that is, they
336a6844aabSmrghold a list of elements and associated values. If all of those elements have a
337a6844aabSmrgmatching value, then the pattern matches the font. This can be used to select
338a6844aabSmrgfonts based on attributes of the font (scalable, bold, etc), which is a more
339a6844aabSmrgreliable mechanism than using file extensions. Pattern elements include patelt
340a6844aabSmrgelements.
3412c393a42Smrg
3422c393a42Smrg<patelt name="property">
3432c393a42Smrg
344a6844aabSmrgPatelt elements hold a single pattern element and list of values. They must
345a6844aabSmrghave a 'name' attribute which indicates the pattern element name. Patelt
346a6844aabSmrgelements include int, double, string, matrix, bool, charset and const elements.
3472c393a42Smrg
3482c393a42Smrg<match target="pattern">
3492c393a42Smrg
350a6844aabSmrgThis element holds first a (possibly empty) list of <test> elements and then a
351a6844aabSmrg(possibly empty) list of <edit> elements. Patterns which match all of the tests
352a6844aabSmrgare subjected to all the edits. If 'target' is set to "font" instead of the
353a6844aabSmrgdefault "pattern", then this element applies to the font name resulting from a
354a6844aabSmrgmatch rather than a font pattern to be matched. If 'target' is set to "scan",
355a6844aabSmrgthen this element applies when the font is scanned to build the fontconfig
356a6844aabSmrgdatabase.
3572c393a42Smrg
3582c393a42Smrg<test qual="any" name="property" target="default" compare="eq">
3592c393a42Smrg
360a6844aabSmrgThis element contains a single value which is compared with the target
361a6844aabSmrg('pattern', 'font', 'scan' or 'default') property "property" (substitute any of
362a6844aabSmrgthe property names seen above). 'compare' can be one of "eq", "not_eq", "less",
363a6844aabSmrg"less_eq", "more", or "more_eq". 'qual' may either be the default, "any", in
364a6844aabSmrgwhich case the match succeeds if any value associated with the property matches
365a6844aabSmrgthe test value, or "all", in which case all of the values associated with the
366a6844aabSmrgproperty must match the test value. When used in a <match target="font">
367a6844aabSmrgelement, the target= attribute in the <test> element selects between matching
368a6844aabSmrgthe original pattern or the font. "default" selects whichever target the outer
369a6844aabSmrg<match> element has selected.
3702c393a42Smrg
3712c393a42Smrg<edit name="property" mode="assign" binding="weak">
3722c393a42Smrg
373a6844aabSmrgThis element contains a list of expression elements (any of the value or
374a6844aabSmrgoperator elements). The expression elements are evaluated at run-time and
375a6844aabSmrgmodify the property "property". The modification depends on whether "property"
376a6844aabSmrgwas matched by one of the associated <test> elements, if so, the modification
377a6844aabSmrgmay affect the first matched value. Any values inserted into the property are
378a6844aabSmrggiven the indicated binding ("strong", "weak" or "same") with "same" binding
379a6844aabSmrgusing the value from the matched pattern element. 'mode' is one of:
380a6844aabSmrg
3812c393a42Smrg  Mode                    With Match              Without Match
3822c393a42Smrg  ---------------------------------------------------------------------
3832c393a42Smrg  "assign"                Replace matching value  Replace all values
3842c393a42Smrg  "assign_replace"        Replace all values      Replace all values
3852c393a42Smrg  "prepend"               Insert before matching  Insert at head of list
3862c393a42Smrg  "prepend_first"         Insert at head of list  Insert at head of list
3872c393a42Smrg  "append"                Append after matching   Append at end of list
3882c393a42Smrg  "append_last"           Append at end of list   Append at end of list
3892c393a42Smrg
390a6844aabSmrg
3912c393a42Smrg<int>, <double>, <string>, <bool>
3922c393a42Smrg
393a6844aabSmrgThese elements hold a single value of the indicated type. <bool> elements hold
394a6844aabSmrgeither true or false. An important limitation exists in the parsing of floating
395a6844aabSmrgpoint numbers -- fontconfig requires that the mantissa start with a digit, not
396a6844aabSmrga decimal point, so insert a leading zero for purely fractional values (e.g.
397a6844aabSmrguse 0.5 instead of .5 and -0.5 instead of -.5).
3982c393a42Smrg
3992c393a42Smrg<matrix>
4002c393a42Smrg
401a6844aabSmrgThis element holds the four <double> elements of an affine transformation.
4022c393a42Smrg
4032c393a42Smrg<name>
4042c393a42Smrg
405a6844aabSmrgHolds a property name. Evaluates to the first value from the property of the
406a6844aabSmrgfont, not the pattern.
4072c393a42Smrg
4082c393a42Smrg<const>
4092c393a42Smrg
410a6844aabSmrgHolds the name of a constant; these are always integers and serve as symbolic
411a6844aabSmrgnames for common font values:
412a6844aabSmrg
4132c393a42Smrg  Constant        Property        Value
4142c393a42Smrg  -------------------------------------
4152c393a42Smrg  thin            weight          0
4162c393a42Smrg  extralight      weight          40
4172c393a42Smrg  ultralight      weight          40
4182c393a42Smrg  light           weight          50
4192c393a42Smrg  book            weight          75
4202c393a42Smrg  regular         weight          80
4212c393a42Smrg  normal          weight          80
4222c393a42Smrg  medium          weight          100
4232c393a42Smrg  demibold        weight          180
4242c393a42Smrg  semibold        weight          180
4252c393a42Smrg  bold            weight          200
4262c393a42Smrg  extrabold       weight          205
4272c393a42Smrg  black           weight          210
4282c393a42Smrg  heavy           weight          210
4292c393a42Smrg  roman           slant           0
4302c393a42Smrg  italic          slant           100
4312c393a42Smrg  oblique         slant           110
4322c393a42Smrg  ultracondensed  width           50
4332c393a42Smrg  extracondensed  width           63
4342c393a42Smrg  condensed       width           75
4352c393a42Smrg  semicondensed   width           87
4362c393a42Smrg  normal          width           100
4372c393a42Smrg  semiexpanded    width           113
4382c393a42Smrg  expanded        width           125
4392c393a42Smrg  extraexpanded   width           150
4402c393a42Smrg  ultraexpanded   width           200
4412c393a42Smrg  proportional    spacing         0
4422c393a42Smrg  dual            spacing         90
4432c393a42Smrg  mono            spacing         100
4442c393a42Smrg  charcell        spacing         110
4452c393a42Smrg  unknown         rgba            0
4462c393a42Smrg  rgb             rgba            1
4472c393a42Smrg  bgr             rgba            2
4482c393a42Smrg  vrgb            rgba            3
4492c393a42Smrg  vbgr            rgba            4
4502c393a42Smrg  none            rgba            5
4512c393a42Smrg  lcdnone         lcdfilter       0
4522c393a42Smrg  lcddefault      lcdfilter       1
4532c393a42Smrg  lcdlight        lcdfilter       2
4542c393a42Smrg  lcdlegacy       lcdfilter       3
4552c393a42Smrg  hintnone        hintstyle       0
4562c393a42Smrg  hintslight      hintstyle       1
4572c393a42Smrg  hintmedium      hintstyle       2
4582c393a42Smrg  hintfull        hintstyle       3
4592c393a42Smrg
460a6844aabSmrg
4612c393a42Smrg<or>, <and>, <plus>, <minus>, <times>, <divide>
4622c393a42Smrg
463a6844aabSmrgThese elements perform the specified operation on a list of expression
464a6844aabSmrgelements. <or> and <and> are boolean, not bitwise.
4652c393a42Smrg
4662c393a42Smrg<eq>, <not_eq>, <less>, <less_eq>, <more>, <more_eq>
4672c393a42Smrg
468a6844aabSmrgThese elements compare two values, producing a boolean result.
4692c393a42Smrg
4702c393a42Smrg<not>
4712c393a42Smrg
472a6844aabSmrgInverts the boolean sense of its one expression element
4732c393a42Smrg
4742c393a42Smrg<if>
4752c393a42Smrg
476a6844aabSmrgThis element takes three expression elements; if the value of the first is
477a6844aabSmrgtrue, it produces the value of the second, otherwise it produces the value of
478a6844aabSmrgthe third.
4792c393a42Smrg
4802c393a42Smrg<alias>
4812c393a42Smrg
482a6844aabSmrgAlias elements provide a shorthand notation for the set of common match
483a6844aabSmrgoperations needed to substitute one font family for another. They contain a
484a6844aabSmrg<family> element followed by optional <prefer>, <accept> and <default>
485a6844aabSmrgelements. Fonts matching the <family> element are edited to prepend the list of
486a6844aabSmrg<prefer>ed families before the matching <family>, append the <accept>able
487a6844aabSmrgfamilies after the matching <family> and append the <default> families to the
488a6844aabSmrgend of the family list.
4892c393a42Smrg
4902c393a42Smrg<family>
4912c393a42Smrg
492a6844aabSmrgHolds a single font family name
4932c393a42Smrg
4942c393a42Smrg<prefer>, <accept>, <default>
4952c393a42Smrg
496a6844aabSmrgThese hold a list of <family> elements to be used by the <alias> element.
4972c393a42Smrg
4982c393a42SmrgEXAMPLE CONFIGURATION FILE
4992c393a42Smrg
5002c393a42SmrgSystem configuration file
5012c393a42Smrg
502a6844aabSmrgThis is an example of a system-wide configuration file
503a6844aabSmrg
5042c393a42Smrg<?xml version="1.0"?>
5052c393a42Smrg<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
5062c393a42Smrg<!-- /etc/fonts/fonts.conf file to configure system font access -->
5072c393a42Smrg<fontconfig>
5082c393a42Smrg<!--
5092c393a42Smrg        Find fonts in these directories
5102c393a42Smrg-->
5112c393a42Smrg<dir>/usr/share/fonts</dir>
5122c393a42Smrg<dir>/usr/X11R6/lib/X11/fonts</dir>
5132c393a42Smrg
5142c393a42Smrg<!--
5152c393a42Smrg        Accept deprecated 'mono' alias, replacing it with 'monospace'
5162c393a42Smrg-->
5172c393a42Smrg<match target="pattern">
5182c393a42Smrg        <test qual="any" name="family"><string>mono</string></test>
519a6844aabSmrg        <edit name="family" mode="assign"><string>monospace</string></edit>
5202c393a42Smrg</match>
5212c393a42Smrg
5222c393a42Smrg<!--
5232c393a42Smrg        Names not including any well known alias are given 'sans'
5242c393a42Smrg-->
5252c393a42Smrg<match target="pattern">
5262c393a42Smrg        <test qual="all" name="family" mode="not_eq">sans</test>
5272c393a42Smrg        <test qual="all" name="family" mode="not_eq">serif</test>
5282c393a42Smrg        <test qual="all" name="family" mode="not_eq">monospace</test>
529a6844aabSmrg        <edit name="family" mode="append_last"><string>sans</string></edit>
5302c393a42Smrg</match>
5312c393a42Smrg
5322c393a42Smrg<!--
5332c393a42Smrg        Load per-user customization file, but don't complain
5342c393a42Smrg        if it doesn't exist
5352c393a42Smrg-->
5362c393a42Smrg<include ignore_missing="yes">~/.fonts.conf</include>
5372c393a42Smrg
5382c393a42Smrg<!--
5392c393a42Smrg        Load local customization files, but don't complain
5402c393a42Smrg        if there aren't any
5412c393a42Smrg-->
5422c393a42Smrg<include ignore_missing="yes">conf.d</include>
5432c393a42Smrg<include ignore_missing="yes">local.conf</include>
5442c393a42Smrg
5452c393a42Smrg<!--
5462c393a42Smrg        Alias well known font names to available TrueType fonts.
5472c393a42Smrg        These substitute TrueType faces for similar Type1
5482c393a42Smrg        faces to improve screen appearance.
5492c393a42Smrg-->
5502c393a42Smrg<alias>
5512c393a42Smrg        <family>Times</family>
5522c393a42Smrg        <prefer><family>Times New Roman</family></prefer>
5532c393a42Smrg        <default><family>serif</family></default>
5542c393a42Smrg</alias>
5552c393a42Smrg<alias>
5562c393a42Smrg        <family>Helvetica</family>
5572c393a42Smrg        <prefer><family>Arial</family></prefer>
5582c393a42Smrg        <default><family>sans</family></default>
5592c393a42Smrg</alias>
5602c393a42Smrg<alias>
5612c393a42Smrg        <family>Courier</family>
5622c393a42Smrg        <prefer><family>Courier New</family></prefer>
5632c393a42Smrg        <default><family>monospace</family></default>
5642c393a42Smrg</alias>
5652c393a42Smrg
5662c393a42Smrg<!--
5672c393a42Smrg        Provide required aliases for standard names
5682c393a42Smrg        Do these after the users configuration file so that
5692c393a42Smrg        any aliases there are used preferentially
5702c393a42Smrg-->
5712c393a42Smrg<alias>
5722c393a42Smrg        <family>serif</family>
5732c393a42Smrg        <prefer><family>Times New Roman</family></prefer>
5742c393a42Smrg</alias>
5752c393a42Smrg<alias>
5762c393a42Smrg        <family>sans</family>
5772c393a42Smrg        <prefer><family>Arial</family></prefer>
5782c393a42Smrg</alias>
5792c393a42Smrg<alias>
5802c393a42Smrg        <family>monospace</family>
5812c393a42Smrg        <prefer><family>Andale Mono</family></prefer>
5822c393a42Smrg</alias>
5832c393a42Smrg</fontconfig>
5842c393a42Smrg
585a6844aabSmrg
5862c393a42SmrgUser configuration file
5872c393a42Smrg
588a6844aabSmrgThis is an example of a per-user configuration file that lives in ~/.fonts.conf
589a6844aabSmrg
5902c393a42Smrg<?xml version="1.0"?>
5912c393a42Smrg<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
5922c393a42Smrg<!-- ~/.fonts.conf for per-user font configuration -->
5932c393a42Smrg<fontconfig>
5942c393a42Smrg
5952c393a42Smrg<!--
5962c393a42Smrg        Private font directory
5972c393a42Smrg-->
5982c393a42Smrg<dir>~/.fonts</dir>
5992c393a42Smrg
6002c393a42Smrg<!--
6012c393a42Smrg        use rgb sub-pixel ordering to improve glyph appearance on
6022c393a42Smrg        LCD screens.  Changes affecting rendering, but not matching
6032c393a42Smrg        should always use target="font".
6042c393a42Smrg-->
6052c393a42Smrg<match target="font">
6062c393a42Smrg        <edit name="rgba" mode="assign"><const>rgb</const></edit>
6072c393a42Smrg</match>
6082c393a42Smrg</fontconfig>
6092c393a42Smrg
610a6844aabSmrg
6112c393a42SmrgFiles
6122c393a42Smrg
613a6844aabSmrgfonts.conf contains configuration information for the fontconfig library
614a6844aabSmrgconsisting of directories to look at for font information as well as
615a6844aabSmrginstructions on editing program specified font patterns before attempting to
616a6844aabSmrgmatch the available fonts. It is in xml format.
6172c393a42Smrg
618a6844aabSmrgconf.d is the conventional name for a directory of additional configuration
619a6844aabSmrgfiles managed by external applications or the local administrator. The
620a6844aabSmrgfilenames starting with decimal digits are sorted in lexicographic order and
621a6844aabSmrgused as additional configuration files. All of these files are in xml format.
622a6844aabSmrgThe master fonts.conf file references this directory in an <include> directive.
6232c393a42Smrg
624a6844aabSmrgfonts.dtd is a DTD that describes the format of the configuration files.
6252c393a42Smrg
626a6844aabSmrg~/.fonts.conf.d is the conventional name for a per-user directory of (typically
627a6844aabSmrgauto-generated) configuration files, although the actual location is specified
628a6844aabSmrgin the global fonts.conf file.
6292c393a42Smrg
630a6844aabSmrg~/.fonts.conf is the conventional location for per-user font configuration,
631a6844aabSmrgalthough the actual location is specified in the global fonts.conf file.
632a6844aabSmrg
633a6844aabSmrg~/.fonts.cache-* is the conventional repository of font information that isn't
634a6844aabSmrgfound in the per-directory caches. This file is automatically maintained by
635a6844aabSmrgfontconfig.
6362c393a42Smrg
6372c393a42SmrgSee Also
6382c393a42Smrg
639a6844aabSmrgfc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1)
6402c393a42Smrg
6412c393a42SmrgVersion
6422c393a42Smrg
643a6844aabSmrgFontconfig version 2.8.0
644a6844aabSmrg
645