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