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