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