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