]> git.wh0rd.org - fontconfig.git/blame - src/fcint.h
Automatically remove invalid cache files.
[fontconfig.git] / src / fcint.h
CommitLineData
24330d27 1/*
793e946c 2 * $RCSId: xc/lib/fontconfig/src/fcint.h,v 1.27 2002/08/31 22:17:32 keithp Exp $
24330d27 3 *
46b51147 4 * Copyright © 2000 Keith Packard
24330d27
KP
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
25#ifndef _FCINT_H_
26#define _FCINT_H_
27
91fe51b4
PL
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
24330d27
KP
32#include <stdlib.h>
33#include <stdio.h>
dc70c15a
PL
34#ifdef HAVE_INTTYPES_H
35#include <inttypes.h>
91fe51b4 36#elif defined(HAVE_STDINT_H)
7fd7221e 37#include <stdint.h>
91fe51b4
PL
38#else
39#error missing C99 integer data types
dc70c15a 40#endif
24330d27
KP
41#include <string.h>
42#include <ctype.h>
43#include <errno.h>
44#include <unistd.h>
45#include <sys/types.h>
46#include <sys/stat.h>
179c3995 47#include <time.h>
24330d27
KP
48#include <fontconfig/fontconfig.h>
49#include <fontconfig/fcprivate.h>
be094850 50#include <fontconfig/fcfreetype.h>
24330d27 51
24330d27
KP
52#ifndef FC_CONFIG_PATH
53#define FC_CONFIG_PATH "fonts.conf"
54#endif
55
179c3995
KP
56#define FC_FONT_FILE_INVALID ((FcChar8 *) ".")
57#define FC_FONT_FILE_DIR ((FcChar8 *) ".dir")
c60ec7cc 58#define FC_GLOBAL_MAGIC_COOKIE "GLOBAL"
179c3995 59
daeed6e0
TL
60#ifdef _WIN32
61#define FC_SEARCH_PATH_SEPARATOR ';'
62#else
63#define FC_SEARCH_PATH_SEPARATOR ':'
64#endif
65
24330d27
KP
66#define FC_DBG_MATCH 1
67#define FC_DBG_MATCHV 2
68#define FC_DBG_EDIT 4
69#define FC_DBG_FONTSET 8
70#define FC_DBG_CACHE 16
71#define FC_DBG_CACHEV 32
72#define FC_DBG_PARSE 64
73#define FC_DBG_SCAN 128
4c003605 74#define FC_DBG_SCANV 256
24330d27 75#define FC_DBG_MEMORY 512
2d9c79c0 76#define FC_DBG_CONFIG 1024
7ce19673 77#define FC_DBG_LANGSET 2048
24330d27
KP
78
79#define FC_MEM_CHARSET 0
d8d73958 80#define FC_MEM_CHARLEAF 1
24330d27
KP
81#define FC_MEM_FONTSET 2
82#define FC_MEM_FONTPTR 3
83#define FC_MEM_OBJECTSET 4
84#define FC_MEM_OBJECTPTR 5
85#define FC_MEM_MATRIX 6
86#define FC_MEM_PATTERN 7
87#define FC_MEM_PATELT 8
88#define FC_MEM_VALLIST 9
89#define FC_MEM_SUBSTATE 10
90#define FC_MEM_STRING 11
91#define FC_MEM_LISTBUCK 12
d8d73958
KP
92#define FC_MEM_STRSET 13
93#define FC_MEM_STRLIST 14
94#define FC_MEM_CONFIG 15
95#define FC_MEM_LANGSET 16
9dac3c59
KP
96#define FC_MEM_ATOMIC 17
97#define FC_MEM_BLANKS 18
98#define FC_MEM_CACHE 19
99#define FC_MEM_STRBUF 20
100#define FC_MEM_SUBST 21
101#define FC_MEM_OBJECTTYPE 22
102#define FC_MEM_CONSTANT 23
103#define FC_MEM_TEST 24
104#define FC_MEM_EXPR 25
105#define FC_MEM_VSTACK 26
106#define FC_MEM_ATTR 27
107#define FC_MEM_PSTACK 28
1c52c0f0 108#define FC_MEM_STATICSTR 29
d8d73958 109
1c52c0f0 110#define FC_MEM_NUM 30
24330d27 111
1c9fdcca
PL
112#define FC_BANK_DYNAMIC 0
113#define FC_BANK_FIRST 1
82f35f8b
PL
114#define FC_BANK_LANGS 0xfcfcfcfc
115
4c003605 116typedef enum _FcValueBinding {
dda7794f 117 FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
4c003605
KP
118} FcValueBinding;
119
7ce19673
KP
120/*
121 * Serialized data structures use only offsets instead of pointers
122 * A low bit of 1 indicates an offset.
123 */
124
125/* Is the provided pointer actually an offset? */
126#define FcIsEncodedOffset(p) ((((intptr_t) (p)) & 1) != 0)
cd2ec1a9 127
7ce19673
KP
128/* Encode offset in a pointer of type t */
129#define FcOffsetEncode(o,t) ((t *) ((o) | 1))
130
131/* Decode a pointer into an offset */
132#define FcOffsetDecode(p) (((intptr_t) (p)) & ~1)
133
134/* Compute pointer offset */
135#define FcPtrToOffset(b,p) ((intptr_t) (p) - (intptr_t) (b))
136
137/* Given base address, offset and type, return a pointer */
138#define FcOffsetToPtr(b,o,t) ((t *) ((intptr_t) (b) + (o)))
139
140/* Given base address, encoded offset and type, return a pointer */
141#define FcEncodedOffsetToPtr(b,p,t) FcOffsetToPtr(b,FcOffsetDecode(p),t)
cd2ec1a9 142
7ce19673
KP
143/* Given base address, pointer and type, return an encoded offset */
144#define FcPtrToEncodedOffset(b,p,t) FcOffsetEncode(FcPtrToOffset(b,p),t)
145
146/* Given a structure, offset member and type, return pointer */
147#define FcOffsetMember(s,m,t) FcOffsetToPtr(s,(s)->m,t)
148
149/* Given a structure, encoded offset member and type, return pointer to member */
150#define FcEncodedOffsetMember(s,m,t) FcOffsetToPtr(s,FcOffsetDecode((s)->m), t)
151
152/* Given a structure, member and type, convert the member to a pointer */
153#define FcPointerMember(s,m,t) (FcIsEncodedOffset((s)->m) ? \
154 FcEncodedOffsetMember (s,m,t) : \
155 (s)->m)
156
157/*
158 * Serialized values may hold strings, charsets and langsets as pointers,
159 * unfortunately FcValue is an exposed type so we can't just always use
160 * offsets
161 */
162#define FcValueString(v) FcPointerMember(v,u.s,FcChar8)
163#define FcValueCharSet(v) FcPointerMember(v,u.c,const FcCharSet)
164#define FcValueLangSet(v) FcPointerMember(v,u.l,const FcLangSet)
165
166typedef struct _FcValueList *FcValueListPtr;
167
168typedef struct _FcValueList {
169 struct _FcValueList *next;
170 FcValue value;
171 FcValueBinding binding;
24330d27
KP
172} FcValueList;
173
7ce19673
KP
174#define FcValueListNext(vl) FcPointerMember(vl,next,FcValueList)
175
176typedef int FcObject;
4262e0b3 177
7ce19673 178typedef struct _FcPatternElt *FcPatternEltPtr;
cd2ec1a9 179
7ce19673
KP
180/*
181 * Pattern elts are stuck in a structure connected to the pattern,
182 * so they get moved around when the pattern is resized. Hence, the
183 * values field must be a pointer/offset instead of just an offset
184 */
24330d27 185typedef struct _FcPatternElt {
7ce19673
KP
186 FcObject object;
187 FcValueList *values;
24330d27
KP
188} FcPatternElt;
189
7ce19673
KP
190#define FcPatternEltValues(pe) FcPointerMember(pe,values,FcValueList)
191
24330d27
KP
192struct _FcPattern {
193 int num;
194 int size;
7ce19673 195 intptr_t elts_offset;
e709ddfa 196 int ref;
24330d27
KP
197};
198
7ce19673
KP
199#define FcPatternElts(p) FcOffsetMember(p,elts_offset,FcPatternElt)
200
201#define FcFontSetFonts(fs) FcPointerMember(fs,fonts,FcPattern *)
c0288648 202
7ce19673 203#define FcFontSetFont(fs,i) (FcIsEncodedOffset((fs)->fonts) ? \
c0288648
KP
204 FcEncodedOffsetToPtr(FcFontSetFonts(fs), \
205 FcFontSetFonts(fs)[i], \
206 FcPattern) : \
207 fs->fonts[i])
7ce19673 208
24330d27
KP
209typedef enum _FcOp {
210 FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet,
211 FcOpNil,
212 FcOpField, FcOpConst,
213 FcOpAssign, FcOpAssignReplace,
214 FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
215 FcOpQuest,
74a623e0
KP
216 FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual,
217 FcOpContains, FcOpListing, FcOpNotContains,
24330d27
KP
218 FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
219 FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
3f7653c2
KP
220 FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
221 FcOpInvalid
24330d27
KP
222} FcOp;
223
224typedef struct _FcExpr {
225 FcOp op;
226 union {
227 int ival;
228 double dval;
ccb3e93b 229 FcChar8 *sval;
24330d27
KP
230 FcMatrix *mval;
231 FcBool bval;
232 FcCharSet *cval;
7ce19673 233 FcObject object;
ccb3e93b 234 FcChar8 *constant;
24330d27
KP
235 struct {
236 struct _FcExpr *left, *right;
237 } tree;
238 } u;
239} FcExpr;
240
241typedef enum _FcQual {
6f6563ed 242 FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
24330d27
KP
243} FcQual;
244
938bc633
KP
245#define FcMatchDefault ((FcMatchKind) -1)
246
24330d27
KP
247typedef struct _FcTest {
248 struct _FcTest *next;
938bc633 249 FcMatchKind kind;
24330d27 250 FcQual qual;
7ce19673 251 FcObject object;
24330d27
KP
252 FcOp op;
253 FcExpr *expr;
254} FcTest;
255
256typedef struct _FcEdit {
257 struct _FcEdit *next;
7ce19673 258 FcObject object;
24330d27
KP
259 FcOp op;
260 FcExpr *expr;
6fff2cda 261 FcValueBinding binding;
24330d27
KP
262} FcEdit;
263
264typedef struct _FcSubst {
265 struct _FcSubst *next;
266 FcTest *test;
267 FcEdit *edit;
268} FcSubst;
269
20ac65ab 270typedef struct _FcCharLeaf {
24330d27 271 FcChar32 map[256/32];
20ac65ab 272} FcCharLeaf;
24330d27 273
d8d73958 274#define FC_REF_CONSTANT -1
82f4243f 275
24330d27 276struct _FcCharSet {
24330d27 277 int ref; /* reference count */
20ac65ab 278 int num; /* size of leaves and numbers arrays */
7ce19673
KP
279 intptr_t leaves_offset;
280 intptr_t numbers_offset;
24330d27
KP
281};
282
7ce19673
KP
283#define FcCharSetLeaves(c) FcOffsetMember(c,leaves_offset,intptr_t)
284#define FcCharSetLeaf(c,i) (FcOffsetToPtr(FcCharSetLeaves(c), \
285 FcCharSetLeaves(c)[i], \
286 FcCharLeaf))
287#define FcCharSetNumbers(c) FcOffsetMember(c,numbers_offset,FcChar16)
288
179c3995
KP
289struct _FcStrSet {
290 int ref; /* reference count */
291 int num;
292 int size;
4262e0b3 293 FcChar8 **strs;
179c3995
KP
294};
295
296struct _FcStrList {
297 FcStrSet *set;
298 int n;
299};
300
c2e7c611 301typedef struct _FcStrBuf {
24330d27
KP
302 FcChar8 *buf;
303 FcBool allocated;
304 FcBool failed;
305 int len;
306 int size;
c2e7c611 307} FcStrBuf;
24330d27 308
212c9f43 309typedef struct _FcCache {
7ce19673 310 int magic; /* FC_CACHE_MAGIC */
c50ea916 311 intptr_t size; /* size of file */
7ce19673
KP
312 intptr_t dir; /* offset to dir name */
313 intptr_t dirs; /* offset to subdirs */
314 int dirs_count; /* number of subdir strings */
315 intptr_t set; /* offset to font set */
212c9f43
PL
316} FcCache;
317
7ce19673
KP
318#define FcCacheDir(c) FcOffsetMember(c,dir,FcChar8)
319#define FcCacheDirs(c) FcOffsetMember(c,dirs,intptr_t)
320#define FcCacheSet(c) FcOffsetMember(c,set,FcFontSet)
321
322/*
323 * Used while constructing a directory cache object
324 */
325
326#define FC_SERIALIZE_HASH_SIZE 8191
327
328typedef struct _FcSerializeBucket {
329 struct _FcSerializeBucket *next;
330 const void *object;
331 intptr_t offset;
332} FcSerializeBucket;
333
334typedef struct _FcSerialize {
335 intptr_t size;
336 void *linear;
337 FcSerializeBucket *buckets[FC_SERIALIZE_HASH_SIZE];
338} FcSerialize;
339
7769c321
KP
340/*
341 * To map adobe glyph names to unicode values, a precomputed hash
342 * table is used
343 */
344
345typedef struct _FcGlyphName {
346 FcChar32 ucs; /* unicode value */
347 FcChar8 name[1]; /* name extends beyond struct */
348} FcGlyphName;
349
192296d8
KP
350/*
351 * To perform case-insensitive string comparisons, a table
352 * is used which holds three different kinds of folding data.
353 *
354 * The first is a range of upper case values mapping to a range
355 * of their lower case equivalents. Within each range, the offset
356 * between upper and lower case is constant.
357 *
358 * The second is a range of upper case values which are interleaved
359 * with their lower case equivalents.
360 *
361 * The third is a set of raw unicode values mapping to a list
362 * of unicode values for comparison purposes. This allows conversion
363 * of ß to "ss" so that SS, ss and ß all match. A separate array
364 * holds the list of unicode values for each entry.
365 *
366 * These are packed into a single table. Using a binary search,
367 * the appropriate entry can be located.
368 */
369
370#define FC_CASE_FOLD_RANGE 0
371#define FC_CASE_FOLD_EVEN_ODD 1
372#define FC_CASE_FOLD_FULL 2
373
374typedef struct _FcCaseFold {
375 FcChar32 upper;
376 FcChar16 method : 2;
377 FcChar16 count : 14;
378 short offset; /* lower - upper for RANGE, table id for FULL */
379} FcCaseFold;
380
2d9c79c0
KP
381#define FC_MAX_FILE_LEN 4096
382
7ce19673
KP
383/* XXX remove these when we're ready */
384
385#define fc_value_string(v) FcValueString(v)
386#define fc_value_charset(v) FcValueCharSet(v)
387#define fc_value_langset(v) FcValueLangSet(v)
388#define fc_storage_type(v) ((v)->type)
4262e0b3 389
44415a07
PL
390#define fc_alignof(type) offsetof (struct { char c; type member; }, member)
391
7ce19673
KP
392#define FC_CACHE_MAGIC 0xFC02FC04
393#define FC_CACHE_MAGIC_COPY 0xFC02FC05
327a7fd4 394
134f6011
KP
395struct _FcAtomic {
396 FcChar8 *file; /* original file name */
397 FcChar8 *new; /* temp file name -- write data here */
398 FcChar8 *lck; /* lockfile name (used for locking) */
399 FcChar8 *tmp; /* tmpfile name (used for locking) */
400};
401
24330d27
KP
402struct _FcBlanks {
403 int nblank;
404 int sblank;
405 FcChar32 *blanks;
406};
407
2d3387fd
KP
408typedef struct _FcCacheList {
409 struct _FcCacheList *next;
410 FcCache *cache;
411} FcCacheList;
412
24330d27
KP
413struct _FcConfig {
414 /*
415 * File names loaded from the configuration -- saved here as the
416 * cache file must be consulted before the directories are scanned,
417 * and those directives may occur in any order
418 */
179c3995 419 FcStrSet *configDirs; /* directories to scan for fonts */
24330d27
KP
420 /*
421 * Set of allowed blank chars -- used to
422 * trim fonts of bogus glyphs
423 */
424 FcBlanks *blanks;
179c3995
KP
425 /*
426 * List of directories containing fonts,
427 * built by recursively scanning the set
428 * of configured directories
429 */
430 FcStrSet *fontDirs;
7410e40b
PL
431 /*
432 * List of directories containing cache files.
433 */
434 FcStrSet *cacheDirs;
24330d27
KP
435 /*
436 * Names of all of the configuration files used
437 * to create this configuration
438 */
179c3995 439 FcStrSet *configFiles; /* config files loaded */
24330d27
KP
440 /*
441 * Substitution instructions for patterns and fonts;
442 * maxObjects is used to allocate appropriate intermediate storage
443 * while performing a whole set of substitutions
444 */
445 FcSubst *substPattern; /* substitutions for patterns */
446 FcSubst *substFont; /* substitutions for fonts */
447 int maxObjects; /* maximum number of tests in all substs */
d47c9d6e
KP
448 /*
449 * List of patterns used to control font file selection
450 */
451 FcStrSet *acceptGlobs;
452 FcStrSet *rejectGlobs;
4f27c1c0
KP
453 FcFontSet *acceptPatterns;
454 FcFontSet *rejectPatterns;
24330d27
KP
455 /*
456 * The set of fonts loaded from the listed directories; the
457 * order within the set does not determine the font selection,
458 * except in the case of identical matches in which case earlier fonts
459 * match preferrentially
460 */
461 FcFontSet *fonts[FcSetApplication + 1];
2d3387fd
KP
462 /*
463 * Font cache information is mapped from cache files
464 * the configuration is destroyed, the files need to be unmapped
465 */
466 FcCacheList *caches;
179c3995
KP
467 /*
468 * Fontconfig can periodically rescan the system configuration
469 * and font directories. This rescanning occurs when font
470 * listing requests are made, but no more often than rescanInterval
471 * seconds apart.
472 */
473 time_t rescanTime; /* last time information was scanned */
474 int rescanInterval; /* interval between scans */
24330d27
KP
475};
476
6e9fc5de
KP
477extern FcConfig *_fcConfig;
478
2b25f00c
PL
479typedef struct _FcFileTime {
480 time_t time;
481 FcBool set;
482} FcFileTime;
483
69937bd9
KP
484typedef struct _FcCharMap FcCharMap;
485
44415a07
PL
486/* watch out; assumes that v is void * -PL */
487#define ALIGN(v,type) ((void *)(((uintptr_t)(v) + fc_alignof(type) - 1) & ~(fc_alignof(type) - 1)))
7fd7221e 488
24330d27
KP
489/* fcblanks.c */
490
491/* fccache.c */
492
4262e0b3 493FcFontSet *
00f059e9 494FcCacheRead (FcConfig *config);
24330d27
KP
495
496FcBool
7410e40b 497FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
4262e0b3 498
af180c40
KP
499FcBool
500FcDirCacheConsume (FILE *file, FcFontSet *set, FcStrSet *dirs,
501 const FcChar8 *dir, char *dirname);
502
c0288648
KP
503void
504FcDirCacheUnmap (FcCache *cache);
505
2eb84374 506FcBool
cd9bca69 507FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
212c9f43 508
76abb77f
KP
509FcCache *
510FcDirCacheMap (const FcChar8 *dir, FcConfig *config);
511
512FcBool
513FcDirCacheLoad (int fd, off_t size, void *closure);
d8ab9e6c 514
24330d27
KP
515/* fccfg.c */
516
179c3995
KP
517FcBool
518FcConfigAddConfigDir (FcConfig *config,
519 const FcChar8 *d);
520
521FcBool
522FcConfigAddFontDir (FcConfig *config,
523 const FcChar8 *d);
524
24330d27 525FcBool
ccb3e93b
KP
526FcConfigAddDir (FcConfig *config,
527 const FcChar8 *d);
24330d27 528
7410e40b
PL
529FcBool
530FcConfigAddCacheDir (FcConfig *config,
531 const FcChar8 *d);
532
533FcStrList *
534FcConfigGetCacheDirs (FcConfig *config);
535
24330d27 536FcBool
ccb3e93b
KP
537FcConfigAddConfigFile (FcConfig *config,
538 const FcChar8 *f);
24330d27 539
24330d27
KP
540FcBool
541FcConfigAddBlank (FcConfig *config,
542 FcChar32 blank);
543
544FcBool
545FcConfigAddEdit (FcConfig *config,
546 FcTest *test,
547 FcEdit *edit,
548 FcMatchKind kind);
549
550void
551FcConfigSetFonts (FcConfig *config,
552 FcFontSet *fonts,
553 FcSetName set);
554
555FcBool
4262e0b3 556FcConfigCompareValue (const FcValue *m,
24330d27 557 FcOp op,
4262e0b3 558 const FcValue *v);
24330d27 559
d47c9d6e
KP
560FcBool
561FcConfigGlobAdd (FcConfig *config,
562 const FcChar8 *glob,
563 FcBool accept);
564
565FcBool
566FcConfigAcceptFilename (FcConfig *config,
567 const FcChar8 *filename);
568
4f27c1c0
KP
569FcBool
570FcConfigPatternsAdd (FcConfig *config,
571 FcPattern *pattern,
572 FcBool accept);
573
574FcBool
575FcConfigAcceptFont (FcConfig *config,
576 const FcPattern *font);
577
2b25f00c
PL
578FcFileTime
579FcConfigModifiedTime (FcConfig *config);
580
2d3387fd
KP
581FcBool
582FcConfigAddCache (FcConfig *config, FcCache *cache);
583
584/* fcserialize.c */
7ce19673
KP
585intptr_t
586FcAlignSize (intptr_t size);
587
588FcSerialize *
589FcSerializeCreate (void);
590
591void
592FcSerializeDestroy (FcSerialize *serialize);
593
594FcBool
595FcSerializeAlloc (FcSerialize *serialize, const void *object, int size);
596
597intptr_t
598FcSerializeReserve (FcSerialize *serialize, int size);
599
600intptr_t
601FcSerializeOffset (FcSerialize *serialize, const void *object);
602
603void *
604FcSerializePtr (FcSerialize *serialize, const void *object);
605
606FcBool
607FcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l);
608
609FcLangSet *
610FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l);
611
24330d27 612/* fccharset.c */
82f35f8b
PL
613void
614FcLangCharSetPopulate (void);
615
4c003605
KP
616FcCharSet *
617FcCharSetFreeze (FcCharSet *cs);
618
34cd0514
CW
619void
620FcCharSetThawAll (void);
621
24330d27 622FcBool
c2e7c611 623FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
24330d27
KP
624
625FcCharSet *
626FcNameParseCharSet (FcChar8 *string);
627
c647f6f1
KP
628FcCharLeaf *
629FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
69937bd9 630
7ce19673
KP
631FcBool
632FcCharSetSerializeAlloc(FcSerialize *serialize, const FcCharSet *cs);
cd2ec1a9 633
4262e0b3 634FcCharSet *
7ce19673 635FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs);
cd2ec1a9
PL
636
637FcChar16 *
638FcCharSetGetNumbers(const FcCharSet *c);
639
24330d27 640/* fcdbg.c */
24330d27 641void
cd2ec1a9 642FcValueListPrint (const FcValueListPtr l);
24330d27 643
793e946c
KP
644void
645FcLangSetPrint (const FcLangSet *ls);
646
24330d27
KP
647void
648FcOpPrint (FcOp op);
649
650void
938bc633 651FcTestPrint (const FcTest *test);
24330d27
KP
652
653void
938bc633 654FcExprPrint (const FcExpr *expr);
24330d27
KP
655
656void
938bc633 657FcEditPrint (const FcEdit *edit);
24330d27
KP
658
659void
938bc633 660FcSubstPrint (const FcSubst *subst);
24330d27 661
7ce19673
KP
662void
663FcCharSetPrint (const FcCharSet *c);
664
b97a34b5
PL
665extern int FcDebugVal;
666
44415a07 667static inline int
b97a34b5
PL
668FcDebug (void) { return FcDebugVal; }
669
670void
671FcInitDebug (void);
24330d27 672
90442681
PL
673/* fcdefault.c */
674FcChar8 *
675FcGetDefaultLang (void);
676
24330d27 677/* fcdir.c */
24330d27 678
2d9c79c0
KP
679FcBool
680FcFileIsDir (const FcChar8 *file);
681
d47c9d6e
KP
682FcBool
683FcFileScanConfig (FcFontSet *set,
684 FcStrSet *dirs,
d47c9d6e
KP
685 FcBlanks *blanks,
686 const FcChar8 *file,
687 FcBool force,
688 FcConfig *config);
689
690FcBool
691FcDirScanConfig (FcFontSet *set,
692 FcStrSet *dirs,
d47c9d6e
KP
693 FcBlanks *blanks,
694 const FcChar8 *dir,
695 FcBool force,
696 FcConfig *config);
697
24330d27
KP
698/* fcfont.c */
699int
700FcFontDebug (void);
701
82f4243f 702/* fcfreetype.c */
e50b9ae7
KP
703FcBool
704FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
705
82f4243f
KP
706FcBool
707FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
708
c647f6f1
KP
709FcChar32
710FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
711
712FcChar32
713FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
714
715const FcCharMap *
716FcFreeTypeGetPrivateMap (FT_Encoding encoding);
717
24330d27 718/* fcfs.c */
cd2ec1a9 719
212c9f43 720FcBool
7ce19673 721FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s);
212c9f43 722
7ce19673
KP
723FcFontSet *
724FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
725
24330d27
KP
726/* fcgram.y */
727int
728FcConfigparse (void);
729
730int
731FcConfigwrap (void);
732
733void
734FcConfigerror (char *fmt, ...);
735
736char *
737FcConfigSaveField (const char *field);
738
24330d27
KP
739void
740FcTestDestroy (FcTest *test);
741
742FcExpr *
743FcExprCreateInteger (int i);
744
745FcExpr *
746FcExprCreateDouble (double d);
747
748FcExpr *
ccb3e93b 749FcExprCreateString (const FcChar8 *s);
24330d27
KP
750
751FcExpr *
752FcExprCreateMatrix (const FcMatrix *m);
753
754FcExpr *
755FcExprCreateBool (FcBool b);
756
757FcExpr *
758FcExprCreateNil (void);
759
760FcExpr *
761FcExprCreateField (const char *field);
762
763FcExpr *
ccb3e93b 764FcExprCreateConst (const FcChar8 *constant);
24330d27
KP
765
766FcExpr *
767FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
768
769void
770FcExprDestroy (FcExpr *e);
771
24330d27
KP
772void
773FcEditDestroy (FcEdit *e);
774
775/* fcinit.c */
776
777void
778FcMemReport (void);
779
780void
781FcMemAlloc (int kind, int size);
782
783void
784FcMemFree (int kind, int size);
785
82f4243f 786/* fclang.c */
d8d73958
KP
787FcLangSet *
788FcFreeTypeLangSet (const FcCharSet *charset,
e50b9ae7 789 const FcChar8 *exclusiveLang);
82f4243f
KP
790
791FcLangResult
792FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
793
794const FcCharSet *
795FcCharSetForLang (const FcChar8 *lang);
796
d8d73958
KP
797FcLangSet *
798FcLangSetPromote (const FcChar8 *lang);
799
800FcLangSet *
801FcNameParseLangSet (const FcChar8 *string);
802
803FcBool
804FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
805
24330d27
KP
806/* fclist.c */
807
4f27c1c0
KP
808FcBool
809FcListPatternMatchAny (const FcPattern *p,
810 const FcPattern *font);
811
24330d27
KP
812/* fcmatch.c */
813
814/* fcname.c */
24330d27 815
7ce19673
KP
816/*
817 * NOTE -- this ordering is part of the cache file format.
818 * It must also match the ordering in fcname.c
819 */
4262e0b3 820
7ce19673
KP
821#define FC_FAMILY_OBJECT 1
822#define FC_FAMILYLANG_OBJECT 2
823#define FC_STYLE_OBJECT 3
824#define FC_STYLELANG_OBJECT 4
825#define FC_FULLNAME_OBJECT 5
826#define FC_FULLNAMELANG_OBJECT 6
827#define FC_SLANT_OBJECT 7
828#define FC_WEIGHT_OBJECT 8
829#define FC_WIDTH_OBJECT 9
830#define FC_SIZE_OBJECT 10
831#define FC_ASPECT_OBJECT 11
832#define FC_PIXEL_SIZE_OBJECT 12
833#define FC_SPACING_OBJECT 13
834#define FC_FOUNDRY_OBJECT 14
835#define FC_ANTIALIAS_OBJECT 15
836#define FC_HINT_STYLE_OBJECT 16
837#define FC_HINTING_OBJECT 17
838#define FC_VERTICAL_LAYOUT_OBJECT 18
839#define FC_AUTOHINT_OBJECT 19
840#define FC_GLOBAL_ADVANCE_OBJECT 20
841#define FC_FILE_OBJECT 21
842#define FC_INDEX_OBJECT 22
843#define FC_RASTERIZER_OBJECT 23
844#define FC_OUTLINE_OBJECT 24
845#define FC_SCALABLE_OBJECT 25
846#define FC_DPI_OBJECT 26
847#define FC_RGBA_OBJECT 27
848#define FC_SCALE_OBJECT 28
849#define FC_MINSPACE_OBJECT 29
850#define FC_CHAR_WIDTH_OBJECT 30
851#define FC_CHAR_HEIGHT_OBJECT 31
852#define FC_MATRIX_OBJECT 32
853#define FC_CHARSET_OBJECT 33
854#define FC_LANG_OBJECT 34
855#define FC_FONTVERSION_OBJECT 35
856#define FC_CAPABILITY_OBJECT 36
857#define FC_FONTFORMAT_OBJECT 37
858#define FC_EMBOLDEN_OBJECT 38
859#define FC_EMBEDDED_BITMAP_OBJECT 39
7f37423d 860
7ce19673
KP
861FcBool
862FcNameBool (const FcChar8 *v, FcBool *result);
7fd7221e 863
7ce19673
KP
864FcBool
865FcObjectValidType (FcObject object, FcType type);
4262e0b3 866
7ce19673
KP
867FcObject
868FcObjectFromName (const char * name);
4262e0b3 869
7f37423d 870const char *
7ce19673 871FcObjectName (FcObject object);
7f37423d 872
09f9f6f6
KP
873FcBool
874FcObjectInit (void);
7f37423d
PL
875
876void
09f9f6f6
KP
877FcObjectFini (void);
878
879#define FcObjectCompare(a, b) ((int) a - (int) b)
4262e0b3 880
24330d27 881/* fcpat.c */
4262e0b3
PL
882
883FcValue
884FcValueCanonicalize (const FcValue *v);
885
24330d27 886void
cd2ec1a9
PL
887FcValueListDestroy (FcValueListPtr l);
888
24330d27 889FcPatternElt *
7ce19673 890FcPatternObjectFindElt (const FcPattern *p, FcObject object);
e9be9cd1
KP
891
892FcPatternElt *
7ce19673 893FcPatternObjectInsertElt (FcPattern *p, FcObject object);
24330d27 894
82f4243f 895FcBool
7ce19673
KP
896FcPatternObjectAddWithBinding (FcPattern *p,
897 FcObject object,
898 FcValue value,
899 FcValueBinding binding,
900 FcBool append);
82f4243f 901
7ce19673
KP
902FcBool
903FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append);
904
905FcBool
906FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
907
908FcResult
909FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
910
911FcBool
912FcPatternObjectDel (FcPattern *p, FcObject object);
34cd0514 913
4f27c1c0 914FcBool
7ce19673 915FcPatternObjectRemove (FcPattern *p, FcObject object, int id);
4f27c1c0 916
7ce19673
KP
917FcBool
918FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i);
cd2ec1a9 919
7ce19673
KP
920FcBool
921FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d);
cd2ec1a9 922
7ce19673
KP
923FcBool
924FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s);
cd2ec1a9 925
7ce19673
KP
926FcBool
927FcPatternObjectAddMatrix (FcPattern *p, FcObject object, const FcMatrix *s);
cd2ec1a9 928
7ce19673
KP
929FcBool
930FcPatternObjectAddCharSet (FcPattern *p, FcObject object, const FcCharSet *c);
7fd7221e 931
7ce19673
KP
932FcBool
933FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b);
cd2ec1a9 934
7ce19673
KP
935FcBool
936FcPatternObjectAddLangSet (FcPattern *p, FcObject object, const FcLangSet *ls);
937
938FcResult
939FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int n, int *i);
940
941FcResult
942FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int n, double *d);
9ab79bdf 943
7ce19673
KP
944FcResult
945FcPatternObjectGetString (const FcPattern *p, FcObject object, int n, FcChar8 ** s);
9ab79bdf 946
7ce19673
KP
947FcResult
948FcPatternObjectGetMatrix (const FcPattern *p, FcObject object, int n, FcMatrix **s);
9ab79bdf 949
7ce19673
KP
950FcResult
951FcPatternObjectGetCharSet (const FcPattern *p, FcObject object, int n, FcCharSet **c);
9ab79bdf 952
7ce19673
KP
953FcResult
954FcPatternObjectGetBool (const FcPattern *p, FcObject object, int n, FcBool *b);
cd2ec1a9 955
7ce19673
KP
956FcResult
957FcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet **ls);
958
959void
960FcPatternFini (void);
961
962FcBool
963FcPatternAppend (FcPattern *p, FcPattern *s);
964
965const FcChar8 *
966FcStrStaticName (const FcChar8 *name);
967
968FcChar32
969FcStringHash (const FcChar8 *s);
970
971FcBool
972FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat);
cd2ec1a9 973
cd2ec1a9 974FcPattern *
7ce19673 975FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat);
212c9f43 976
7ce19673
KP
977FcBool
978FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *pat);
979
980FcValueList *
981FcValueListSerialize (FcSerialize *serialize, const FcValueList *pat);
212c9f43 982
24330d27
KP
983/* fcrender.c */
984
985/* fcmatrix.c */
327a7fd4 986
4262e0b3 987extern const FcMatrix FcIdentityMatrix;
327a7fd4 988
24330d27
KP
989void
990FcMatrixFree (FcMatrix *mat);
991
992/* fcstr.c */
cd2ec1a9
PL
993void
994FcStrSetSort (FcStrSet * set);
995
ccb3e93b
KP
996FcChar8 *
997FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
24330d27
KP
998
999void
ccb3e93b 1000FcStrFree (FcChar8 *s);
24330d27 1001
c2e7c611
KP
1002void
1003FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
1004
1005void
1006FcStrBufDestroy (FcStrBuf *buf);
1007
1008FcChar8 *
1009FcStrBufDone (FcStrBuf *buf);
1010
1011FcBool
1012FcStrBufChar (FcStrBuf *buf, FcChar8 c);
1013
1014FcBool
1015FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
1016
1017FcBool
1018FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
1019
82f4243f
KP
1020int
1021FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
1022
11fec41c
KP
1023const FcChar8 *
1024FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
1025
1026const FcChar8 *
1027FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
1028
ff3f1f98
KP
1029FcBool
1030FcStrUsesHome (const FcChar8 *s);
1031
daeed6e0
TL
1032FcChar8 *
1033FcStrLastSlash (const FcChar8 *path);
1034
192296d8
KP
1035FcChar32
1036FcStrHashIgnoreCase (const FcChar8 *s);
1037
0d9e31c8
KP
1038FcChar8 *
1039FcStrCanonFilename (const FcChar8 *s);
1040
7ce19673
KP
1041FcBool
1042FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str);
1043
1044FcChar8 *
1045FcStrSerialize (FcSerialize *serialize, const FcChar8 *str);
1046
24330d27 1047#endif /* _FC_INT_H_ */