Automatically remove invalid cache files.
[platform/upstream/fontconfig.git] / src / fcint.h
1 /*
2  * $RCSId: xc/lib/fontconfig/src/fcint.h,v 1.27 2002/08/31 22:17:32 keithp Exp $
3  *
4  * Copyright © 2000 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
25 #ifndef _FCINT_H_
26 #define _FCINT_H_
27
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31
32 #include <stdlib.h>
33 #include <stdio.h>
34 #ifdef HAVE_INTTYPES_H
35 #include <inttypes.h>
36 #elif defined(HAVE_STDINT_H)
37 #include <stdint.h>
38 #else
39 #error missing C99 integer data types
40 #endif
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>
47 #include <time.h>
48 #include <fontconfig/fontconfig.h>
49 #include <fontconfig/fcprivate.h>
50 #include <fontconfig/fcfreetype.h>
51
52 #ifndef FC_CONFIG_PATH
53 #define FC_CONFIG_PATH "fonts.conf"
54 #endif
55
56 #define FC_FONT_FILE_INVALID    ((FcChar8 *) ".")
57 #define FC_FONT_FILE_DIR        ((FcChar8 *) ".dir")
58 #define FC_GLOBAL_MAGIC_COOKIE  "GLOBAL"
59
60 #ifdef _WIN32
61 #define FC_SEARCH_PATH_SEPARATOR ';'
62 #else
63 #define FC_SEARCH_PATH_SEPARATOR ':'
64 #endif
65
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
74 #define FC_DBG_SCANV    256
75 #define FC_DBG_MEMORY   512
76 #define FC_DBG_CONFIG   1024
77 #define FC_DBG_LANGSET  2048
78
79 #define FC_MEM_CHARSET      0
80 #define FC_MEM_CHARLEAF     1
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
92 #define FC_MEM_STRSET       13
93 #define FC_MEM_STRLIST      14
94 #define FC_MEM_CONFIG       15
95 #define FC_MEM_LANGSET      16
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
108 #define FC_MEM_STATICSTR    29
109
110 #define FC_MEM_NUM          30
111
112 #define FC_BANK_DYNAMIC 0
113 #define FC_BANK_FIRST 1
114 #define FC_BANK_LANGS       0xfcfcfcfc
115
116 typedef enum _FcValueBinding {
117     FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
118 } FcValueBinding;
119
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)
127
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)
142
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
166 typedef struct _FcValueList *FcValueListPtr;
167
168 typedef struct _FcValueList {
169     struct _FcValueList *next;
170     FcValue             value;
171     FcValueBinding      binding;
172 } FcValueList;
173
174 #define FcValueListNext(vl)     FcPointerMember(vl,next,FcValueList)
175                              
176 typedef int FcObject;
177
178 typedef struct _FcPatternElt *FcPatternEltPtr;
179
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  */
185 typedef struct _FcPatternElt {
186     FcObject            object;
187     FcValueList         *values;
188 } FcPatternElt;
189
190 #define FcPatternEltValues(pe)  FcPointerMember(pe,values,FcValueList)
191
192 struct _FcPattern {
193     int             num;
194     int             size;
195     intptr_t        elts_offset;
196     int             ref;
197 };
198
199 #define FcPatternElts(p)        FcOffsetMember(p,elts_offset,FcPatternElt)
200
201 #define FcFontSetFonts(fs)      FcPointerMember(fs,fonts,FcPattern *)
202
203 #define FcFontSetFont(fs,i)     (FcIsEncodedOffset((fs)->fonts) ? \
204                                  FcEncodedOffsetToPtr(FcFontSetFonts(fs), \
205                                                       FcFontSetFonts(fs)[i], \
206                                                       FcPattern) : \
207                                  fs->fonts[i])
208                                                 
209 typedef enum _FcOp {
210     FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet, 
211     FcOpNil,
212     FcOpField, FcOpConst,
213     FcOpAssign, FcOpAssignReplace, 
214     FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
215     FcOpQuest,
216     FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual, 
217     FcOpContains, FcOpListing, FcOpNotContains,
218     FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
219     FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
220     FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
221     FcOpInvalid
222 } FcOp;
223
224 typedef struct _FcExpr {
225     FcOp   op;
226     union {
227         int         ival;
228         double      dval;
229         FcChar8     *sval;
230         FcMatrix    *mval;
231         FcBool      bval;
232         FcCharSet   *cval;
233         FcObject    object;
234         FcChar8     *constant;
235         struct {
236             struct _FcExpr *left, *right;
237         } tree;
238     } u;
239 } FcExpr;
240
241 typedef enum _FcQual {
242     FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
243 } FcQual;
244
245 #define FcMatchDefault  ((FcMatchKind) -1)
246
247 typedef struct _FcTest {
248     struct _FcTest      *next;
249     FcMatchKind         kind;
250     FcQual              qual;
251     FcObject            object;
252     FcOp                op;
253     FcExpr              *expr;
254 } FcTest;
255
256 typedef struct _FcEdit {
257     struct _FcEdit *next;
258     FcObject        object;
259     FcOp            op;
260     FcExpr          *expr;
261     FcValueBinding  binding;
262 } FcEdit;
263
264 typedef struct _FcSubst {
265     struct _FcSubst     *next;
266     FcTest              *test;
267     FcEdit              *edit;
268 } FcSubst;
269
270 typedef struct _FcCharLeaf {
271     FcChar32    map[256/32];
272 } FcCharLeaf;
273
274 #define FC_REF_CONSTANT     -1
275
276 struct _FcCharSet {
277     int             ref;        /* reference count */
278     int             num;        /* size of leaves and numbers arrays */
279     intptr_t        leaves_offset;
280     intptr_t        numbers_offset;
281 };
282
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
289 struct _FcStrSet {
290     int             ref;        /* reference count */
291     int             num;
292     int             size;
293     FcChar8         **strs;
294 };
295
296 struct _FcStrList {
297     FcStrSet        *set;
298     int             n;
299 };
300
301 typedef struct _FcStrBuf {
302     FcChar8 *buf;
303     FcBool  allocated;
304     FcBool  failed;
305     int     len;
306     int     size;
307 } FcStrBuf;
308
309 typedef struct _FcCache {
310     int         magic;              /* FC_CACHE_MAGIC */
311     intptr_t    size;               /* size of file */
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 */
316 } FcCache;
317
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
328 typedef struct _FcSerializeBucket {
329     struct _FcSerializeBucket *next;
330     const void  *object;
331     intptr_t    offset;
332 } FcSerializeBucket;
333
334 typedef struct _FcSerialize {
335     intptr_t            size;
336     void                *linear;
337     FcSerializeBucket   *buckets[FC_SERIALIZE_HASH_SIZE];
338 } FcSerialize;
339     
340 /*
341  * To map adobe glyph names to unicode values, a precomputed hash
342  * table is used
343  */
344
345 typedef struct _FcGlyphName {
346     FcChar32    ucs;            /* unicode value */
347     FcChar8     name[1];        /* name extends beyond struct */
348 } FcGlyphName;
349
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
374 typedef 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
381 #define FC_MAX_FILE_LEN     4096
382
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)
389
390 #define fc_alignof(type) offsetof (struct { char c; type member; }, member)
391
392 #define FC_CACHE_MAGIC      0xFC02FC04
393 #define FC_CACHE_MAGIC_COPY 0xFC02FC05
394
395 struct _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
402 struct _FcBlanks {
403     int         nblank;
404     int         sblank;
405     FcChar32    *blanks;
406 };
407
408 typedef struct _FcCacheList {
409     struct _FcCacheList *next;
410     FcCache             *cache;
411 } FcCacheList;
412
413 struct _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      */
419     FcStrSet    *configDirs;        /* directories to scan for fonts */
420     /*
421      * Set of allowed blank chars -- used to
422      * trim fonts of bogus glyphs
423      */
424     FcBlanks    *blanks;
425     /*
426      * List of directories containing fonts,
427      * built by recursively scanning the set 
428      * of configured directories
429      */
430     FcStrSet    *fontDirs;
431     /*
432      * List of directories containing cache files.
433      */
434     FcStrSet    *cacheDirs;
435     /*
436      * Names of all of the configuration files used
437      * to create this configuration
438      */
439     FcStrSet    *configFiles;       /* config files loaded */
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 */
448     /*
449      * List of patterns used to control font file selection
450      */
451     FcStrSet    *acceptGlobs;
452     FcStrSet    *rejectGlobs;
453     FcFontSet   *acceptPatterns;
454     FcFontSet   *rejectPatterns;
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];
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;
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 */
475 };
476  
477 extern FcConfig *_fcConfig;
478
479 typedef struct _FcFileTime {
480     time_t  time;
481     FcBool  set;
482 } FcFileTime;
483
484 typedef struct _FcCharMap FcCharMap;
485
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)))
488
489 /* fcblanks.c */
490
491 /* fccache.c */
492
493 FcFontSet *
494 FcCacheRead (FcConfig *config);
495
496 FcBool
497 FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
498
499 FcBool
500 FcDirCacheConsume (FILE *file, FcFontSet *set, FcStrSet *dirs,
501                    const FcChar8 *dir, char *dirname);
502     
503 void
504 FcDirCacheUnmap (FcCache *cache);
505
506 FcBool
507 FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
508  
509 FcCache *
510 FcDirCacheMap (const FcChar8 *dir, FcConfig *config);
511     
512 FcBool
513 FcDirCacheLoad (int fd, off_t size, void *closure);
514     
515 /* fccfg.c */
516
517 FcBool
518 FcConfigAddConfigDir (FcConfig      *config,
519                       const FcChar8 *d);
520
521 FcBool
522 FcConfigAddFontDir (FcConfig        *config,
523                     const FcChar8   *d);
524
525 FcBool
526 FcConfigAddDir (FcConfig        *config,
527                 const FcChar8   *d);
528
529 FcBool
530 FcConfigAddCacheDir (FcConfig       *config,
531                      const FcChar8  *d);
532
533 FcStrList *
534 FcConfigGetCacheDirs (FcConfig  *config);
535
536 FcBool
537 FcConfigAddConfigFile (FcConfig         *config,
538                        const FcChar8    *f);
539
540 FcBool
541 FcConfigAddBlank (FcConfig      *config,
542                   FcChar32      blank);
543
544 FcBool
545 FcConfigAddEdit (FcConfig       *config,
546                  FcTest         *test,
547                  FcEdit         *edit,
548                  FcMatchKind    kind);
549
550 void
551 FcConfigSetFonts (FcConfig      *config,
552                   FcFontSet     *fonts,
553                   FcSetName     set);
554
555 FcBool
556 FcConfigCompareValue (const FcValue *m,
557                       FcOp          op,
558                       const FcValue *v);
559
560 FcBool
561 FcConfigGlobAdd (FcConfig       *config,
562                  const FcChar8  *glob,
563                  FcBool         accept);
564
565 FcBool
566 FcConfigAcceptFilename (FcConfig        *config,
567                         const FcChar8   *filename);
568
569 FcBool
570 FcConfigPatternsAdd (FcConfig   *config,
571                      FcPattern  *pattern,
572                      FcBool     accept);
573
574 FcBool
575 FcConfigAcceptFont (FcConfig        *config,
576                     const FcPattern *font);
577
578 FcFileTime
579 FcConfigModifiedTime (FcConfig *config);
580
581 FcBool
582 FcConfigAddCache (FcConfig *config, FcCache *cache);
583
584 /* fcserialize.c */
585 intptr_t
586 FcAlignSize (intptr_t size);
587     
588 FcSerialize *
589 FcSerializeCreate (void);
590
591 void
592 FcSerializeDestroy (FcSerialize *serialize);
593
594 FcBool
595 FcSerializeAlloc (FcSerialize *serialize, const void *object, int size);
596
597 intptr_t
598 FcSerializeReserve (FcSerialize *serialize, int size);
599
600 intptr_t
601 FcSerializeOffset (FcSerialize *serialize, const void *object);
602
603 void *
604 FcSerializePtr (FcSerialize *serialize, const void *object);
605
606 FcBool
607 FcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l);
608
609 FcLangSet *
610 FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l);
611
612 /* fccharset.c */
613 void
614 FcLangCharSetPopulate (void);
615
616 FcCharSet *
617 FcCharSetFreeze (FcCharSet *cs);
618
619 void
620 FcCharSetThawAll (void);
621
622 FcBool
623 FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
624
625 FcCharSet *
626 FcNameParseCharSet (FcChar8 *string);
627
628 FcCharLeaf *
629 FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
630
631 FcBool
632 FcCharSetSerializeAlloc(FcSerialize *serialize, const FcCharSet *cs);
633
634 FcCharSet *
635 FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs);
636
637 FcChar16 *
638 FcCharSetGetNumbers(const FcCharSet *c);
639
640 /* fcdbg.c */
641 void
642 FcValueListPrint (const FcValueListPtr l);
643
644 void
645 FcLangSetPrint (const FcLangSet *ls);
646
647 void
648 FcOpPrint (FcOp op);
649
650 void
651 FcTestPrint (const FcTest *test);
652
653 void
654 FcExprPrint (const FcExpr *expr);
655
656 void
657 FcEditPrint (const FcEdit *edit);
658
659 void
660 FcSubstPrint (const FcSubst *subst);
661
662 void
663 FcCharSetPrint (const FcCharSet *c);
664     
665 extern int FcDebugVal;
666
667 static inline int
668 FcDebug (void) { return FcDebugVal; }
669
670 void
671 FcInitDebug (void);
672
673 /* fcdefault.c */
674 FcChar8 *
675 FcGetDefaultLang (void);
676
677 /* fcdir.c */
678
679 FcBool
680 FcFileIsDir (const FcChar8 *file);
681
682 FcBool
683 FcFileScanConfig (FcFontSet     *set,
684                   FcStrSet      *dirs,
685                   FcBlanks      *blanks,
686                   const FcChar8 *file,
687                   FcBool        force,
688                   FcConfig      *config);
689
690 FcBool
691 FcDirScanConfig (FcFontSet      *set,
692                  FcStrSet       *dirs,
693                  FcBlanks       *blanks,
694                  const FcChar8  *dir,
695                  FcBool         force,
696                  FcConfig       *config);
697
698 /* fcfont.c */
699 int
700 FcFontDebug (void);
701     
702 /* fcfreetype.c */
703 FcBool
704 FcFreeTypeIsExclusiveLang (const FcChar8  *lang);
705
706 FcBool
707 FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
708
709 FcChar32
710 FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
711
712 FcChar32
713 FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
714
715 const FcCharMap *
716 FcFreeTypeGetPrivateMap (FT_Encoding encoding);
717     
718 /* fcfs.c */
719
720 FcBool
721 FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s);
722
723 FcFontSet *
724 FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
725     
726 /* fcgram.y */
727 int
728 FcConfigparse (void);
729
730 int
731 FcConfigwrap (void);
732     
733 void
734 FcConfigerror (char *fmt, ...);
735     
736 char *
737 FcConfigSaveField (const char *field);
738
739 void
740 FcTestDestroy (FcTest *test);
741
742 FcExpr *
743 FcExprCreateInteger (int i);
744
745 FcExpr *
746 FcExprCreateDouble (double d);
747
748 FcExpr *
749 FcExprCreateString (const FcChar8 *s);
750
751 FcExpr *
752 FcExprCreateMatrix (const FcMatrix *m);
753
754 FcExpr *
755 FcExprCreateBool (FcBool b);
756
757 FcExpr *
758 FcExprCreateNil (void);
759
760 FcExpr *
761 FcExprCreateField (const char *field);
762
763 FcExpr *
764 FcExprCreateConst (const FcChar8 *constant);
765
766 FcExpr *
767 FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
768
769 void
770 FcExprDestroy (FcExpr *e);
771
772 void
773 FcEditDestroy (FcEdit *e);
774
775 /* fcinit.c */
776
777 void
778 FcMemReport (void);
779
780 void
781 FcMemAlloc (int kind, int size);
782
783 void
784 FcMemFree (int kind, int size);
785
786 /* fclang.c */
787 FcLangSet *
788 FcFreeTypeLangSet (const FcCharSet  *charset, 
789                    const FcChar8    *exclusiveLang);
790
791 FcLangResult
792 FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
793     
794 const FcCharSet *
795 FcCharSetForLang (const FcChar8 *lang);
796
797 FcLangSet *
798 FcLangSetPromote (const FcChar8 *lang);
799
800 FcLangSet *
801 FcNameParseLangSet (const FcChar8 *string);
802
803 FcBool
804 FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
805
806 /* fclist.c */
807
808 FcBool
809 FcListPatternMatchAny (const FcPattern *p,
810                        const FcPattern *font);
811
812 /* fcmatch.c */
813
814 /* fcname.c */
815
816 /*
817  * NOTE -- this ordering is part of the cache file format.
818  * It must also match the ordering in fcname.c
819  */
820
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
860
861 FcBool
862 FcNameBool (const FcChar8 *v, FcBool *result);
863
864 FcBool
865 FcObjectValidType (FcObject object, FcType type);
866
867 FcObject
868 FcObjectFromName (const char * name);
869
870 const char *
871 FcObjectName (FcObject object);
872
873 FcBool
874 FcObjectInit (void);
875
876 void
877 FcObjectFini (void);
878
879 #define FcObjectCompare(a, b)   ((int) a - (int) b)
880
881 /* fcpat.c */
882
883 FcValue
884 FcValueCanonicalize (const FcValue *v);
885
886 void
887 FcValueListDestroy (FcValueListPtr l);
888
889 FcPatternElt *
890 FcPatternObjectFindElt (const FcPattern *p, FcObject object);
891
892 FcPatternElt *
893 FcPatternObjectInsertElt (FcPattern *p, FcObject object);
894
895 FcBool
896 FcPatternObjectAddWithBinding  (FcPattern       *p,
897                                 FcObject        object,
898                                 FcValue         value,
899                                 FcValueBinding  binding,
900                                 FcBool          append);
901
902 FcBool
903 FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append);
904     
905 FcBool
906 FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
907     
908 FcResult
909 FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
910     
911 FcBool
912 FcPatternObjectDel (FcPattern *p, FcObject object);
913
914 FcBool
915 FcPatternObjectRemove (FcPattern *p, FcObject object, int id);
916
917 FcBool
918 FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i);
919
920 FcBool
921 FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d);
922
923 FcBool
924 FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s);
925
926 FcBool
927 FcPatternObjectAddMatrix (FcPattern *p, FcObject object, const FcMatrix *s);
928
929 FcBool
930 FcPatternObjectAddCharSet (FcPattern *p, FcObject object, const FcCharSet *c);
931
932 FcBool
933 FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b);
934
935 FcBool
936 FcPatternObjectAddLangSet (FcPattern *p, FcObject object, const FcLangSet *ls);
937
938 FcResult
939 FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int n, int *i);
940
941 FcResult
942 FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int n, double *d);
943
944 FcResult
945 FcPatternObjectGetString (const FcPattern *p, FcObject object, int n, FcChar8 ** s);
946
947 FcResult
948 FcPatternObjectGetMatrix (const FcPattern *p, FcObject object, int n, FcMatrix **s);
949
950 FcResult
951 FcPatternObjectGetCharSet (const FcPattern *p, FcObject object, int n, FcCharSet **c);
952
953 FcResult
954 FcPatternObjectGetBool (const FcPattern *p, FcObject object, int n, FcBool *b);
955
956 FcResult
957 FcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet **ls);
958
959 void
960 FcPatternFini (void);
961
962 FcBool
963 FcPatternAppend (FcPattern *p, FcPattern *s);
964
965 const FcChar8 *
966 FcStrStaticName (const FcChar8 *name);
967
968 FcChar32
969 FcStringHash (const FcChar8 *s);
970
971 FcBool
972 FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat);
973
974 FcPattern *
975 FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat);
976
977 FcBool
978 FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *pat);
979
980 FcValueList *
981 FcValueListSerialize (FcSerialize *serialize, const FcValueList *pat);
982
983 /* fcrender.c */
984
985 /* fcmatrix.c */
986
987 extern const FcMatrix    FcIdentityMatrix;
988
989 void
990 FcMatrixFree (FcMatrix *mat);
991
992 /* fcstr.c */
993 void
994 FcStrSetSort (FcStrSet * set);
995
996 FcChar8 *
997 FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
998     
999 void
1000 FcStrFree (FcChar8 *s);
1001
1002 void
1003 FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
1004
1005 void
1006 FcStrBufDestroy (FcStrBuf *buf);
1007
1008 FcChar8 *
1009 FcStrBufDone (FcStrBuf *buf);
1010
1011 FcBool
1012 FcStrBufChar (FcStrBuf *buf, FcChar8 c);
1013
1014 FcBool
1015 FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
1016
1017 FcBool
1018 FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
1019
1020 int
1021 FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
1022
1023 const FcChar8 *
1024 FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
1025
1026 const FcChar8 *
1027 FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
1028
1029 FcBool
1030 FcStrUsesHome (const FcChar8 *s);
1031
1032 FcChar8 *
1033 FcStrLastSlash (const FcChar8  *path);
1034
1035 FcChar32
1036 FcStrHashIgnoreCase (const FcChar8 *s);
1037
1038 FcChar8 *
1039 FcStrCanonFilename (const FcChar8 *s);
1040
1041 FcBool
1042 FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str);
1043
1044 FcChar8 *
1045 FcStrSerialize (FcSerialize *serialize, const FcChar8 *str);
1046
1047 #endif /* _FC_INT_H_ */