]> git.wh0rd.org - fontconfig.git/blob - src/fontconfig.man
Dont attempt to use cache if NULL
[fontconfig.git] / src / fontconfig.man
1 .\"
2 .\" $RCSId: xc/lib/fontconfig/src/fontconfig.man,v 1.5 2002/08/26 19:57:40 keithp Exp $
3 .\"
4 .\" Copyright © 2002 Keith Packard
5 .\"
6 .\" Permission to use, copy, modify, distribute, and sell this software and its
7 .\" documentation for any purpose is hereby granted without fee, provided that
8 .\" the above copyright notice appear in all copies and that both that
9 .\" copyright notice and this permission notice appear in supporting
10 .\" documentation, and that the name of Keith Packard not be used in
11 .\" advertising or publicity pertaining to distribution of the software without
12 .\" specific, written prior permission. Keith Packard makes no
13 .\" representations about the suitability of this software for any purpose. It
14 .\" is provided "as is" without express or implied warranty.
15 .\"
16 .\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 .\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 .\" EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 .\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 .\" DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 .\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 .\" PERFORMANCE OF THIS SOFTWARE.
23 .\"
24 .de TQ
25 .br
26 .ns
27 .TP
28 \\$1
29 ..
30 .TH FONTCONFIG 3 "Version 1.0" "Fontconfig.org"
31
32 .SH NAME
33 fontconfig \- Font configuration and customization library
34
35 .SH SYNOPSIS
36 .nf
37 .B #include <fontconfig/fontconfig.h>
38 .B #include <fontconfig/fcfreetype.h>
39 .fi
40 .SH DESCRIPTION
41 .B Fontconfig
42 is a library designed to provide system-wide font configuration,
43 customization and application access.
44
45 .SH FUNCTIONAL OVERVIEW
46 Fontconfig contains two essential modules, the configuration module which
47 builds an internal configuration from XML files and the matching module
48 which accepts font patterns and returns the nearest matching font.
49
50 .SS FONT CONFIGURATION
51 The configuration module consists of the FcConfig datatype, libexpat and
52 FcConfigParse which walks over an XML tree and ammends a configuration with
53 data found within. From an external perspective, configuration of the
54 library consists of generating a valid XML tree and feeding that to
55 FcConfigParse. The only other mechanism provided to applications for
56 changing the running configuration is to add fonts and directories to the
57 list of application-provided font files.
58 .P
59 The intent is to make font configurations relatively static, and shared by
60 as many applications as possible. It is hoped that this will lead to more
61 stable font selection when passing names from one application to another.
62 XML was chosen as a configuration file format because it provides a format
63 which is easy for external agents to edit while retaining the correct
64 structure and syntax.
65 .P
66 Font configuration is separate from font matching; applications needing to
67 do their own matching can access the available fonts from the library and
68 perform private matching. The intent is to permit applications to pick and
69 choose appropriate functionality from the library instead of forcing them to
70 choose between this library and a private configuration mechanism. The hope
71 is that this will ensure that configuration of fonts for all applications
72 can be centralized in one place. Centralizing font configuration will make
73 simplify and regularize font installation and customization.
74
75 .SS FONT PROPERTIES
76 While font patterns may contain essentially any properties, there are some
77 well known properties with associated types. Fontconfig uses some of these
78 properties for font matching and font completion. Others are provided as a
79 convenience for the applications rendering mechanism.
80 .sp
81 .nf
82 .ta 1i 2.75i 3.5i 5.5i
83 .lc \(em
84 Property CPP symbol Type Description
85 \ 1\ 1\ 1\ 1
86 family FC_FAMILY String Font family name
87 style FC_STYLE String Font style. Overrides weight and slant
88 slant FC_SLANT Int Italic, oblique or roman
89 weight FC_WEIGHT Int Light, medium, demibold, bold or black
90 size FC_SIZE Double Point size
91 aspect FC_ASPECT Double Stretches glyphs horizontally before hinting
92 pixelsize FC_PIXEL_SIZE Double Pixel size
93 spacing FC_SPACING Int Proportional, monospace or charcell
94 foundry FC_FOUNDRY String Font foundry name
95 antialias FC_ANTIALIAS Bool Whether glyphs can be antialiased
96 hinting FC_HINTING Bool Whether the rasterizer should use hinting
97 verticallayout FC_VERTICAL_LAYOUT Bool Use vertical layout
98 autohint FC_AUTOHINT Bool Use autohinter instead of normal hinter
99 globaladvance FC_GLOBAL_ADVANCE Bool Use font global advance data
100 file FC_FILE String The filename holding the font
101 index FC_INDEX Int The index of the font within the file
102 ftface FC_FT_FACE FT_Face Use the specified FreeType face object
103 rasterizer FC_RASTERIZER String Which rasterizer is in use
104 outline FC_OUTLINE Bool Whether the glyphs are outlines
105 scalable FC_SCALABLE Bool Whether glyphs can be scaled
106 scale FC_SCALE Double Scale factor for point->pixel conversions
107 dpi FC_DPI Double Target dots per inch
108 rgba FC_RGBA Int unknown, rgb, bgr, vrgb, vbgr, none - subpixel geometry
109 minspace FC_MINSPACE Bool Eliminate leading from line spacing
110 charset FC_CHARSET CharSet Unicode chars encoded by the font
111 lang FC_LANG String List of RFC-3066-style languages this font supports
112 .DT
113 .fi
114
115 .SS FONT MATCHING
116 Fontconfig performs matching by measuring the distance from a provided
117 pattern to all of the available fonts in the system. The closest matching
118 font is selected. This ensures that a font will always be returned, but
119 doesn't ensure that it is anything like the requested pattern.
120 .P
121 Font matching starts with an application constructed pattern. The desired
122 attributes of the resulting font are collected together in an FcPattern
123 object. Each property of the pattern can contain one or more values; these
124 are listed in priority order; matches earlier in the list are considered
125 "closer" than matches later in the list.
126 .P
127 The initial pattern is modified by applying the list of editing instructions
128 specific to patterns found in the configuration; each consists of a match
129 predicate and a set of editing operations. They are executed in the order
130 they appeared in the configuration. Each match causes the associated
131 sequence of editing operations to be applied.
132 .P
133 After the pattern has been edited, a sequence of default substitutions are
134 performed to canonicalize the set of available properties; this avoids the
135 need for the lower layers to constantly provide default values for various
136 font properties during rendering.
137 .P
138 The canonical font pattern is finally matched against all available fonts.
139 The distance from the pattern to the font is measured for each of several
140 properties: foundry, charset, family, lang, spacing, pixelsize, style,
141 slant, weight, antialias, rasterizer and outline. This list is in priority
142 order -- results of comparing earlier elements of this list weigh more
143 heavily than later elements.
144 .P
145 There is one special case to this rule; family names are split into two
146 bindings; strong and weak. Strong family names are given greater precedence
147 in the match than lang elements while weak family names are given lower
148 precedence than lang elements. This permits the document language to drive
149 font selection when any document specified font is unavailable.
150 .P
151 The pattern representing that font is augmented to include any properties
152 found in the pattern but not found in the font itself; this permits the
153 application to pass rendering instructions or any other data through the
154 matching system. Finally, the list of editing instructions specific to
155 fonts found in the configuration are applied to the pattern. This modified
156 pattern is returned to the application.
157 .P
158 The return value contains sufficient information to locate and rasterize the
159 font, including the file name, pixel size and other rendering data. As
160 none of the information involved pertains to the FreeType library,
161 applications are free to use any rasterization engine or even to take
162 the identified font file and access it directly.
163 .P
164 The match/edit sequences in the configuration are performed in two passes
165 because there are essentially two different operations necessary -- the
166 first is to modify how fonts are selected; aliasing families and adding
167 suitable defaults. The second is to modify how the selected fonts are
168 rasterized. Those must apply to the selected font, not the original pattern
169 as false matches will often occur.
170 .SS FONT LIST MATCHING
171 .P
172 While many applications want to locate a single font best matching their
173 search criteria, other applications need to build a set of fonts which can
174 be used to present any Unicode data. Fontconfig provides an API to generate
175 a list sorted by the nearness of each font to the pattern. Every font in
176 the system is considered, the best matching fonts are placed first. The
177 application then can select whether the remaining fonts are unconditionally
178 included in the list, or whether they are included only if they cover
179 portions of Unicode not covered by any of the preceeding fonts.
180 .P
181 The list resulting from this match is represented by references to the
182 original font patterns and so consumes very little memory. Using a list
183 entry involves creating a pattern which combines the information from the
184 font with the information from the original pattern and executing the font
185 substitutions.
186 .SS FONT NAMES
187 Fontconfig provides a textual representation for patterns that the library
188 can both accept and generate. The representation is in three parts, first a
189 list of family names, second a list of point sizes and finally a list of
190 additional properties:
191 .nf
192 <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...
193 .fi
194 Values in a list are separated with commas. The name needn't include either
195 families or point sizes; they can be elided. In addition, there are
196 symbolic constants that simultaneously indicate both a name and a value.
197 Here are some examples:
198 .sp
199 .nf
200 .ta 1i 3i
201 Times-12 12 point Times Roman
202 Times-12:bold 12 point Times Bold
203 Courier:italic Courier Italic in the default size
204 Monospace:matrix=1 .1 0 1 The users preferred monospace font
205 with artificial obliquing
206 .fi
207 .DT
208
209 .SH LANG TAGS
210 .P
211 Each font in the database contains a list of languages it supports. This is
212 computed by comparing the Unicode coverage of the font with the orthography
213 of each language. Languages are tagged using an RFC-3066 compatible naming
214 and occur in two parts -- the ISO639 language tag followed a hyphen and then
215 by the ISO 3166 country code. The hyphen and country code may be elided.
216
217 .P
218 Fontconfig has orthographies for several languages built into the library.
219 No provision has been made for adding new ones aside from rebuilding the
220 library. It currently supports 122 of the 139 languages named in ISO 639-1,
221 141 of the languages with two-letter codes from ISO 639-2 and another 30
222 languages with only three-letter codes.
223
224 .SH DATATYPES
225
226 .TP
227 .B FcChar8
228 .TQ
229 .B FcChar16
230 .TQ
231 .B FcChar32
232 .TQ
233 .B FcBool
234 These are primitive datatypes; the FcChar* types hold precisely the number
235 of bits stated (if supported by the C implementation). FcBool holds
236 one of two CPP symbols: FcFalse or FcTrue.
237
238 .TP
239 .B FcMatrix
240 An FcMatrix holds an affine transformation, usually used to reshape glyphs.
241 A small set of matrix operations are provided to manipulate these.
242 .sp
243 .nf
244 typedef struct _FcMatrix {
245 double xx, xy, yx, yy;
246 } FcMatrix;
247 .fi
248
249 .TP
250 .B FcCharSet
251 An FcCharSet is an abstract type that holds the set of encoded unicode chars
252 in a font. Operations to build and compare these sets are provided.
253
254 .TP
255 .B FcType
256 Tags the kind of data stored in an FcValue.
257
258 .TP
259 .B FcValue
260 An FcValue object holds a single value with one of a number of different
261 types. The 'type' tag indicates which member is valid.
262 .sp
263 .nf
264 typedef struct _FcValue {
265 FcType type;
266 union {
267 const FcChar8 *s;
268 int i;
269 FcBool b;
270 double d;
271 const FcMatrix *m;
272 const FcCharSet *c;
273 } u;
274 } FcValue;
275 .fi
276 .P
277 .ta 1i 2i 3i 4i
278 .nf
279 .lc \(em
280 type Union member Datatype
281 \ 1\ 1\ 1
282 FcTypeVoid (none) (none)
283 FcTypeInteger i int
284 FcTypeDouble d double
285 FcTypeString s char *
286 FcTypeBool b b
287 FcTypeMatrix m FcMatrix *
288 FcTypeCharSet c FcCharSet *
289 .fi
290 .DT
291 .TP
292 .B FcPattern
293 holds a set of names with associated value lists; each name refers to a
294 property of a font. FcPatterns are used as inputs to the matching code as
295 well as holding information about specific fonts. Each property can hold
296 one or more values; conventionally all of the same type, although the
297 interface doesn't demand that.
298
299 .TP
300 .B FcFontSet
301 .sp
302 .nf
303 typedef struct _FcFontSet {
304 int nfont;
305 int sfont;
306 FcPattern **fonts;
307 } FcFontSet;
308 .fi
309 An FcFontSet contains a list of FcPatterns. Internally fontconfig uses this
310 data structure to hold sets of fonts. Externally, fontconfig returns the
311 results of listing fonts in this format. 'nfont' holds the number of
312 patterns in the 'fonts' array; 'sfont' is used to indicate the size of that
313 array.
314
315 .TP
316 .B FcStrSet
317 .B FcStrList
318 FcStrSet holds a list of strings that can be appended to and enumerated.
319 Its unique characteristic is that the enumeration works even while strings
320 are appended during enumeration. FcStrList is used during enumeration to
321 safely and correctly walk the list of strings even while that list is edited
322 in the middle of enumeration.
323
324 .TP
325 .B FcObjectSet
326 .sp
327 .nf
328 typedef struct _FcObjectSet {
329 int nobject;
330 int sobject;
331 const char **objects;
332 } FcObjectSet;
333 .fi
334 .sp
335 holds a set of names and is used to specify which fields from fonts are
336 placed in the the list of returned patterns when listing fonts.
337
338 .TP
339 .B FcObjectType
340 .sp
341 typedef struct _FcObjectType {
342 const char *object;
343 FcType type;
344 } FcObjectType;
345 .fi
346 marks the type of a pattern element generated when parsing font names.
347 Applications can add new object types so that font names may contain the new
348 elements.
349
350 .TP
351 .B FcConstant
352 .sp
353 typedef struct _FcConstant {
354 const FcChar8 *name;
355 const char *object;
356 int value;
357 } FcConstant;
358 .fi
359 Provides for symbolic constants for new pattern elements. When 'name' is
360 seen in a font name, an 'object' element is created with value 'value'.
361
362 .TP
363 .B FcBlanks
364 holds a list of Unicode chars which are expected to be blank; unexpectedly
365 blank chars are assumed to be invalid and are elided from the charset
366 associated with the font.
367
368 .TP
369 .B FcFileCache
370 holds the per-user cache information for use while loading the font
371 database. This is built automatically for the current configuration when
372 that is loaded. Applications must always pass '0' when one is requested.
373
374 .TP
375 .B FcConfig
376 holds a complete configuration of the library; there is one default
377 configuration, other can be constructed from XML data structures. All
378 public entry points that need global data can take an optional FcConfig*
379 argument; passing 0 uses the default configuration. FcConfig objects hold two
380 sets of fonts, the first contains those specified by the configuration, the
381 second set holds those added by the application at run-time. Interfaces
382 that need to reference a particulat set use one of the FcSetName enumerated
383 values.
384
385 .TP
386 .B FcSetName
387 Specifies one of the two sets of fonts available in a configuration;
388 FcSetSystem for those fonts specified in the configuration and
389 FcSetApplication which holds fonts provided by the application.
390
391 .TP
392 .B FcResult
393 Used as a return type for functions manipulating FcPattern objects.
394 .P
395 .ta 1i 3i 4i
396 .lc \(em
397 Result code Meaning
398 .br
399 \ 1\ 1
400 .br
401 FcResultMatch Object exists with the specified ID
402 .br
403 FcResultNoMatch Object doesn't exist at all
404 .br
405 FcResultTypeMismatch Object exists, but the type doesn't match
406 .br
407 FcResultNoId Object exists, but has fewer values than specified
408 .br
409 .DT
410
411 .TP
412 .B FcAtomic
413 Used for locking access to config files. Provides a safe way to update
414 configuration files.
415
416 .SH FUNCTIONS
417
418 .SS FcMatrix
419 FcMatrix structures hold an affine transformation in matrix form.
420 .TP
421 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, (m)->xy = (m)->yx = 0)
422 Initializes a matrix to the identify transformation.
423
424 .TP
425 FcMatrix *FcMatrixCopy (const FcMatrix *mat)
426 Allocates a new FcMatrix and copies 'mat' into it.
427
428 .TP
429 FcBool FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2)
430 Returns FcTrue if 'mat1' and 'mat2' are equal, else FcFalse.
431
432 .TP
433 void FcMatrixMultiply (FcMatrix *result, const FcMatrix *a, const FcMatrix *b)
434 Multiplies 'a' and 'b' together, placing the result in 'result'. 'result'
435 may refer to the sam matrix as either 'a' or 'b'.
436
437 .TP
438 void FcMatrixRotate (FcMatrix *m, double c, double s)
439 If 'c' is cos(angle) and 's' is sin(angle), FcMatrixRotate rotates the
440 matrix by 'angle'.
441
442 .TP
443 void FcMatrixScale (FcMatrix *m, double sx, double sy)
444 Scales 'm' by 'sx' in the horizontal dimension and 'sy' in the
445 vertical dimension.
446
447 .TP
448 void FcMatrixShear (FcMatrix *m, double sh, double sv)
449 Shears 'm' by 'sh' in the horizontal direction and 'sv' in the
450 vertical direction.
451
452 .SS FcCharSet
453 An FcCharSet is a boolean array indicating a set of unicode chars. Those
454 associated with a font are marked constant and cannot be edited.
455 FcCharSets may be reference counted internally to reduce memory consumption;
456 this may be visible to applications as the result of FcCharSetCopy may
457 return it's argument, and that CharSet may remain unmodifiable.
458
459 .TP
460 FcCharSet *FcCharSetCreate (void)
461 Creates an empty FcCharSet object.
462
463 .TP
464 void FcCharSetDestroy (FcCharSet *fcs)
465 Frees an FcCharSet object.
466
467 .TP
468 FcBool FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4)
469 Adds a single unicode char to the set, returning FcFalse on
470 failure, either as a result of a constant set or from running out of memory.
471
472 .TP
473 FcCharSet *FcCharSetCopy (FcCharSet *src)
474 Makes a copy of 'src'; note that this may not actually do anything more than
475 increment the reference count on 'src'.
476
477 .TP
478 FcBool FcCharSetEqual (const FcCharSet *a, const FcCharSet *b)
479 Returns whether 'a' and 'b' contain the same set of unicode chars.
480
481 .TP
482 FcCharSet *FcCharSetIntersect (const FcCharSet *a, const FcCharSet *b)
483 Returns a set including only those chars found in both 'a' and 'b'.
484
485 .TP
486 FcCharSet *FcCharSetUnion (const FcCharSet *a, const FcCharSet *b);
487 Returns a set including only those chars found in either 'a' or 'b'.
488
489 .TP
490 FcCharSet *FcCharSetSubtract (const FcCharSet *a, const FcCharSet *b)
491 Returns a set including only those chars found in 'a' but not 'b'.
492
493 .TP
494 FcBool FcCharSetHasChar (const FcCharSet *fcs, FcChar32 ucs4)
495 Returns whether 'fcs' contains the char 'ucs4'.
496
497 .TP
498 FcChar32 FcCharSetCount (const FcCharSet *a)
499 Returns the total number of unicode chars in 'a'.
500
501 .TP
502 FcChar32 FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b)
503 Returns the number of chars that are in both 'a' and 'b'.
504
505 .TP
506 FcChar32 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
507 Returns the number of chars that are in 'a' but not in 'b'.
508
509 .TP
510 FcBool FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b)
511 Returns whether 'a' is a subset of 'b'.
512
513 .TP
514 FcChar32 FcCharSetFirstPage (const FcCharSet *a, FcChar32 [FC_CHARSET_MAP_SIZE], FcChar32 *next)
515 Builds an array of bits marking the first page of Unicode coverage of 'a'.
516 Returns the base of the array. 'next' contains the next page in the font.
517
518 .TP
519 FcChar32 FcCharSetNextPage (const FcCharSet *a, FcChar32 [FC_CHARSET_MAP_SIZE], FcChar32 *next)
520 Builds an array of bits marking the Unicode coverage of 'a' for page '*next'.
521 Returns the base of the array. 'next' contains the next page in the font.
522
523 .SS FcValue
524 FcValue is a structure containing a type tag and a union of all possible
525 datatypes. The tag is an enum of type
526 .B FcType
527 and is intended to provide a measure of run-time
528 typechecking, although that depends on careful programming.
529
530 .TP
531 void FcValueDestroy (FcValue v)
532 Frees any memory referenced by `v'. Values of type FcTypeString,
533 FcTypeMatrix and FcTypeCharSet reference memory, the other types do not.
534
535 .TP
536 FcValue FcValueSave (FcValue v)
537 Returns a copy of `v' duplicating any object referenced by it so that `v'
538 may be safely destroyed without harming the new value.
539
540 .SS FcPattern
541 An FcPattern is an opaque type that holds both patterns to match against the
542 available fonts, as well as the information about each font.
543
544 .TP
545 FcPattern *FcPatternCreate (void)
546 Creates a pattern with no properties; used to build patterns from scratch.
547
548 .TP
549 void FcPatternDestroy (FcPattern *p)
550 Destroys a pattern, in the process destroying all related values.
551
552 .TP
553 FcBool FcPatternEqual (const FcPattern *pa, const FcPattern *pb);
554 Returns whether 'pa' and 'pb' are exactly alike.
555
556 .TP
557 FcBool FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os)
558 Returns whether 'pa' and 'pb' have exactly the same values for all of the
559 objects in 'os'.
560
561 .TP
562 FcChar32 FcPatternHash (const FcPattern *p)
563 Returns a 32-bit number which is the same for any two patterns which are
564 exactly alike.
565
566 .TP
567 FcBool FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append)
568 Adds a single value to the list of values associated with the property named
569 `object'. If `append' is FcTrue, the value is added at the end of any
570 existing list, otherwise it is inserted at the begining. `value' is saved
571 (with FcValueSave) when inserted into the pattern so that the library
572 retains no reference to any application-supplied data structure.
573
574 .TP
575 FcBool FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append)
576 FcPatternAddWeak is essentially the same as FcPatternAdd except that any
577 values added to the list have binding 'weak' instead of 'strong'.
578
579 .TP
580 FcBool FcPatternAddInteger (FcPattern *p, const char *object, int i)
581 .TQ
582 FcBool FcPatternAddDouble (FcPattern *p, const char *object, double d)
583 .TQ
584 FcBool FcPatternAddString (FcPattern *p, const char *object, const char *s)
585 .TQ
586 FcBool FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s)
587 .TQ
588 FcBool FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c)
589 .TQ
590 FcBool FcPatternAddBool (FcPattern *p, const char *object, FcBool b)
591 These are all convenience functions that insert objects of the specified
592 type into the pattern. Use these in preference to FcPatternAdd as they
593 will provide compile-time typechecking. These all append values to
594 any existing list of values.
595
596 .TP
597 FcResult FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v)
598 Returns in `v' the `id'th value associated with the property `object'.
599 The value returned is not a copy, but rather refers to the data stored
600 within the pattern directly. Applications must not free this value.
601
602 .TP
603 FcResult FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
604 .TQ
605 FcResult FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
606 .TQ
607 FcResult FcPatternGetString (FcPattern *p, const char *object, int n, char **const s);
608 .TQ
609 FcResult FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
610 .TQ
611 FcResult FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c);
612 .TQ
613 FcResult FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
614 These are convenience functions that call FcPatternGet and verify that the
615 returned data is of the expected type. They return FcResultTypeMismatch if
616 this is not the case. Note that these (like FcPatternGet) do not make a
617 copy of any data structure referenced by the return value. Use these
618 in preference to FcPatternGet to provide compile-time typechecking.
619
620 .TP
621 FcPattern *FcPatternBuild (FcPattern *orig, ...);
622 .TQ
623 FcPattern *FcPatternVaBuild (FcPattern *orig, va_list va)
624 Builds a pattern using a list of objects, types and values. Each
625 value to be entered in the pattern is specified with three arguments:
626 .IP
627 1. Object name, a string describing the property to be added.
628 .IP
629 2. Object type, one of the FcType enumerated values
630 .IP
631 3. Value, not an FcValue, but the raw type as passed to any of the
632 FcPatternAdd<type> functions. Must match the type of the second argument.
633 .IP
634 The argument list is terminated by a null object name, no object type nor
635 value need be passed for this. The values are added to `pattern', if
636 `pattern' is null, a new pattern is created. In either case, the pattern is
637 returned. Example:
638 .RS
639 .IP
640 pattern = FcPatternBuild (0, FC_FAMILY, FtTypeString, "Times", (char *) 0);
641 .RE
642 .IP
643 FcPatternVaBuild is used when the arguments are already in the form of a
644 varargs value.
645
646 .TP
647 FcBool FcPatternDel (FcPattern *p, const char *object)
648 Deletes all values associated with the property `object', returning
649 whether the property existed or not.
650
651 .TP
652 void FcPatternPrint (const FcPattern *p)
653 Prints an easily readable version of the pattern to stdout. There is
654 no provision for reparsing data in this format, it's just for diagnostics
655 and debugging.
656
657 .TP
658 void FcDefaultSubstitute (FcPattern *pattern)
659 Supplies default values for underspecified font patterns:
660 .RS
661 .IP \(bu
662 Patterns without a specified style or weight are set to Medium
663 .IP \(bu
664 Patterns without a specified style or slant are set to Roman
665 .IP \(bu
666 Patterns without a specified pixel size are given one computed from
667 any specified point size (default 12), dpi (default 75) and scale (default
668 1).
669 .RE
670
671 .TP
672 FcPattern *FcNameParse (const char *name)
673 Converts 'name' from the standard text format described above into a pattern.
674
675 .TP
676 FcChar8 *FcNameUnparse (FcPattern *pat)
677 Converts the given pattern into the standard text format described above.
678 The return value is not static, but instead refers to newly allocated memory
679 which should be freed by the caller.
680
681 .SS FcFontSet
682 An FcFontSet simply holds a list of patterns; these are used to return the
683 results of listing available fonts.
684 .TP
685 FcFontSet *FcFontSetCreate (void)
686 Creates an empty font set.
687
688 .TP
689 void FcFontSetDestroy (FcFontSet *s);
690 Destroys a font set. Note that this destroys any referenced patterns as
691 well.
692
693 .TP
694 FcBool FcFontSetAdd (FcFontSet *s, FcPattern *font)
695 Adds a pattern to a font set. Note that the pattern is not copied before
696 being inserted into the set.
697
698 .SS FcObjectSet
699 An FcObjectSet holds a list of pattern property names; it is used to
700 indiciate which properties are to be returned in the patterns from
701 FcFontList.
702
703 .TP
704 FcObjectSet *FcObjectSetCreate (void)
705 Creates an empty set.
706
707 .TP
708 FcBool FcObjectSetAdd (FcObjectSet *os, const char *object)
709 Adds a proprety name to the set.
710
711 .TP
712 void FcObjectSetDestroy (FcObjectSet *os)
713 Destroys an object set.
714
715
716 .TP
717 FcObjectSet *FcObjectSetBuild (const char *first, ...)
718 .TQ
719 FcObjectSet *FcObjectSetVaBuild (const char *first, va_list va)
720 These build an object set from a null-terminated list of property names.
721
722 .SS FcObjectType
723 Provides for applcation-specified font name object types so that new
724 pattern elements can be generated from font names.
725
726 .TP
727 FcBool FcNameRegisterObjectTypes (const FcObjectType *types, int ntype)
728 Register 'ntype' new object types.
729
730 .TP
731 FcBool FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype)
732 Unregister 'ntype' object types.
733
734 .TP
735 const FcObjectType *FcNameGetObjectType (const char *object)
736 Return the object type for the pattern element named 'object'.
737
738 .SS FcConstant
739 Provides for application-specified symbolic constants for font names.
740
741 .TP
742 FcBool FcNameRegisterConstants (const FcConstant *consts, int nconsts)
743 Register 'nconsts' new symbolic constants.
744
745 .TP
746 FcBool FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
747 Unregister 'nconsts' symbolic constants.
748
749 .TP
750 const FcConstant *FcNameGetConstant (FcChar8 *string)
751 Return the FcConstant structure related to symbolic constant 'string'.
752
753 .TP
754 FcBool FcNameConstant (FcChar8 *string, int *result);
755 Returns whether a symbolic constant with name 'string' is registered,
756 placing the value of the constant in 'result' if present.
757
758 .SS FcBlanks
759 An FcBlanks object holds a list of Unicode chars which are expected to
760 be blank when drawn. When scanning new fonts, any glyphs which are
761 empty and not in this list will be assumed to be broken and not placed in
762 the FcCharSet associated with the font. This provides a significantly more
763 accurate CharSet for applications.
764
765 .TP
766 FcBlanks *FcBlanksCreate (void)
767 Creates an empty FcBlanks object.
768
769 .TP
770 void FcBlanksDestroy (FcBlanks *b)
771 Destroys an FcBlanks object, freeing any associated memory.
772
773 .TP
774 FcBool FcBlanksAdd (FcBlanks *b, FcChar32 ucs4)
775 Adds a single character to an FcBlanks object, returning FcFalse
776 if this process ran out of memory.
777
778 .TP
779 FcBool FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4)
780 Returns whether the specified FcBlanks object contains the indicated Unicode
781 value.
782
783 .SS FcConfig
784 An FcConfig object holds the internal representation of a configuration.
785 There is a default configuration which applications may use by passing 0 to
786 any function using the data within an FcConfig.
787
788 .TP
789 FcConfig *FcConfigCreate (void)
790 Creates an empty configuration.
791
792 .TP
793 void FcConfigDestroy (FcConfig *config)
794 Destroys a configuration and any data associated with it. Note that calling
795 this function with the return from FcConfigGetCurrent will place the library
796 in an indeterminate state.
797
798 .TP
799 FcBool FcConfigSetCurrent (FcConfig *config)
800 Sets the current default configuration to 'config'. Implicitly calls
801 FcConfigBuildFonts if necessary, returning FcFalse if that call fails.
802
803 .TP
804 FcConfig *FcConfigGetCurrent (void)
805 Returns the current default configuration.
806
807 .TP
808 FcBool FcConfigUptoDate (FcConfig *config)
809 Checks all of the files related to 'config' and returns whether the
810 in-memory version is in sync with the disk version.
811
812 .TP
813 FcBool FcConfigBuildFonts (FcConfig *config)
814 Builds the set of available fonts for the given configuration. Note that
815 any changes to the configuration after this call have indeterminate effects.
816 Returns FcFalse if this operation runs out of memory.
817
818 .TP
819 FcStrList *FcConfigGetConfigDirs (FcConfig *config)
820 Returns the list of font directories specified in the configuration files
821 for 'config'. Does not include any subdirectories.
822
823 .TP
824 FcStrList *FcConfigGetFontDirs (FcConfig *config)
825 Returns the list of font directories in 'config'. This includes the
826 configured font directories along with any directories below those in the
827 filesystem.
828
829 .TP
830 FcStrList *FcConfigGetConfigFiles (FcConfig *config)
831 Returns the list of known configuration files used to generate 'config'.
832 Note that this will not include any configuration done with FcConfigParse.
833
834 .TP
835 char *FcConfigGetCache (FcConfig *config)
836 Returns the name of the file used to store per-user font information.
837
838 .TP
839 FcFontSet *FcConfigGetFonts (FcConfig *config, FcSetName set)
840 Returns one of the two sets of fonts from the configuration as specified
841 by 'set'.
842
843 .TP
844 FcBlanks *FcConfigGetBlanks (FcConfig *config)
845 Returns the FcBlanks object associated with the given configuration, if no
846 blanks were present in the configuration, this function will return 0.
847
848 .TP
849 int FcConfigGetRescanInverval (FcConfig *config)
850 Returns the interval between automatic checks of the configuration (in
851 seconds) specified in 'config'. The configuration is checked during
852 a call to FcFontList when this interval has passed since the last check.
853
854 .TP
855 FcBool FcConfigSetRescanInverval (FcConfig *config, int rescanInterval)
856 Sets the rescan interval; returns FcFalse if an error occurred.
857
858 .TP
859 FcBool FcConfigAppFontAddFile (FcConfig *config, const char *file)
860 Adds an application-specific font to the configuration.
861
862 .TP
863 FcBool FcConfigAppFontAddDir (FcConfig *config, const char *dir)
864 Scans the specified directory for fonts, adding each one found to the
865 application-specific set of fonts.
866
867 .TP
868 void FcConfigAppFontClear (FcConfig *config)
869 Clears the set of application-specific fonts.
870
871 .TP
872 FcBool FcConfigSubstituteWithPat (FcConfig *config, FcPattern *p, FcPattern *p_pat FcMatchKind kind)
873 Performs the sequence of pattern modification operations, if 'kind' is
874 FcMatchPattern, then those tagged as pattern operations are applied, else
875 if 'kind' is FcMatchFont, those tagged as font operations are applied and
876 p_pat is used for <test> elements with target=pattern.
877
878 .TP
879 FcBool FcConfigSubstitute (FcConfig *config, FcPattern *p, FcMatchKind kind)
880 Calls FcConfigSubstituteWithPat setting p_pat to NULL.
881
882 .TP
883 FcPattern *FcFontMatch (FcConfig *config, FcPattern *p, FcResult *result)
884 Returns the font in 'config' most close matching 'p'. This function
885 should be called only after FcConfigSubstitute and FcDefaultSubstitute have
886 been called for 'p'; otherwise the results will not be correct.
887
888 .TP
889 FcFontSet *FcFontSort (FcConfig *config, FcPattern *p, FcBool trim, FcCharSet **csp, FcResult *result) Returns the list of fonts sorted by
890 closeness to 'p'. If 'trim' is FcTrue, elements in the list which don't
891 include Unicode coverage not provided by earlier elements in the list are
892 elided. The union of Unicode coverage of all of the fonts is returned
893 in 'csp', if 'csp' is not NULL. This function should be called only after
894 FcConfigSubstitute and FcDefaultSubstitute have been called for 'p';
895 otherwise the results will not be correct.
896 .P
897 The returned FcFontSet references FcPattern structures which may be shared
898 by the return value from multiple FcFontSort calls, applications must not
899 modify these patterns. Instead, they should be passed, along with 'p' to
900 FcFontRenderPrepare which combines them into a complete pattern.
901 .P
902 The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy.
903
904 .TP
905 FcPattern *FcFontRenderPrepare (FcConfig *config, FcPattern *pat, FcPattern *font)
906 Creates a new pattern consisting of elements of 'font' not appearing
907 in 'pat', elements of 'pat' not appearing in 'font' and the best matching
908 value from 'pat' for elements appearing in both. The result is passed to
909 FcConfigSubstitute with 'kind' FcMatchFont and then returned.
910
911 .TP
912 FcFontSet *FcFontList (FcConfig *config, FcPattern *p, FcObjectSet *os)
913 Selects fonts matching 'p', creates patterns from those fonts containing
914 only the objects in 'os' and returns the set of unique such patterns.
915
916 .TP
917 char *FcConfigFilename (const char *name)
918 Given the specified external entity name, return the associated filename.
919 This provides applications a way to convert various configuration file
920 references into filename form.
921 .P
922 A null or empty 'name' indicates that the default configuration file should
923 be used; which file this references can be overridden with the
924 FC_CONFIG_FILE environment variable. Next, if the name starts with '~', it
925 refers to a file in the current users home directory. Otherwise if the name
926 doesn't start with '/', it refers to a file in the default configuration
927 directory; the built-in default directory can be overridden with the
928 FC_CONFIG_DIR environment variable.
929
930 .SS Initialization
931 These functions provide some control over how the library is initialized.
932
933 .TP
934 FcConfig *FcInitLoadConfig (void)
935 Loads the default configuration file and returns the resulting configuration.
936 Does not load any font information.
937
938 .TP
939 FcConfig *FcInitLoadConfigAndFonts (void)
940 Loads the default configuration file and builds information about the
941 available fonts. Returns the resulting configuration.
942
943 .TP
944 FcBool FcInit (void)
945 Loads the default configuration file and the fonts referenced therein and
946 sets the default configuration to that result. Returns whether this
947 process succeeded or not. If the default configuration has already
948 been loaded, this routine does nothing and returns FcTrue.
949
950 .TP
951 int FcGetVersion (void)
952 Returns the version number of the library.
953
954 .TP
955 FcBool FcInitReinitialize (void)
956 Forces the default configuration file to be reloaded and resets the default
957 configuration.
958
959 .TP
960 FcBool FcInitBringUptoDate (void)
961 Checks the rescan interval in the default configuration, checking the
962 configuration if the interval has passed and reloading the configuration if
963 when any changes are detected.
964
965 .SS FcAtomic
966 These functions provide a safe way to update config files, allowing ongoing
967 reading of the old config file while locked for writing and ensuring that a
968 consistent and complete version of the config file is always available.
969
970 .TP
971 FcAtomic * FcAtomicCreate (const FcChar8 *file)
972 Creates a data structure containing data needed to control access to 'file'.
973 Writing is done to a separate file. Once that file is complete, the original
974 configuration file is atomically replaced so that reading process always see
975 a consistent and complete file without the need to lock for reading.
976
977 .TP
978 FcBool FcAtomicLock (FcAtomic *atomic)
979 Attempts to lock the file referenced by 'atomic'. Returns FcFalse if the
980 file is locked by another process, else returns FcTrue and leaves the file
981 locked.
982
983 .TP
984 FcChar8 *FcAtomicNewFile (FcAtomic *atomic)
985 Returns the filename for writing a new version of the file referenced
986 by 'atomic'.
987
988 .TP
989 FcChar8 *FcAtomicOrigFile (FcAtomic *atomic)
990 Returns the file refernced by 'atomic'.
991
992 .TP
993 FcBool FcAtomicReplaceOrig (FcAtomic *atomic)
994 Replaces the original file referenced by 'atomic' with the new file.
995
996 .TP
997 void FcAtomicDeleteNew (FcAtomic *atomic)
998 Deletes the new file.
999
1000 .TP
1001 void FcAtomicUnlock (FcAtomic *atomic)
1002 Unlocks the file.
1003
1004 .TP
1005 void FcAtomicDestroy (FcAtomic *atomic)
1006 Destroys 'atomic'.
1007
1008 .SS FreeType specific functions
1009 .nf
1010 .B #include <fontconfig/fcfreetype.h>
1011 .fi
1012 While the fontconfig library doesn't insist that FreeType be used as the
1013 rasterization mechanism for fonts, it does provide some convenience
1014 functions.
1015
1016 .TP
1017 FT_UInt FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4)
1018 Maps a Unicode char to a glyph index. This function uses information from
1019 several possible underlying encoding tables to work around broken fonts.
1020 As a result, this function isn't designed to be used in performance
1021 sensitive areas; results from this function are intended to be cached by
1022 higher level functions.
1023
1024 .TP
1025 FcCharSet *FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks) Scans a
1026 FreeType face and returns the set of encoded Unicode chars. This scans
1027 several encoding tables to build as complete a list as possible.
1028 If 'blanks' is not 0, the glyphs in the font are examined and any blank glyphs
1029 not in 'blanks' are not placed in the returned FcCharSet.
1030
1031 .TP
1032 FcPattern *FcFreeTypeQuery (const char *file, int id, FcBlanks *blanks, int *count)
1033 Constructs a pattern representing the 'id'th font in 'file'. The number
1034 of fonts in 'file' is returned in 'count'.
1035
1036 .SS XML specific functions
1037 .TP
1038 FcBool FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain)
1039 Walks the configuration in 'file' and constructs the internal representation
1040 in 'config'. Any include files referenced from within 'file' will be loaded
1041 with FcConfigLoad and also parsed. If 'complain' is FcFalse, no warning
1042 will be displayed if 'file' does not exist.
1043
1044 .SS File and Directory routines
1045
1046 .TP
1047 FcBool FcFileScan (FcFontSet *set, FcStrSet *dirs, FcFileCache *cache, FcBlanks *blanks, const char *file, FcBool force)
1048 Scans a single file and adds all fonts found to 'set'. If 'force' is FcTrue,
1049 then the file is scanned even if associated information is found in 'cache'.
1050 If 'file' is a directory, it is added to 'dirs'.
1051
1052 .TP
1053 FcBool FcDirScan (FcFontSet *set, FcStrSet *dirs, FcFileCache *cache, FcBlanks *blanks, const char *dir, FcBool force)
1054 Scans an entire directory and adds all fonts found to 'set'. If 'force' is
1055 FcTrue, then the directory and all files within it are scanned even if
1056 information is present in the per-directory cache file or 'cache'. Any
1057 subdirectories found are added to 'dirs'.
1058
1059 .TP
1060 FcBool FcDirSave (FcFontSet *set, FcStrSet *dirs, const char *dir)
1061 Creates the per-directory cache file for 'dir' and populates it with the
1062 fonts in 'set' and subdirectories in 'dirs'.
1063
1064 .TP
1065 FcBool FcDirCacheValid (const FcChar8 *cache_file)
1066 Returns FcTrue if 'cache_file' is no older than the directory containing it,
1067 else FcFalse.
1068
1069 .SS FcStrSet and FcStrList
1070 A data structure for enumerating strings, used to list directories while
1071 scanning the configuration as directories are added while scanning.
1072
1073 .TP
1074 FcStrSet *FcStrSetCreate (void)
1075 Create an empty set.
1076
1077 .TP
1078 FcBool FcStrSetMember (FcStrSet *set, const FcChar8 *s)
1079 Returns whether 's' is a member of 'set'.
1080
1081 .TP
1082 FcBool FcStrSetAdd (FcStrSet *set, const FcChar8 *s)
1083 Adds a copy of 's' to 'set'.
1084
1085 .TP
1086 FcBool FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s)
1087 Adds a copy 's' to 'set', The copy is created with FcStrCopyFilename
1088 so that leading '~' values are replaced with the value of the HOME
1089 environment variable.
1090
1091 .TP
1092 FcBool FcStrSetDel (FcStrSet *set, const FcChar8 *s)
1093 Removes 's' from 'set', returning FcTrue if 's' was a member else FcFalse.
1094
1095 .TP
1096 void FcStrSetDestroy (FcStrSet *set)
1097 Destroys 'set'.
1098
1099 .TP
1100 FcStrList *FcStrListCreate (FcStrSet *set)
1101 Creates an enumerator to list the strings in 'set'.
1102
1103 .TP
1104 FcChar8 *FcStrListNext (FcStrList *list)
1105 Returns the next string in 'set'.
1106
1107 .TP
1108 void FcStrListDone (FcStrList *list)
1109 Destroys the enumerator 'list'.
1110
1111 .SS String utilities
1112
1113 .TP
1114 int FcUtf8ToUcs4 (FcChar8 *src, FcChar32 *dst, int len)
1115 Converts the next Unicode char from 'src' into 'dst' and returns the number
1116 of bytes containing the char. 'src' nust be at least 'len' bytes long.
1117
1118 .TP
1119 int FcUcs4ToUtf8 (FcChar32 src, FcChar8 dst[FC_UTF8_MAX_LEN])
1120 Converts the Unicode char from 'src' into 'dst' and returns the
1121 number of bytes needed to encode the char.
1122
1123 .TP
1124 FcBool FcUtf8Len (FcChar8 *src, int len, int *nchar, int *wchar)
1125 Counts the number of Unicode chars in 'len' bytes of 'src'. Places that
1126 count in 'nchar'. 'wchar' contains 1, 2 or 4 depending on the number of
1127 bytes needed to hold the largest unicode char counted. The return value
1128 indicates whether 'src' is a well-formed UTF8 string.
1129
1130 .TP
1131 int FcUtf16ToUcs4 (FcChar8 *src, FcEndian endian, FcChar32 *dst, int len)
1132 Converts the next Unicode char from 'src' into 'dst' and returns the
1133 number of bytes containing the char. 'src' must be at least 'len' bytes
1134 long. Bytes of 'src' are combined into 16-bit units according to 'endian'.
1135
1136 .TP
1137 FcBool FcUtf16Len (FcChar8 *src, FcEndian endian, int len, int *nchar, int *wchar)
1138 Counts the number of Unicode chars in 'len' bytes of 'src'. Bytes of 'src'
1139 are combined into 16-bit units according to 'endian'. Places that
1140 count in 'nchar'. 'wchar' contains 1, 2 or 4 depending on the number of
1141 bytes needed to hold the largest unicode char counted. The return value
1142 indicates whether 'string' is a well-formed UTF16 string.
1143
1144 .TP
1145 FcChar8 *FcStrCopy (const FcChar8 *s)
1146 Allocates memory, copies 's' and returns the resulting buffer. Yes, this
1147 is 'strdup', but that function isn't available on every platform.
1148
1149 .TP
1150 FcChar8 *FcStrCopyFilename (const FcChar8 *s)
1151 Just like FcStrCopy except that it converts any leading '~' characters
1152 in 's' to the value of the HOME environment variable.
1153
1154 .TP
1155 int FcStrCmpIgnoreCase (const char *s1, const char *s2)
1156 Returns the usual <0, 0, >0 result of comparing 's1' and 's2'. This test
1157 is case-insensitive in the ASCII range and will operate properly with UTF8
1158 encoded strings, although it does not check for well formed strings.
1159
1160 .TP
1161 FcChar8 *FcStrDirname (const FcChar8 *file)
1162 Returns the directory containing 'file'.
1163
1164 .TP
1165 FcChar8 *FcStrBasename (const FcChar8 *file)
1166 Returns the filename of 'file' stripped of any leading directory names.
1167
1168 .SH CONFIGURATION FILE FORMAT
1169 Configuration files for fontconfig are stored in XML format; this
1170 format makes external configuration tools easier to write and ensures that
1171 they will generate syntactically correct configuration files. As XML
1172 files are plain text, they can also be manipulated by the expert user using
1173 a text editor.
1174 .P
1175 The fontconfig document type definition resides in the external entity
1176 "fonts.dtd"; this is normally stored in the default font configuration
1177 directory (/etc/fonts). Each configuration file should contain the
1178 following structure:
1179 .sp
1180 .nf
1181 <?xml version="1.0"?>
1182 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
1183 <fontconfig>
1184 ...
1185 </fontconfig>
1186 .fi
1187 .P
1188 .SS <fontconfig>
1189 This is the top level element for a font configuration and can contain
1190 <dir>, <cache>, <include>, <match> and <alias> elements in any order.
1191
1192 .SS <dir>
1193 This element contains a directory name which will be scanned for font files
1194 to include in the set of available fonts.
1195
1196 .SS <cache>
1197 This element contains a file name for the per-user cache of font
1198 information. If it starts with '~', it refers to a file in the users
1199 home directory. This file is used to hold information about fonts that
1200 isn't present in the per-directory cache files. It is automatically
1201 maintained by the fontconfig library. The default for this file
1202 is ``~/.fonts.cache-<version>'', where <version> is the font configuration
1203 file version number (currently 1).
1204
1205 .SS <include ignore_missing="no">
1206 This element contains the name of an additional configuration file. When
1207 the XML datatype is traversed by FcConfigParse, the contents of the file
1208 will also be incorporated into the configuration by passing the filename to
1209 FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the
1210 default "no", a missing file will elicit no warning message from the library.
1211
1212 .SS <config>
1213 This element provides a place to consolodate additional configuration
1214 information. <config> can contain <blank> and <rescan> elements in any
1215 order.
1216
1217 .SS <blank>
1218 Fonts often include "broken" glyphs which appear in the encoding but are
1219 drawn as blanks on the screen. Within the <blank> element, place each
1220 Unicode characters which is supposed to be blank in an <int> element.
1221 Characters outside of this set which are drawn as blank will be elided from
1222 the set of characters supported by the font. <b
1223
1224 .SS <rescan>
1225 The <rescan> element holds an <int> element which indicates the default
1226 interval between automatic checks for font configuration changes.
1227 Fontconfig will validate all of the configuration files and directories and
1228 automatically rebuild the internal datastructures when this interval passes.
1229
1230 .SS <match target="pattern">
1231 This element holds first a (possibly empty) list of <test> elements and then
1232 a (possibly empty) list of <edit> elements. Patterns which match all of the
1233 tests are subjected to all the edits. If 'target' is set to "font" instead
1234 of the default "pattern", then this element applies to the font name
1235 resulting from a match rather than a font pattern to be matched.
1236
1237 .SS <test qual="any" name="property" compare="eq">
1238 This element contains a single value which is compared with the pattern
1239 property "property" (substitute any of the property names seen
1240 above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", or
1241 "more_eq". 'qual' may either be the default, "any", in which case the match
1242 succeeds if any value associated with the property matches the test value, or
1243 "all", in which case all of the values associated with the property must
1244 match the test value.
1245
1246 .SS <edit name="property" mode="assign" binding="weak">
1247 This element contains a list of expression elements (any of the value or
1248 operator elements). The expression elements are evaluated at run-time and
1249 modify the property "property". The modification depends on whether
1250 "property" was matched by one of the associated <test> elements, if so, the
1251 modification may affect the first matched value. Any values inserted into
1252 the property are given the indicated binding. 'mode' is one of:
1253 .nf
1254 .RS
1255 .ta 1i 3i 5i
1256 Mode Operation with match Operation without match
1257 \ 1\ 1\ 1
1258 "assign" Replace matching value Replace all values
1259 "assign_replace" Replace all values Replace all values
1260 "prepend" Insert before matching value Insert at head of list
1261 "prepend_first" Insert at head of list Insert at head of list
1262 "append" Append after matching value Append at end of list
1263 "append_last" Append at end of list Append at end of list
1264 .RE
1265 .DT
1266 .fi
1267 .SS <int>
1268 .SS <double>
1269 .SS <string>
1270 .SS <bool>
1271 These elements hold a single value of the indicated type. <bool> elements
1272 hold either true or false.
1273 .SS <matrix>
1274 This element holds the four <double> elements of an affine transformation.
1275 .SS <name>
1276 Holds a property name. Evaluates to the first value from the property of
1277 the font, not the pattern.
1278 .SS <const>
1279 Holds the name of a constant; these are always integers and serve as
1280 symbolic names for common font values:
1281 .RS
1282 .sp
1283 .nf
1284 .ta 1i 2i 3i
1285 .lc \(em
1286 Constant Property CPP symbol
1287 \ 1\ 1\ 1
1288 light weight FC_WEIGHT_LIGHT
1289 medium weight FC_WEIGHT_MEDIUM
1290 demibold weight FC_WEIGHT_DEMIBOLD
1291 bold weight FC_WEIGHT_BOLD
1292 black weight FC_WEIGHT_BLACK
1293 roman slant FC_SLANT_ROMAN
1294 italic slant FC_SLANT_ITALIC
1295 oblique slant FC_SLANT_OBLIQUE
1296 proportional spacing FC_PROPORTIONAL
1297 mono spacing FC_MONO
1298 charcell spacing FC_CHARCELL
1299 unknown rgba FC_RGBA_UNKNOWN
1300 rgb rgba FC_RGBA_RGB
1301 bgr rgba FC_RGBA_BGR
1302 vrgb rgba FC_RGBA_VRGB
1303 vbgr rgba FC_RGBA_VBGR
1304 none rgba FC_RGBA_NONE
1305 .DT
1306 .fi
1307 .RE
1308 .SS <or>
1309 .SS <and>
1310 .SS <plus>
1311 .SS <minus>
1312 .SS <times>
1313 .SS <divide>
1314 These elements perform the specified operation on a list of expression
1315 elements. <or> and <and> are boolean, not bitwise.
1316 .SS <eq>
1317 .SS <not_eq>
1318 .SS <less>
1319 .SS <less_eq>
1320 .SS <more>
1321 .SS <more_eq>
1322 These elements compare two values, producing a boolean result.
1323 .SS <not>
1324 Inverts the boolean sense of its one expression element
1325 .SS <if>
1326 This element takes three expression elements; if the value of the first is
1327 true, it produces the value of the second, otherwise it produces the value
1328 of the third.
1329 .SS <alias>
1330 Alias elements provide a shorthand notation for the set of common match
1331 operations needed to substitute one font family for another. They contain a
1332 <family> element followed by optional <prefer>, <accept> and <default>
1333 elements. Fonts matching the <family> element are edited to prepend the
1334 list of <prefer>ed families before the matching <family>, append the
1335 <accept>able familys after the matching <family> and append the <default>
1336 families to the end of the family list.
1337 .SS <family>
1338 Holds a single font family name
1339 .SS <prefer>
1340 .SS <accept>
1341 .SS <default>
1342 These hold a list of <family> elements to be used by the <alias> element.
1343 .SH EXAMPLE CONFIGURATION FILE
1344 .SS System configuration file
1345 This is an example of a system-wide configuration file
1346 .sp
1347 .nf
1348 <?xml version="1.0"?>
1349 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
1350 <!-- /etc/fonts/fonts.conf file to configure system font access -->
1351 <fontconfig>
1352 <!--
1353 Find fonts in these directories
1354 -->
1355 <dir>/usr/X11R6/lib/X11/fonts/truetype</dir>
1356 <dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
1357
1358 <!--
1359 Accept deprecated 'mono' alias, replacing it with 'monospace'
1360 -->
1361 <match target="pattern">
1362 <test qual="any" name="family"><string>mono</string></test>
1363 <edit name="family" mode="assign"><string>monospace</string></edit>
1364 </match>
1365
1366 <!--
1367 Names not including any well known alias are given 'sans'
1368 -->
1369 <match target="pattern">
1370 <test qual="all" name="family" mode="not_eq">sans</test>
1371 <test qual="all" name="family" mode="not_eq">serif</test>
1372 <test qual="all" name="family" mode="not_eq">monospace</test>
1373 <edit name="family" mode="append_last"><string>sans</string></edit>
1374 </match>
1375
1376 <!--
1377 Load per-user customization file, but don't complain
1378 if it doesn't exist
1379 -->
1380 <include ignore_missing="yes">~/.fonts.conf</include>
1381
1382 <!--
1383 Alias well known font names to available TrueType fonts.
1384 These substitute TrueType faces for similar Type1
1385 faces to improve screen appearance.
1386 -->
1387 <alias>
1388 <family>Times</family>
1389 <prefer><family>Times New Roman</family></prefer>
1390 <default><family>serif</family></default>
1391 </alias>
1392 <alias>
1393 <family>Helvetica</family>
1394 <prefer><family>Verdana</family></prefer>
1395 <default><family>sans</family></default>
1396 </alias>
1397 <alias>
1398 <family>Courier</family>
1399 <prefer><family>Courier New</family></prefer>
1400 <default><family>monospace</family></default>
1401 </alias>
1402
1403 <!--
1404 Provide required aliases for standard names
1405 Do these after the users configuration file so that
1406 any aliases there are used preferentially
1407 -->
1408 <alias>
1409 <family>serif</family>
1410 <prefer><family>Times New Roman</family></prefer>
1411 </alias>
1412 <alias>
1413 <family>sans</family>
1414 <prefer><family>Verdana</family></prefer>
1415 </alias>
1416 <alias>
1417 <family>monospace</family>
1418 <prefer><family>Andale Mono</family></prefer>
1419 </alias>
1420 </fontconfig>
1421 .fi
1422 .SS User configuration file
1423 This is an example of a per-user configuration file that lives in
1424 ~/.fonts.conf
1425 .sp
1426 .nf
1427 <?xml version="1.0"?>
1428 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
1429 <!-- ~/.fonts.conf for per-user font configuration -->
1430 <fontconfig>
1431
1432 <!--
1433 Private font directory
1434 -->
1435 <dir>~/misc/fonts</dir>
1436
1437 <!--
1438 use rgb sub-pixel ordering to improve glyph appearance on
1439 LCD screens. Changes affecting rendering, but not matching
1440 should always use target="font".
1441 -->
1442 <match target="font">
1443 <edit name="rgba" mode="assign"><const>rgb</const></edit>
1444 </match>
1445 </fontconfig>
1446 .fi
1447 .SH FILES
1448 .B fonts.conf
1449 contains configuration information for the fontconfig library
1450 consisting of directories to look at for font information as well as
1451 instructions on editing program specified font patterns before attempting to
1452 match the available fonts. It is in xml format.
1453
1454 .B fonts.dtd
1455 is a DTD that describes the format of the configuration files.
1456
1457 .B ~/.fonts.conf
1458 is the conventional location for per-user font configuration, although the
1459 actual location is specified in the global fonts.conf file.
1460
1461 .B ~/.fonts.cache-*
1462 is the conventional repository of font information that isn't found in the
1463 per-directory caches. This file is automatically maintained by fontconfig.
1464
1465 .SH AUTHOR
1466 Keith Packard