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