1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
8 NT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
28 >fonts.conf -- Font configuration files</DIV
30 CLASS="REFSYNOPSISDIV"
38 > /etc/fonts/fonts.conf
52 >Fontconfig is a library designed to provide system-wide font configuration,
53 customization and application access.
62 >Functional Overview</H2
64 >Fontconfig contains two essential modules, the configuration module which
65 builds an internal configuration from XML files and the matching module
66 which accepts font patterns and returns the nearest matching font.
74 >Font Configuration</H3
76 >The configuration module consists of the FcConfig datatype, libexpat and
77 FcConfigParse which walks over an XML tree and amends a configuration with
78 data found within. From an external perspective, configuration of the
79 library consists of generating a valid XML tree and feeding that to
80 FcConfigParse. The only other mechanism provided to applications for
81 changing the running configuration is to add fonts and directories to the
82 list of application-provided font files.
85 >The intent is to make font configurations relatively static, and shared by
86 as many applications as possible. It is hoped that this will lead to more
87 stable font selection when passing names from one application to another.
88 XML was chosen as a configuration file format because it provides a format
89 which is easy for external agents to edit while retaining the correct
93 >Font configuration is separate from font matching; applications needing to
94 do their own matching can access the available fonts from the library and
95 perform private matching. The intent is to permit applications to pick and
96 choose appropriate functionality from the library instead of forcing them to
97 choose between this library and a private configuration mechanism. The hope
98 is that this will ensure that configuration of fonts for all applications
99 can be centralized in one place. Centralizing font configuration will
100 simplify and regularize font installation and customization.
111 >While font patterns may contain essentially any properties, there are some
112 well known properties with associated types. Fontconfig uses some of these
113 properties for font matching and font completion. Others are provided as a
114 convenience for the applications' rendering mechanism.
117 CLASS="PROGRAMLISTING"
118 > Property Type Description
119 --------------------------------------------------------------
120 family String Font family names
121 familylang String Languages corresponding to each family
122 style String Font style. Overrides weight and slant
123 stylelang String Languages corresponding to each style
124 fullname String Font full names (often includes style)
125 fullnamelang String Languages corresponding to each fullname
126 slant Int Italic, oblique or roman
127 weight Int Light, medium, demibold, bold or black
128 size Double Point size
129 width Int Condensed, normal or expanded
130 aspect Double Stretches glyphs horizontally before hinting
131 pixelsize Double Pixel size
132 spacing Int Proportional, dual-width, monospace or charcell
133 foundry String Font foundry name
134 antialias Bool Whether glyphs can be antialiased
135 hinting Bool Whether the rasterizer should use hinting
136 hintstyle Int Automatic hinting style
137 verticallayout Bool Use vertical layout
138 autohint Bool Use autohinter instead of normal hinter
139 globaladvance Bool Use font global advance data
140 file String The filename holding the font
141 index Int The index of the font within the file
142 ftface FT_Face Use the specified FreeType face object
143 rasterizer String Which rasterizer is in use
144 outline Bool Whether the glyphs are outlines
145 scalable Bool Whether glyphs can be scaled
146 scale Double Scale factor for point->pixel conversions
147 dpi Double Target dots per inch
148 rgba Int unknown, rgb, bgr, vrgb, vbgr,
149 none - subpixel geometry
150 lcdfilter Int Type of LCD filter
151 minspace Bool Eliminate leading from line spacing
152 charset CharSet Unicode chars encoded by the font
153 lang String List of RFC-3066-style languages this
155 fontversion Int Version number of the font
156 capability String List of layout capabilities in the font
157 embolden Bool Rasterizer should synthetically embolden the font
168 >Fontconfig performs matching by measuring the distance from a provided
169 pattern to all of the available fonts in the system. The closest matching
170 font is selected. This ensures that a font will always be returned, but
171 doesn't ensure that it is anything like the requested pattern.
175 Font matching starts with an application constructed pattern. The desired
176 attributes of the resulting font are collected together in a pattern. Each
177 property of the pattern can contain one or more values; these are listed in
178 priority order; matches earlier in the list are considered "closer" than
179 matches later in the list.
182 >The initial pattern is modified by applying the list of editing instructions
183 specific to patterns found in the configuration; each consists of a match
184 predicate and a set of editing operations. They are executed in the order
185 they appeared in the configuration. Each match causes the associated
186 sequence of editing operations to be applied.
189 >After the pattern has been edited, a sequence of default substitutions are
190 performed to canonicalize the set of available properties; this avoids the
191 need for the lower layers to constantly provide default values for various
192 font properties during rendering.
195 >The canonical font pattern is finally matched against all available fonts.
196 The distance from the pattern to the font is measured for each of several
197 properties: foundry, charset, family, lang, spacing, pixelsize, style,
198 slant, weight, antialias, rasterizer and outline. This list is in priority
199 order -- results of comparing earlier elements of this list weigh more
200 heavily than later elements.
203 >There is one special case to this rule; family names are split into two
204 bindings; strong and weak. Strong family names are given greater precedence
205 in the match than lang elements while weak family names are given lower
206 precedence than lang elements. This permits the document language to drive
207 font selection when any document specified font is unavailable.
210 >The pattern representing that font is augmented to include any properties
211 found in the pattern but not found in the font itself; this permits the
212 application to pass rendering instructions or any other data through the
213 matching system. Finally, the list of editing instructions specific to
214 fonts found in the configuration are applied to the pattern. This modified
215 pattern is returned to the application.
218 >The return value contains sufficient information to locate and rasterize the
219 font, including the file name, pixel size and other rendering data. As
220 none of the information involved pertains to the FreeType library,
221 applications are free to use any rasterization engine or even to take
222 the identified font file and access it directly.
225 >The match/edit sequences in the configuration are performed in two passes
226 because there are essentially two different operations necessary -- the
227 first is to modify how fonts are selected; aliasing families and adding
228 suitable defaults. The second is to modify how the selected fonts are
229 rasterized. Those must apply to the selected font, not the original pattern
230 as false matches will often occur.
241 >Fontconfig provides a textual representation for patterns that the library
242 can both accept and generate. The representation is in three parts, first a
243 list of family names, second a list of point sizes and finally a list of
244 additional properties:
247 CLASS="PROGRAMLISTING"
248 > <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...
251 >Values in a list are separated with commas. The name needn't include either
252 families or point sizes; they can be elided. In addition, there are
253 symbolic constants that simultaneously indicate both a name and a value.
254 Here are some examples:
257 CLASS="PROGRAMLISTING"
259 ----------------------------------------------------------
260 Times-12 12 point Times Roman
261 Times-12:bold 12 point Times Bold
262 Courier:italic Courier Italic in the default size
263 Monospace:matrix=1 .1 0 1 The users preferred monospace font
264 with artificial obliquing
267 >The '\', '-', ':' and ',' characters in family names must be preceded by a
268 '\' character to avoid having them misinterpreted. Similarly, values
269 containing '\', '=', '_', ':' and ',' must also have them preceded by a
270 '\' character. The '\' characters are stripped out of the family name and
271 values as the font name is read.
281 >Debugging Applications</H2
283 >To help diagnose font and applications problems, fontconfig is built with a
284 large amount of internal debugging left enabled. It is controlled by means
285 of the FC_DEBUG environment variable. The value of this variable is
286 interpreted as a number, and each bit within that value controls different
290 CLASS="PROGRAMLISTING"
292 ---------------------------------------------------------
293 MATCH 1 Brief information about font matching
294 MATCHV 2 Extensive font matching information
295 EDIT 4 Monitor match/test/edit execution
296 FONTSET 8 Track loading of font information at startup
297 CACHE 16 Watch cache files being written
298 CACHEV 32 Extensive cache file writing information
299 PARSE 64 (no longer in use)
300 SCAN 128 Watch font files being scanned to build caches
301 SCANV 256 Verbose font file scanning information
302 MEMORY 512 Monitor fontconfig memory usage
303 CONFIG 1024 Monitor which config files are loaded
304 LANGSET 2048 Dump char sets used to construct lang values
305 OBJTYPES 4096 Display message when value typechecks fail
308 >Add the value of the desired debug levels together and assign that (in
309 base 10) to the FC_DEBUG environment variable before running the
310 application. Output from these statements is sent to stdout.
321 >Each font in the database contains a list of languages it supports. This is
322 computed by comparing the Unicode coverage of the font with the orthography
323 of each language. Languages are tagged using an RFC-3066 compatible naming
324 and occur in two parts -- the ISO 639 language tag followed a hyphen and then
325 by the ISO 3166 country code. The hyphen and country code may be elided.
328 >Fontconfig has orthographies for several languages built into the library.
329 No provision has been made for adding new ones aside from rebuilding the
330 library. It currently supports 122 of the 139 languages named in ISO 639-1,
331 141 of the languages with two-letter codes from ISO 639-2 and another 30
332 languages with only three-letter codes. Languages with both two and three
333 letter codes are provided with only the two letter code.
336 >For languages used in multiple territories with radically different
337 character sets, fontconfig includes per-territory orthographies. This
338 includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
347 >Configuration File Format</H2
349 >Configuration files for fontconfig are stored in XML format; this
350 format makes external configuration tools easier to write and ensures that
351 they will generate syntactically correct configuration files. As XML
352 files are plain text, they can also be manipulated by the expert user using
356 >The fontconfig document type definition resides in the external entity
357 "fonts.dtd"; this is normally stored in the default font configuration
358 directory (/etc/fonts). Each configuration file should contain the
361 CLASS="PROGRAMLISTING"
362 > <?xml version="1.0"?>
363 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
378 ><fontconfig></TT
381 >This is the top level element for a font configuration and can contain
397 > elements in any order.
411 >This element contains a directory name which will be scanned for font files
412 to include in the set of available fonts.
426 >This element contains a file name for the per-user cache of font
427 information. If it starts with '~', it refers to a file in the users
428 home directory. This file is used to hold information about fonts that
429 isn't present in the per-directory cache files. It is automatically
430 maintained by the fontconfig library. The default for this file
431 is ``~/.fonts.cache-<TT
437 > is the font configuration
438 file version number (currently 2).
449 ><include ignore_missing="no"></TT
452 >This element contains the name of an additional configuration file or
453 directory. If a directory, every file within that directory starting with an
454 ASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be processed in sorted order. When
455 the XML datatype is traversed by FcConfigParse, the contents of the file(s)
456 will also be incorporated into the configuration by passing the filename(s) to
457 FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the
458 default "no", a missing file or directory will elicit no warning message from
473 >This element provides a place to consolidate additional configuration
498 >Fonts often include "broken" glyphs which appear in the encoding but are
499 drawn as blanks on the screen. Within the <TT
502 > element, place each
503 Unicode characters which is supposed to be blank in an <TT
507 Characters outside of this set which are drawn as blank will be elided from
508 the set of characters supported by the font.
525 > element holds an <TT
528 > element which indicates the default
529 interval between automatic checks for font configuration changes.
530 Fontconfig will validate all of the configuration files and directories and
531 automatically rebuild the internal datastructures when this interval passes.
542 ><selectfont></TT
545 >This element is used to black/white list fonts from being listed or matched
546 against. It holds acceptfont and rejectfont elements.
557 ><acceptfont></TT
560 >Fonts matched by an acceptfont element are "whitelisted"; such fonts are
561 explicitly included in the set of fonts used to resolve list and match
562 requests; including them in this list protects them from being "blacklisted"
563 by a rejectfont element. Acceptfont elements include glob and pattern
564 elements which are used to match fonts.
575 ><rejectfont></TT
578 >Fonts matched by an rejectfont element are "blacklisted"; such fonts are
579 excluded from the set of fonts used to resolve list and match requests as if
580 they didn't exist in the system. Rejectfont elements include glob and
581 pattern elements which are used to match fonts.
595 >Glob elements hold shell-style filename matching patterns (including ? and
596 *) which match fonts based on their complete pathnames. This can be used to
597 exclude a set of directories (/usr/share/fonts/uglyfont*), or particular
598 font file types (*.pcf.gz), but the latter mechanism relies rather heavily
599 on filenaming conventions which can't be relied upon. Note that globs
600 only apply to directories, not to individual fonts.
614 >Pattern elements perform list-style matching on incoming fonts; that is,
615 they hold a list of elements and associated values. If all of those
616 elements have a matching value, then the pattern matches the font. This can
617 be used to select fonts based on attributes of the font (scalable, bold,
618 etc), which is a more reliable mechanism than using file extensions.
619 Pattern elements include patelt elements.
630 ><patelt name="property"></TT
633 >Patelt elements hold a single pattern element and list of values. They must
634 have a 'name' attribute which indicates the pattern element name. Patelt
635 elements include int, double, string, matrix, bool, charset and const
647 ><match target="pattern"></TT
650 >This element holds first a (possibly empty) list of <TT
654 a (possibly empty) list of <TT
657 > elements. Patterns which match all of the
658 tests are subjected to all the edits. If 'target' is set to "font" instead
659 of the default "pattern", then this element applies to the font name
660 resulting from a match rather than a font pattern to be matched. If 'target'
661 is set to "scan", then this element applies when the font is scanned to
662 build the fontconfig database.
673 ><test qual="any" name="property" target="default" compare="eq"></TT
676 >This element contains a single value which is compared with the target
677 ('pattern', 'font', 'scan' or 'default') property "property" (substitute any of the property names seen
678 above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", or
679 "more_eq". 'qual' may either be the default, "any", in which case the match
680 succeeds if any value associated with the property matches the test value, or
681 "all", in which case all of the values associated with the property must
682 match the test value. When used in a <match target="font"> element,
683 the target= attribute in the <test> element selects between matching
684 the original pattern or the font. "default" selects whichever target the
685 outer <match> element has selected.
696 ><edit name="property" mode="assign" binding="weak"></TT
699 >This element contains a list of expression elements (any of the value or
700 operator elements). The expression elements are evaluated at run-time and
701 modify the property "property". The modification depends on whether
702 "property" was matched by one of the associated <TT
705 > elements, if so, the
706 modification may affect the first matched value. Any values inserted into
707 the property are given the indicated binding ("strong", "weak" or "same")
708 with "same" binding using the value from the matched pattern element.
711 CLASS="PROGRAMLISTING"
712 > Mode With Match Without Match
713 ---------------------------------------------------------------------
714 "assign" Replace matching value Replace all values
715 "assign_replace" Replace all values Replace all values
716 "prepend" Insert before matching Insert at head of list
717 "prepend_first" Insert at head of list Insert at head of list
718 "append" Append after matching Append at end of list
719 "append_last" Append at end of list Append at end of list
744 >These elements hold a single value of the indicated type. <TT
748 elements hold either true or false. An important limitation exists in
749 the parsing of floating point numbers -- fontconfig requires that
750 the mantissa start with a digit, not a decimal point, so insert a leading
751 zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5
766 >This element holds the four <TT
769 > elements of an affine
784 >This element holds the two <TT
787 > elements of a range
802 >This element holds at least one <TT
806 an Unicode code point or more.
820 >This element holds at least one <TT
824 a RFC-3066-style languages or more.
838 >Holds a property name. Evaluates to the first value from the property of
839 the font, not the pattern.
853 >Holds the name of a constant; these are always integers and serve as
854 symbolic names for common font values:
856 CLASS="PROGRAMLISTING"
857 > Constant Property Value
858 -------------------------------------
876 ultracondensed width 50
877 extracondensed width 63
879 semicondensed width 87
881 semiexpanded width 113
883 extraexpanded width 150
884 ultraexpanded width 200
885 proportional spacing 0
896 lcddefault lcdfilter 1
898 lcdlegacy lcdfilter 3
900 hintslight hintstyle 1
901 hintmedium hintstyle 2
933 >These elements perform the specified operation on a list of expression
940 > are boolean, not bitwise.
969 >These elements compare two values, producing a boolean result.
983 >Inverts the boolean sense of its one expression element
997 >This element takes three expression elements; if the value of the first is
998 true, it produces the value of the second, otherwise it produces the value
1013 >Alias elements provide a shorthand notation for the set of common match
1014 operations needed to substitute one font family for another. They contain a
1018 > element followed by optional <TT
1026 ><default></TT
1028 elements. Fonts matching the <TT
1031 > element are edited to prepend the
1035 >ed families before the matching <TT
1042 >able families after the matching <TT
1045 > and append the <TT
1047 ><default></TT
1049 families to the end of the family list.
1063 >Holds a single font family name
1080 ><default></TT
1083 >These hold a list of <TT
1086 > elements to be used by the <TT
1099 >EXAMPLE CONFIGURATION FILE</H2
1106 >System configuration file</H3
1108 >This is an example of a system-wide configuration file
1111 CLASS="PROGRAMLISTING"
1112 ><?xml version="1.0"?>
1113 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
1114 <!-- /etc/fonts/fonts.conf file to configure system font access -->
1117 Find fonts in these directories
1119 <dir>/usr/share/fonts</dir>
1120 <dir>/usr/X11R6/lib/X11/fonts</dir>
1123 Accept deprecated 'mono' alias, replacing it with 'monospace'
1125 <match target="pattern">
1126 <test qual="any" name="family"><string>mono</string></test>
1127 <edit name="family" mode="assign"><string>monospace</string></edit>
1131 Names not including any well known alias are given 'sans'
1133 <match target="pattern">
1134 <test qual="all" name="family" mode="not_eq">sans</test>
1135 <test qual="all" name="family" mode="not_eq">serif</test>
1136 <test qual="all" name="family" mode="not_eq">monospace</test>
1137 <edit name="family" mode="append_last"><string>sans</string></edit>
1141 Load per-user customization file, but don't complain
1144 <include ignore_missing="yes">~/.fonts.conf</include>
1147 Load local customization files, but don't complain
1150 <include ignore_missing="yes">conf.d</include>
1151 <include ignore_missing="yes">local.conf</include>
1154 Alias well known font names to available TrueType fonts.
1155 These substitute TrueType faces for similar Type1
1156 faces to improve screen appearance.
1159 <family>Times</family>
1160 <prefer><family>Times New Roman</family></prefer>
1161 <default><family>serif</family></default>
1164 <family>Helvetica</family>
1165 <prefer><family>Arial</family></prefer>
1166 <default><family>sans</family></default>
1169 <family>Courier</family>
1170 <prefer><family>Courier New</family></prefer>
1171 <default><family>monospace</family></default>
1175 Provide required aliases for standard names
1176 Do these after the users configuration file so that
1177 any aliases there are used preferentially
1180 <family>serif</family>
1181 <prefer><family>Times New Roman</family></prefer>
1184 <family>sans</family>
1185 <prefer><family>Arial</family></prefer>
1188 <family>monospace</family>
1189 <prefer><family>Andale Mono</family></prefer>
1200 >User configuration file</H3
1202 >This is an example of a per-user configuration file that lives in
1206 CLASS="PROGRAMLISTING"
1207 ><?xml version="1.0"?>
1208 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
1209 <!-- ~/.fonts.conf for per-user font configuration -->
1213 Private font directory
1215 <dir>~/.fonts</dir>
1218 use rgb sub-pixel ordering to improve glyph appearance on
1219 LCD screens. Changes affecting rendering, but not matching
1220 should always use target="font".
1222 <match target="font">
1223 <edit name="rgba" mode="assign"><const>rgb</const></edit>
1244 contains configuration information for the fontconfig library
1245 consisting of directories to look at for font information as well as
1246 instructions on editing program specified font patterns before attempting to
1247 match the available fonts. It is in XML format.
1257 is the conventional name for a directory of additional configuration files
1258 managed by external applications or the local administrator. The
1259 filenames starting with decimal digits are sorted in lexicographic order
1260 and used as additional configuration files. All of these files are in XML
1261 format. The master fonts.conf file references this directory in an
1262 <include> directive.
1272 is a DTD that describes the format of the configuration files.
1282 is the conventional name for a per-user directory of (typically
1283 auto-generated) configuration files, although the
1284 actual location is specified in the global fonts.conf file.
1294 is the conventional location for per-user font configuration, although the
1295 actual location is specified in the global fonts.conf file.
1302 > ~/.fonts.cache-*</I
1305 is the conventional repository of font information that isn't found in the
1306 per-directory caches. This file is automatically maintained by fontconfig.
1317 >fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1)
1328 >Fontconfig version 2.9.0