]>
Commit | Line | Data |
---|---|---|
ae2c2943 KP |
1 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [ |
2 | <!ENTITY version SYSTEM "version.sgml"> | |
27de1f43 | 3 | <!ENTITY confdir SYSTEM "confdir.sgml"> |
ae2c2943 | 4 | ]> |
584ac89a KP |
5 | <!-- |
6 | $Id$ | |
7 | ||
46b51147 | 8 | Copyright © 2003 Keith Packard |
584ac89a KP |
9 | |
10 | Permission to use, copy, modify, distribute, and sell this software and its | |
11 | documentation for any purpose is hereby granted without fee, provided that | |
12 | the above copyright notice appear in all copies and that both that | |
13 | copyright notice and this permission notice appear in supporting | |
14 | documentation, and that the name of Keith Packard not be used in | |
15 | advertising or publicity pertaining to distribution of the software without | |
16 | specific, written prior permission. Keith Packard makes no | |
17 | representations about the suitability of this software for any purpose. It | |
18 | is provided "as is" without express or implied warranty. | |
19 | ||
20 | KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
21 | INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | |
22 | EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR | |
23 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | |
24 | DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |
25 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
26 | PERFORMANCE OF THIS SOFTWARE. | |
27 | --> | |
22671e25 KP |
28 | <refentry> |
29 | <refmeta> | |
b219ac6b | 30 | <refentrytitle>fonts-conf</refentrytitle> |
22671e25 KP |
31 | <manvolnum>5</manvolnum> |
32 | </refmeta> | |
33 | <refnamediv> | |
34 | <refname>fonts.conf</refname> | |
35 | <refpurpose>Font configuration files</refpurpose> | |
36 | </refnamediv> | |
37 | <refsynopsisdiv> | |
38 | <synopsis> | |
27de1f43 NL |
39 | &confdir;/fonts.conf |
40 | &confdir;/fonts.dtd | |
22671e25 KP |
41 | ~/.fonts.conf |
42 | </synopsis> | |
43 | </refsynopsisdiv> | |
ae2c2943 | 44 | <refsect1><title>Description</title> |
584ac89a KP |
45 | <para> |
46 | Fontconfig is a library designed to provide system-wide font configuration, | |
47 | customization and application access. | |
48 | </para> | |
22671e25 | 49 | </refsect1> |
ae2c2943 | 50 | <refsect1><title>Functional Overview</title> |
584ac89a KP |
51 | <para> |
52 | Fontconfig contains two essential modules, the configuration module which | |
53 | builds an internal configuration from XML files and the matching module | |
54 | which accepts font patterns and returns the nearest matching font. | |
55 | </para> | |
ae2c2943 | 56 | <refsect2><title>Font Configuration</title> |
584ac89a KP |
57 | <para> |
58 | The configuration module consists of the FcConfig datatype, libexpat and | |
59 | FcConfigParse which walks over an XML tree and ammends a configuration with | |
60 | data found within. From an external perspective, configuration of the | |
61 | library consists of generating a valid XML tree and feeding that to | |
62 | FcConfigParse. The only other mechanism provided to applications for | |
63 | changing the running configuration is to add fonts and directories to the | |
64 | list of application-provided font files. | |
65 | </para><para> | |
66 | The intent is to make font configurations relatively static, and shared by | |
67 | as many applications as possible. It is hoped that this will lead to more | |
68 | stable font selection when passing names from one application to another. | |
69 | XML was chosen as a configuration file format because it provides a format | |
70 | which is easy for external agents to edit while retaining the correct | |
71 | structure and syntax. | |
72 | </para><para> | |
73 | Font configuration is separate from font matching; applications needing to | |
74 | do their own matching can access the available fonts from the library and | |
75 | perform private matching. The intent is to permit applications to pick and | |
76 | choose appropriate functionality from the library instead of forcing them to | |
77 | choose between this library and a private configuration mechanism. The hope | |
78 | is that this will ensure that configuration of fonts for all applications | |
79 | can be centralized in one place. Centralizing font configuration will | |
80 | simplify and regularize font installation and customization. | |
81 | </para> | |
22671e25 KP |
82 | </refsect2> |
83 | <refsect2> | |
ae2c2943 | 84 | <title>Font Properties</title> |
584ac89a KP |
85 | <para> |
86 | While font patterns may contain essentially any properties, there are some | |
87 | well known properties with associated types. Fontconfig uses some of these | |
88 | properties for font matching and font completion. Others are provided as a | |
89 | convenience for the applications rendering mechanism. | |
90 | </para> | |
22671e25 KP |
91 | <programlisting> |
92 | Property Type Description | |
93 | -------------------------------------------------------------- | |
4f27c1c0 KP |
94 | family String Font family names |
95 | familylang String Languages cooresponding to each family | |
22671e25 | 96 | style String Font style. Overrides weight and slant |
4f27c1c0 KP |
97 | stylelang String Languages cooresponding to each style |
98 | fullname String Font full names (often includes style) | |
99 | fullnamelang String Languages cooresponding to each fullname | |
22671e25 KP |
100 | slant Int Italic, oblique or roman |
101 | weight Int Light, medium, demibold, bold or black | |
102 | size Double Point size | |
103 | aspect Double Stretches glyphs horizontally before hinting | |
104 | pixelsize Double Pixel size | |
a05d257f | 105 | spacing Int Proportional, dual-width, monospace or charcell |
22671e25 KP |
106 | foundry String Font foundry name |
107 | antialias Bool Whether glyphs can be antialiased | |
108 | hinting Bool Whether the rasterizer should use hinting | |
109 | verticallayout Bool Use vertical layout | |
110 | autohint Bool Use autohinter instead of normal hinter | |
111 | globaladvance Bool Use font global advance data | |
112 | file String The filename holding the font | |
113 | index Int The index of the font within the file | |
114 | ftface FT_Face Use the specified FreeType face object | |
115 | rasterizer String Which rasterizer is in use | |
116 | outline Bool Whether the glyphs are outlines | |
117 | scalable Bool Whether glyphs can be scaled | |
118 | scale Double Scale factor for point->pixel conversions | |
119 | dpi Double Target dots per inch | |
120 | rgba Int unknown, rgb, bgr, vrgb, vbgr, | |
121 | none - subpixel geometry | |
122 | minspace Bool Eliminate leading from line spacing | |
123 | charset CharSet Unicode chars encoded by the font | |
124 | lang String List of RFC-3066-style languages this | |
125 | font supports | |
126 | </programlisting> | |
127 | </refsect2> | |
128 | <refsect2> | |
ae2c2943 | 129 | <title>Font Matching</title> |
584ac89a KP |
130 | <para> |
131 | Fontconfig performs matching by measuring the distance from a provided | |
132 | pattern to all of the available fonts in the system. The closest matching | |
133 | font is selected. This ensures that a font will always be returned, but | |
134 | doesn't ensure that it is anything like the requested pattern. | |
135 | </para><para> | |
136 | Font matching starts with an application constructed pattern. The desired | |
137 | attributes of the resulting font are collected together in a pattern. Each | |
138 | property of the pattern can contain one or more values; these are listed in | |
139 | priority order; matches earlier in the list are considered "closer" than | |
140 | matches later in the list. | |
141 | </para><para> | |
142 | The initial pattern is modified by applying the list of editing instructions | |
143 | specific to patterns found in the configuration; each consists of a match | |
144 | predicate and a set of editing operations. They are executed in the order | |
145 | they appeared in the configuration. Each match causes the associated | |
146 | sequence of editing operations to be applied. | |
147 | </para><para> | |
148 | After the pattern has been edited, a sequence of default substitutions are | |
149 | performed to canonicalize the set of available properties; this avoids the | |
150 | need for the lower layers to constantly provide default values for various | |
151 | font properties during rendering. | |
152 | </para><para> | |
153 | The canonical font pattern is finally matched against all available fonts. | |
154 | The distance from the pattern to the font is measured for each of several | |
155 | properties: foundry, charset, family, lang, spacing, pixelsize, style, | |
156 | slant, weight, antialias, rasterizer and outline. This list is in priority | |
157 | order -- results of comparing earlier elements of this list weigh more | |
158 | heavily than later elements. | |
159 | </para><para> | |
160 | There is one special case to this rule; family names are split into two | |
161 | bindings; strong and weak. Strong family names are given greater precedence | |
162 | in the match than lang elements while weak family names are given lower | |
163 | precedence than lang elements. This permits the document language to drive | |
164 | font selection when any document specified font is unavailable. | |
165 | </para><para> | |
166 | The pattern representing that font is augmented to include any properties | |
167 | found in the pattern but not found in the font itself; this permits the | |
168 | application to pass rendering instructions or any other data through the | |
169 | matching system. Finally, the list of editing instructions specific to | |
170 | fonts found in the configuration are applied to the pattern. This modified | |
171 | pattern is returned to the application. | |
172 | </para><para> | |
173 | The return value contains sufficient information to locate and rasterize the | |
174 | font, including the file name, pixel size and other rendering data. As | |
175 | none of the information involved pertains to the FreeType library, | |
176 | applications are free to use any rasterization engine or even to take | |
177 | the identified font file and access it directly. | |
178 | </para><para> | |
179 | The match/edit sequences in the configuration are performed in two passes | |
180 | because there are essentially two different operations necessary -- the | |
181 | first is to modify how fonts are selected; aliasing families and adding | |
182 | suitable defaults. The second is to modify how the selected fonts are | |
183 | rasterized. Those must apply to the selected font, not the original pattern | |
184 | as false matches will often occur. | |
185 | </para> | |
22671e25 | 186 | </refsect2> |
ae2c2943 | 187 | <refsect2><title>Font Names</title> |
584ac89a KP |
188 | <para> |
189 | Fontconfig provides a textual representation for patterns that the library | |
190 | can both accept and generate. The representation is in three parts, first a | |
191 | list of family names, second a list of point sizes and finally a list of | |
192 | additional properties: | |
193 | </para> | |
194 | <programlisting> | |
195 | <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>... | |
196 | </programlisting> | |
197 | <para> | |
198 | Values in a list are separated with commas. The name needn't include either | |
199 | families or point sizes; they can be elided. In addition, there are | |
200 | symbolic constants that simultaneously indicate both a name and a value. | |
201 | Here are some examples: | |
202 | </para> | |
22671e25 KP |
203 | <programlisting> |
204 | Name Meaning | |
205 | ---------------------------------------------------------- | |
206 | Times-12 12 point Times Roman | |
207 | Times-12:bold 12 point Times Bold | |
208 | Courier:italic Courier Italic in the default size | |
209 | Monospace:matrix=1 .1 0 1 The users preferred monospace font | |
210 | with artificial obliquing | |
211 | </programlisting> | |
212 | </refsect2> | |
213 | </refsect1> | |
ae2c2943 | 214 | <refsect1><title>Lang Tags</title> |
584ac89a KP |
215 | <para> |
216 | Each font in the database contains a list of languages it supports. This is | |
217 | computed by comparing the Unicode coverage of the font with the orthography | |
218 | of each language. Languages are tagged using an RFC-3066 compatible naming | |
219 | and occur in two parts -- the ISO639 language tag followed a hyphen and then | |
220 | by the ISO 3166 country code. The hyphen and country code may be elided. | |
221 | </para><para> | |
222 | Fontconfig has orthographies for several languages built into the library. | |
223 | No provision has been made for adding new ones aside from rebuilding the | |
224 | library. It currently supports 122 of the 139 languages named in ISO 639-1, | |
225 | 141 of the languages with two-letter codes from ISO 639-2 and another 30 | |
226 | languages with only three-letter codes. | |
227 | </para> | |
22671e25 | 228 | </refsect1> |
ae2c2943 | 229 | <refsect1><title>Configuration File Format</title> |
584ac89a KP |
230 | <para> |
231 | Configuration files for fontconfig are stored in XML format; this | |
232 | format makes external configuration tools easier to write and ensures that | |
233 | they will generate syntactically correct configuration files. As XML | |
234 | files are plain text, they can also be manipulated by the expert user using | |
235 | a text editor. | |
236 | </para><para> | |
237 | The fontconfig document type definition resides in the external entity | |
238 | "fonts.dtd"; this is normally stored in the default font configuration | |
27de1f43 | 239 | directory (&confdir;). Each configuration file should contain the |
584ac89a KP |
240 | following structure: |
241 | <programlisting> | |
242 | <?xml version="1.0"?> | |
243 | <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
244 | <fontconfig> | |
245 | ... | |
246 | </fontconfig> | |
247 | </programlisting> | |
22dc6fc6 | 248 | </para> |
22671e25 | 249 | <refsect2><title><literal><fontconfig></literal></title><para> |
584ac89a | 250 | This is the top level element for a font configuration and can contain |
22671e25 KP |
251 | <sgmltag>dir</>, <sgmltag>cache</>, <sgmltag>include</>, <sgmltag>match</> and <sgmltag>alias</> elements in any order. |
252 | </para></refsect2> | |
253 | <refsect2><title><sgmltag>dir</></title><para> | |
584ac89a KP |
254 | This element contains a directory name which will be scanned for font files |
255 | to include in the set of available fonts. | |
22671e25 KP |
256 | </para></refsect2> |
257 | <refsect2><title><sgmltag>cache</></title><para> | |
584ac89a KP |
258 | This element contains a file name for the per-user cache of font |
259 | information. If it starts with '~', it refers to a file in the users | |
260 | home directory. This file is used to hold information about fonts that | |
261 | isn't present in the per-directory cache files. It is automatically | |
262 | maintained by the fontconfig library. The default for this file | |
22671e25 | 263 | is ``~/.fonts.cache-<sgmltag>version</>'', where <sgmltag>version</> is the font configuration |
584ac89a | 264 | file version number (currently 1). |
22671e25 KP |
265 | </para></refsect2> |
266 | <refsect2><title><sgmltag>include ignore_missing="no"</></title><para> | |
2d9c79c0 KP |
267 | This element contains the name of an additional configuration file or |
268 | directory. If a directory, every file within that directory starting with a | |
269 | number will be processed in sorted order. When | |
270 | the XML datatype is traversed by FcConfigParse, the contents of the file(s) | |
271 | will also be incorporated into the configuration by passing the filename(s) to | |
584ac89a | 272 | FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the |
2d9c79c0 KP |
273 | default "no", a missing file or directory will elicit no warning message from |
274 | the library. | |
22671e25 KP |
275 | </para></refsect2> |
276 | <refsect2><title><sgmltag>config</></title><para> | |
584ac89a | 277 | This element provides a place to consolodate additional configuration |
22671e25 | 278 | information. <sgmltag>config</> can contain <sgmltag>blank</> and <sgmltag>rescan</> elements in any |
584ac89a | 279 | order. |
22671e25 KP |
280 | </para></refsect2> |
281 | <refsect2><title><sgmltag>blank</></title><para> | |
584ac89a | 282 | Fonts often include "broken" glyphs which appear in the encoding but are |
22671e25 KP |
283 | drawn as blanks on the screen. Within the <sgmltag>blank</> element, place each |
284 | Unicode characters which is supposed to be blank in an <sgmltag>int</> element. | |
584ac89a KP |
285 | Characters outside of this set which are drawn as blank will be elided from |
286 | the set of characters supported by the font. | |
22671e25 KP |
287 | </para></refsect2> |
288 | <refsect2><title><sgmltag>rescan</></title><para> | |
289 | The <sgmltag>rescan</> element holds an <sgmltag>int</> element which indicates the default | |
584ac89a KP |
290 | interval between automatic checks for font configuration changes. |
291 | Fontconfig will validate all of the configuration files and directories and | |
292 | automatically rebuild the internal datastructures when this interval passes. | |
4f27c1c0 KP |
293 | </para></refsect2> |
294 | <refsect2><title><sgmltag>selectfont</></title><para> | |
295 | This element is used to black/white list fonts from being listed or matched | |
296 | against. It holds acceptfont and rejectfont elements. | |
297 | </para></refsect2> | |
298 | <refsect2><title><sgmltag>acceptfont</></title><para> | |
299 | Fonts matched by an acceptfont element are "whitelisted"; such fonts are | |
300 | explicitly included in the set of fonts used to resolve list and match | |
301 | requests; including them in this list protects them from being "blacklisted" | |
302 | by a rejectfont element. Acceptfont elements include glob and pattern | |
303 | elements which are used to match fonts. | |
304 | </para></refsect2> | |
305 | <refsect2><title><sgmltag>rejectfont</></title><para> | |
306 | Fonts matched by an rejectfont element are "blacklisted"; such fonts are | |
307 | excluded from the set of fonts used to resolve list and match requests as if | |
308 | they didn't exist in the system. Rejectfont elements include glob and | |
309 | pattern elements which are used to match fonts. | |
310 | </para></refsect2> | |
311 | <refsect2><title><sgmltag>glob</></title><para> | |
312 | Glob elements hold shell-style filename matching patterns (including ? and | |
313 | *) which match fonts based on their complete pathnames. This can be used to | |
314 | exclude a set of directories (/usr/share/fonts/uglyfont*), or particular | |
315 | font file types (*.pcf.gz), but the latter mechanism relies rather heavily | |
316 | on filenaming conventions which can't be relied upon. | |
317 | </para></refsect2> | |
318 | <refsect2><title><sgmltag>pattern</></title><para> | |
319 | Pattern elements perform list-style matching on incoming fonts; that is, | |
320 | they hold a list of elements and associated values. If all of those | |
321 | elements have a matching value, then the pattern matches the font. This can | |
322 | be used to select fonts based on attributes of the font (scalable, bold, | |
323 | etc), which is a more reliable mechanism than using file extensions. | |
324 | Pattern elements include patelt elements. | |
dbf68dd5 | 325 | </para></refsect2> |
4f27c1c0 KP |
326 | <refsect2><title><sgmltag>patelt name="property"</></title><para> |
327 | Patelt elements hold a single pattern element and list of values. They must | |
328 | have a 'name' attribute which indicates the pattern element name. Patelt | |
329 | elements include int, double, string, matrix, bool, charset and const | |
330 | elements. | |
22671e25 KP |
331 | </para></refsect2> |
332 | <refsect2><title><sgmltag>match target="pattern"</></title><para> | |
333 | This element holds first a (possibly empty) list of <sgmltag>test</> elements and then | |
334 | a (possibly empty) list of <sgmltag>edit</> elements. Patterns which match all of the | |
584ac89a KP |
335 | tests are subjected to all the edits. If 'target' is set to "font" instead |
336 | of the default "pattern", then this element applies to the font name | |
337 | resulting from a match rather than a font pattern to be matched. | |
22671e25 KP |
338 | </para></refsect2> |
339 | <refsect2><title><sgmltag>test qual="any" name="property" compare="eq"</></title><para> | |
584ac89a KP |
340 | This element contains a single value which is compared with the pattern |
341 | property "property" (substitute any of the property names seen | |
342 | above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", or | |
343 | "more_eq". 'qual' may either be the default, "any", in which case the match | |
344 | succeeds if any value associated with the property matches the test value, or | |
345 | "all", in which case all of the values associated with the property must | |
346 | match the test value. | |
22671e25 KP |
347 | </para></refsect2> |
348 | <refsect2><title><sgmltag>edit name="property" mode="assign" binding="weak"</></title><para> | |
584ac89a KP |
349 | This element contains a list of expression elements (any of the value or |
350 | operator elements). The expression elements are evaluated at run-time and | |
351 | modify the property "property". The modification depends on whether | |
22671e25 | 352 | "property" was matched by one of the associated <sgmltag>test</> elements, if so, the |
584ac89a KP |
353 | modification may affect the first matched value. Any values inserted into |
354 | the property are given the indicated binding. 'mode' is one of: | |
22671e25 KP |
355 | <programlisting> |
356 | Mode With Match Without Match | |
357 | --------------------------------------------------------------------- | |
358 | "assign" Replace matching value Replace all values | |
359 | "assign_replace" Replace all values Replace all values | |
360 | "prepend" Insert before matching Insert at head of list | |
361 | "prepend_first" Insert at head of list Insert at head of list | |
362 | "append" Append after matching Append at end of list | |
363 | "append_last" Append at end of list Append at end of list | |
364 | </programlisting> | |
365 | </para></refsect2> | |
366 | <refsect2><title><sgmltag>int</>, <sgmltag>double</>, <sgmltag>string</>, <sgmltag>bool</></title><para> | |
ddde1797 KP |
367 | These elements hold a single value of the indicated type. <sgmltag>bool</> |
368 | elements hold either true or false. An important limitation exists in | |
369 | the parsing of floating point numbers -- fontconfig requires that | |
370 | the mantissa start with a digit, not a decimal point, so insert a leading | |
371 | zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5 | |
372 | instead of -.5). | |
22671e25 KP |
373 | </para></refsect2> |
374 | <refsect2><title><sgmltag>matrix</></title><para> | |
375 | This element holds the four <sgmltag>double</> elements of an affine | |
584ac89a | 376 | transformation. |
22671e25 KP |
377 | </para></refsect2> |
378 | <refsect2><title><sgmltag>name</></title><para> | |
584ac89a KP |
379 | Holds a property name. Evaluates to the first value from the property of |
380 | the font, not the pattern. | |
22671e25 KP |
381 | </para></refsect2> |
382 | <refsect2><title><sgmltag>const</></title><para> | |
584ac89a KP |
383 | Holds the name of a constant; these are always integers and serve as |
384 | symbolic names for common font values: | |
22671e25 KP |
385 | <programlisting> |
386 | Constant Property Value | |
387 | ------------------------------------- | |
388 | light weight 0 | |
389 | medium weight 100 | |
390 | demibold weight 180 | |
391 | bold weight 200 | |
392 | black weight 210 | |
393 | roman slant 0 | |
394 | italic slant 100 | |
395 | oblique slant 110 | |
396 | proportional spacing 0 | |
a05d257f | 397 | dual spacing 90 |
22671e25 KP |
398 | mono spacing 100 |
399 | charcell spacing 110 | |
400 | unknown rgba 0 | |
401 | rgb rgba 1 | |
402 | bgr rgba 2 | |
403 | vrgb rgba 3 | |
404 | vbgr rgba 4 | |
405 | none rgba 5 | |
406 | </programlisting> | |
22dc6fc6 | 407 | </para> |
22671e25 KP |
408 | </refsect2> |
409 | <refsect2> | |
410 | <title><sgmltag>or</>, <sgmltag>and</>, <sgmltag>plus</>, <sgmltag>minus</>, <sgmltag>times</>, <sgmltag>divide</></title> | |
411 | <para> | |
584ac89a | 412 | These elements perform the specified operation on a list of expression |
22671e25 | 413 | elements. <sgmltag>or</> and <sgmltag>and</> are boolean, not bitwise. |
22dc6fc6 | 414 | </para> |
22671e25 KP |
415 | </refsect2> |
416 | <refsect2> | |
417 | <title><sgmltag>eq</>, <sgmltag>not_eq</>, <sgmltag>less</>, <sgmltag>less_eq</>, <sgmltag>more</>, <sgmltag>more_eq</></title> | |
418 | <para> | |
584ac89a | 419 | These elements compare two values, producing a boolean result. |
22671e25 KP |
420 | </para></refsect2> |
421 | <refsect2><title><sgmltag>not</></title><para> | |
584ac89a | 422 | Inverts the boolean sense of its one expression element |
22671e25 KP |
423 | </para></refsect2> |
424 | <refsect2><title><sgmltag>if</></title><para> | |
584ac89a KP |
425 | This element takes three expression elements; if the value of the first is |
426 | true, it produces the value of the second, otherwise it produces the value | |
427 | of the third. | |
22671e25 KP |
428 | </para></refsect2> |
429 | <refsect2><title><sgmltag>alias</></title><para> | |
584ac89a KP |
430 | Alias elements provide a shorthand notation for the set of common match |
431 | operations needed to substitute one font family for another. They contain a | |
22671e25 KP |
432 | <sgmltag>family</> element followed by optional <sgmltag>prefer</>, <sgmltag>accept</> and <sgmltag>default</> |
433 | elements. Fonts matching the <sgmltag>family</> element are edited to prepend the | |
434 | list of <sgmltag>prefer</>ed families before the matching <sgmltag>family</>, append the | |
435 | <sgmltag>accept</>able familys after the matching <sgmltag>family</> and append the <sgmltag>default</> | |
584ac89a | 436 | families to the end of the family list. |
22671e25 KP |
437 | </para></refsect2> |
438 | <refsect2><title><sgmltag>family</></title><para> | |
584ac89a | 439 | Holds a single font family name |
22671e25 KP |
440 | </para></refsect2> |
441 | <refsect2><title><sgmltag>prefer</>, <sgmltag>accept</>, <sgmltag>default</></title><para> | |
442 | These hold a list of <sgmltag>family</> elements to be used by the <sgmltag>alias</> element. | |
443 | <sgmltag>/article</> | |
444 | </para></refsect2> | |
445 | </refsect1> | |
446 | <refsect1><title>EXAMPLE CONFIGURATION FILE</title> | |
447 | <refsect2><title>System configuration file</title> | |
584ac89a KP |
448 | <para> |
449 | This is an example of a system-wide configuration file | |
450 | </para> | |
451 | <programlisting> | |
452 | <?xml version="1.0"?> | |
453 | <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
27de1f43 | 454 | <!-- &confdir;/fonts.conf file to configure system font access --> |
584ac89a KP |
455 | <fontconfig> |
456 | <!-- | |
457 | Find fonts in these directories | |
458 | --> | |
2d9c79c0 KP |
459 | <dir>/usr/share/fonts</dir> |
460 | <dir>/usr/X11R6/lib/X11/fonts</dir> | |
584ac89a KP |
461 | |
462 | <!-- | |
463 | Accept deprecated 'mono' alias, replacing it with 'monospace' | |
464 | --> | |
465 | <match target="pattern"> | |
466 | <test qual="any" name="family"><string>mono</string></test> | |
467 | <edit name="family" mode="assign"><string>monospace</string></edit> | |
468 | </match> | |
469 | ||
470 | <!-- | |
471 | Names not including any well known alias are given 'sans' | |
472 | --> | |
473 | <match target="pattern"> | |
474 | <test qual="all" name="family" mode="not_eq">sans</test> | |
475 | <test qual="all" name="family" mode="not_eq">serif</test> | |
476 | <test qual="all" name="family" mode="not_eq">monospace</test> | |
477 | <edit name="family" mode="append_last"><string>sans</string></edit> | |
478 | </match> | |
479 | ||
480 | <!-- | |
481 | Load per-user customization file, but don't complain | |
482 | if it doesn't exist | |
483 | --> | |
484 | <include ignore_missing="yes">~/.fonts.conf</include> | |
485 | ||
486 | <!-- | |
487 | Alias well known font names to available TrueType fonts. | |
488 | These substitute TrueType faces for similar Type1 | |
489 | faces to improve screen appearance. | |
490 | --> | |
491 | <alias> | |
492 | <family>Times</family> | |
493 | <prefer><family>Times New Roman</family></prefer> | |
494 | <default><family>serif</family></default> | |
495 | </alias> | |
496 | <alias> | |
497 | <family>Helvetica</family> | |
498 | <prefer><family>Verdana</family></prefer> | |
499 | <default><family>sans</family></default> | |
500 | </alias> | |
501 | <alias> | |
502 | <family>Courier</family> | |
503 | <prefer><family>Courier New</family></prefer> | |
504 | <default><family>monospace</family></default> | |
505 | </alias> | |
506 | ||
507 | <!-- | |
508 | Provide required aliases for standard names | |
509 | Do these after the users configuration file so that | |
510 | any aliases there are used preferentially | |
511 | --> | |
512 | <alias> | |
513 | <family>serif</family> | |
514 | <prefer><family>Times New Roman</family></prefer> | |
515 | </alias> | |
516 | <alias> | |
517 | <family>sans</family> | |
518 | <prefer><family>Verdana</family></prefer> | |
519 | </alias> | |
520 | <alias> | |
521 | <family>monospace</family> | |
522 | <prefer><family>Andale Mono</family></prefer> | |
523 | </alias> | |
524 | </fontconfig> | |
525 | </programlisting> | |
22671e25 KP |
526 | </refsect2> |
527 | <refsect2><title>User configuration file</title> | |
584ac89a KP |
528 | <para> |
529 | This is an example of a per-user configuration file that lives in | |
530 | ~/.fonts.conf | |
531 | </para> | |
532 | <programlisting> | |
533 | <?xml version="1.0"?> | |
534 | <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
535 | <!-- ~/.fonts.conf for per-user font configuration --> | |
536 | <fontconfig> | |
537 | ||
538 | <!-- | |
539 | Private font directory | |
540 | --> | |
2d9c79c0 | 541 | <dir>~/.fonts</dir> |
584ac89a KP |
542 | |
543 | <!-- | |
544 | use rgb sub-pixel ordering to improve glyph appearance on | |
545 | LCD screens. Changes affecting rendering, but not matching | |
546 | should always use target="font". | |
547 | --> | |
548 | <match target="font"> | |
549 | <edit name="rgba" mode="assign"><const>rgb</const></edit> | |
550 | </match> | |
551 | </fontconfig> | |
552 | </programlisting> | |
22671e25 KP |
553 | </refsect2> |
554 | </refsect1> | |
ae2c2943 | 555 | <refsect1><title>Files</title> |
584ac89a KP |
556 | <para> |
557 | <emphasis>fonts.conf</emphasis> | |
558 | contains configuration information for the fontconfig library | |
559 | consisting of directories to look at for font information as well as | |
560 | instructions on editing program specified font patterns before attempting to | |
561 | match the available fonts. It is in xml format. | |
562 | </para> | |
563 | <para> | |
564 | <emphasis>fonts.dtd</emphasis> | |
565 | is a DTD that describes the format of the configuration files. | |
566 | </para> | |
567 | <para> | |
568 | <emphasis>~/.fonts.conf</emphasis> | |
569 | is the conventional location for per-user font configuration, although the | |
570 | actual location is specified in the global fonts.conf file. | |
571 | </para> | |
572 | <para> | |
573 | <emphasis> ~/.fonts.cache-*</emphasis> | |
574 | is the conventional repository of font information that isn't found in the | |
575 | per-directory caches. This file is automatically maintained by fontconfig. | |
576 | </para> | |
22671e25 | 577 | </refsect1> |
ae2c2943 KP |
578 | <refsect1><title>Version</title> |
579 | <para> | |
580 | Fontconfig version &version; | |
581 | </para> | |
582 | </refsect1> | |
22671e25 | 583 | </refentry> |