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