]> git.wh0rd.org Git - fontconfig.git/blob - src/fcint.h
0a036b4f864a9f52fd3abb3d9966ba1605e26d08
[fontconfig.git] / src / fcint.h
1 /*
2  * $RCSId: xc/lib/fontconfig/src/fcint.h,v 1.27 2002/08/31 22:17:32 keithp Exp $
3  *
4  * Copyright © 2000 Keith Packard
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and its
7  * documentation for any purpose is hereby granted without fee, provided that
8  * the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of Keith Packard not be used in
11  * advertising or publicity pertaining to distribution of the software without
12  * specific, written prior permission.  Keith Packard makes no
13  * representations about the suitability of this software for any purpose.  It
14  * is provided "as is" without express or implied warranty.
15  *
16  * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18  * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22  * PERFORMANCE OF THIS SOFTWARE.
23  */
24
25 #ifndef _FCINT_H_
26 #define _FCINT_H_
27
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31
32 #include <stdlib.h>
33 #include <stdio.h>
34 #ifdef HAVE_INTTYPES_H
35 #include <inttypes.h>
36 #elif defined(HAVE_STDINT_H)
37 #include <stdint.h>
38 #else
39 #error missing C99 integer data types
40 #endif
41 #include <string.h>
42 #include <ctype.h>
43 #include <errno.h>
44 #include <unistd.h>
45 #include <sys/types.h>
46 #include <sys/stat.h>
47 #include <time.h>
48 #include <fontconfig/fontconfig.h>
49 #include <fontconfig/fcprivate.h>
50 #include <fontconfig/fcfreetype.h>
51
52 #ifndef FC_CONFIG_PATH
53 #define FC_CONFIG_PATH "fonts.conf"
54 #endif
55
56 #define FC_FONT_FILE_INVALID    ((FcChar8 *) ".")
57 #define FC_FONT_FILE_DIR        ((FcChar8 *) ".dir")
58 #define FC_GLOBAL_MAGIC_COOKIE  "GLOBAL"
59
60 #ifdef _WIN32
61 #define FC_SEARCH_PATH_SEPARATOR ';'
62 #else
63 #define FC_SEARCH_PATH_SEPARATOR ':'
64 #endif
65
66 #define FC_DBG_MATCH    1
67 #define FC_DBG_MATCHV   2
68 #define FC_DBG_EDIT     4
69 #define FC_DBG_FONTSET  8
70 #define FC_DBG_CACHE    16
71 #define FC_DBG_CACHEV   32
72 #define FC_DBG_PARSE    64
73 #define FC_DBG_SCAN     128
74 #define FC_DBG_SCANV    256
75 #define FC_DBG_MEMORY   512
76 #define FC_DBG_CONFIG   1024
77
78 #define FC_MEM_CHARSET      0
79 #define FC_MEM_CHARLEAF     1
80 #define FC_MEM_FONTSET      2
81 #define FC_MEM_FONTPTR      3
82 #define FC_MEM_OBJECTSET    4
83 #define FC_MEM_OBJECTPTR    5
84 #define FC_MEM_MATRIX       6
85 #define FC_MEM_PATTERN      7
86 #define FC_MEM_PATELT       8
87 #define FC_MEM_VALLIST      9
88 #define FC_MEM_SUBSTATE     10
89 #define FC_MEM_STRING       11
90 #define FC_MEM_LISTBUCK     12
91 #define FC_MEM_STRSET       13
92 #define FC_MEM_STRLIST      14
93 #define FC_MEM_CONFIG       15
94 #define FC_MEM_LANGSET      16
95 #define FC_MEM_ATOMIC       17
96 #define FC_MEM_BLANKS       18
97 #define FC_MEM_CACHE        19
98 #define FC_MEM_STRBUF       20
99 #define FC_MEM_SUBST        21
100 #define FC_MEM_OBJECTTYPE   22
101 #define FC_MEM_CONSTANT     23
102 #define FC_MEM_TEST         24
103 #define FC_MEM_EXPR         25
104 #define FC_MEM_VSTACK       26
105 #define FC_MEM_ATTR         27
106 #define FC_MEM_PSTACK       28
107 #define FC_MEM_STATICSTR    29
108
109 #define FC_MEM_NUM          30
110
111 #define FC_BANK_DYNAMIC 0
112 #define FC_BANK_FIRST 1
113 #define FC_BANK_LANGS       0xfcfcfcfc
114
115 typedef enum _FcValueBinding {
116     FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
117 } FcValueBinding;
118
119 typedef struct _FcValueListPtr {
120     int                 bank;
121     union {
122         int                 stat;
123         struct _FcValueList *dyn;
124     } u;
125 } FcValueListPtr;
126
127 typedef struct _FcValueList {
128     FcValueListPtr          next;
129
130     FcValue                 value;
131     FcValueBinding          binding;
132 } FcValueList;
133
134 typedef int FcObjectPtr;
135
136 typedef struct _FcPatternEltPtr {
137     int                 bank;
138     union {
139         int                 stat;
140         struct _FcPatternElt *dyn;
141     } u;
142 } FcPatternEltPtr;
143
144 typedef struct _FcPatternElt {
145     FcObjectPtr             object;
146     FcValueListPtr          values;
147 } FcPatternElt;
148
149 struct _FcPattern {
150     int             num;
151     int             size;
152     FcPatternEltPtr elts;
153     int             ref;
154     int             bank;
155 };
156
157 typedef enum _FcOp {
158     FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet, 
159     FcOpNil,
160     FcOpField, FcOpConst,
161     FcOpAssign, FcOpAssignReplace, 
162     FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
163     FcOpQuest,
164     FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual, 
165     FcOpContains, FcOpListing, FcOpNotContains,
166     FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
167     FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
168     FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
169     FcOpInvalid
170 } FcOp;
171
172 typedef struct _FcExpr {
173     FcOp   op;
174     union {
175         int         ival;
176         double      dval;
177         FcChar8     *sval;
178         FcMatrix    *mval;
179         FcBool      bval;
180         FcCharSet   *cval;
181         char        *field;
182         FcChar8     *constant;
183         struct {
184             struct _FcExpr *left, *right;
185         } tree;
186     } u;
187 } FcExpr;
188
189 typedef enum _FcQual {
190     FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
191 } FcQual;
192
193 #define FcMatchDefault  ((FcMatchKind) -1)
194
195 typedef struct _FcTest {
196     struct _FcTest      *next;
197     FcMatchKind         kind;
198     FcQual              qual;
199     const char          *field;
200     FcOp                op;
201     FcExpr              *expr;
202 } FcTest;
203
204 typedef struct _FcEdit {
205     struct _FcEdit *next;
206     const char      *field;
207     FcOp            op;
208     FcExpr          *expr;
209     FcValueBinding  binding;
210 } FcEdit;
211
212 typedef struct _FcSubst {
213     struct _FcSubst     *next;
214     FcTest              *test;
215     FcEdit              *edit;
216 } FcSubst;
217
218 typedef struct _FcCharLeaf {
219     FcChar32    map[256/32];
220 } FcCharLeaf;
221
222 #define FC_REF_CONSTANT     -1
223
224 struct _FcCharSet {
225     int             ref;        /* reference count */
226     int             num;        /* size of leaves and numbers arrays */
227     int             bank;
228     union {
229         struct {
230             FcCharLeaf  **leaves;
231             FcChar16    *numbers;
232         } dyn;
233         struct {
234             int         leafidx_offset;
235             int         numbers_offset;
236         } stat;
237     } u;
238 };
239
240 struct _FcStrSet {
241     int             ref;        /* reference count */
242     int             num;
243     int             size;
244     FcChar8         **strs;
245 };
246
247 struct _FcStrList {
248     FcStrSet        *set;
249     int             n;
250 };
251
252 typedef struct _FcStrBuf {
253     FcChar8 *buf;
254     FcBool  allocated;
255     FcBool  failed;
256     int     len;
257     int     size;
258 } FcStrBuf;
259
260 typedef struct _FcCache {
261     int     magic;              /* FC_CACHE_MAGIC */
262     int     count;              /* number of bytes of data in block */
263     int     bank;               /* bank ID */
264     int     pattern_count;      /* number of FcPatterns */
265     int     patternelt_count;   /* number of FcPatternElts */
266     int     valuelist_count;    /* number of FcValueLists */
267     int     str_count;          /* size of strings appearing as FcValues */
268     int     langset_count;      /* number of FcLangSets */
269     int     charset_count;      /* number of FcCharSets */
270     int     charset_numbers_count; 
271     int     charset_leaf_count;
272     int     charset_leaf_idx_count;
273 } FcCache;
274
275 /*
276  * To map adobe glyph names to unicode values, a precomputed hash
277  * table is used
278  */
279
280 typedef struct _FcGlyphName {
281     FcChar32    ucs;            /* unicode value */
282     FcChar8     name[1];        /* name extends beyond struct */
283 } FcGlyphName;
284
285 /*
286  * To perform case-insensitive string comparisons, a table
287  * is used which holds three different kinds of folding data.
288  * 
289  * The first is a range of upper case values mapping to a range
290  * of their lower case equivalents.  Within each range, the offset
291  * between upper and lower case is constant.
292  *
293  * The second is a range of upper case values which are interleaved
294  * with their lower case equivalents.
295  * 
296  * The third is a set of raw unicode values mapping to a list
297  * of unicode values for comparison purposes.  This allows conversion
298  * of ß to "ss" so that SS, ss and ß all match.  A separate array
299  * holds the list of unicode values for each entry.
300  *
301  * These are packed into a single table.  Using a binary search,
302  * the appropriate entry can be located.
303  */
304
305 #define FC_CASE_FOLD_RANGE          0
306 #define FC_CASE_FOLD_EVEN_ODD       1
307 #define FC_CASE_FOLD_FULL           2
308
309 typedef struct _FcCaseFold {
310     FcChar32    upper;
311     FcChar16    method : 2;
312     FcChar16    count : 14;
313     short       offset;     /* lower - upper for RANGE, table id for FULL */
314 } FcCaseFold;
315
316 #define FC_MAX_FILE_LEN     4096
317
318 #define FC_STORAGE_STATIC 0x80
319 #define fc_value_string(v)  (((v)->type & FC_STORAGE_STATIC) ? ((FcChar8 *) v) + (v)->u.s_off : (v) -> u.s)
320 #define fc_value_charset(v)  (((v)->type & FC_STORAGE_STATIC) ? (const FcCharSet *)(((char *) v) + (v)->u.c_off) : (v) -> u.c)
321 #define fc_value_langset(v)  (((v)->type & FC_STORAGE_STATIC) ? (const FcLangSet *)(((char *) v) + (v)->u.l_off) : (v) -> u.l)
322 #define fc_storage_type(v) ((v)->type & ~FC_STORAGE_STATIC)
323
324 /*
325  * The per-user ~/.fonts.cache-<version> file is loaded into
326  * this data structure.  Each directory gets a substructure
327  * which is validated by comparing the directory timestamp with
328  * that saved in the cache.  When valid, the entire directory cache
329  * can be immediately loaded without reading the directory.  Otherwise,
330  * the files are checked individually; updated files are loaded into the
331  * cache which is then rewritten to the users home directory
332  */
333
334 #define FC_CACHE_MAGIC 0xFC02FC03
335
336 typedef struct _FcGlobalCacheDir FcGlobalCacheDir;
337
338 enum FcGCDirState {
339         FcGCDirDisabled, FcGCDirFileRead, FcGCDirConsumed, FcGCDirUpdated
340 };
341 struct _FcGlobalCacheDir {
342     struct _FcGlobalCacheDir    *next;
343     char                        *name;
344     FcCache                     metadata;
345     off_t                       offset;
346     FcStrSet                    *subdirs;
347     void                        *ent;
348     enum FcGCDirState           state;
349 };
350
351 typedef struct _FcGlobalCache {
352     FcGlobalCacheDir            *dirs;
353     FcBool                      updated;
354     int                         fd;
355 } FcGlobalCache;
356
357 struct _FcAtomic {
358     FcChar8     *file;          /* original file name */
359     FcChar8     *new;           /* temp file name -- write data here */
360     FcChar8     *lck;           /* lockfile name (used for locking) */
361     FcChar8     *tmp;           /* tmpfile name (used for locking) */
362 };
363
364 struct _FcBlanks {
365     int         nblank;
366     int         sblank;
367     FcChar32    *blanks;
368 };
369
370 struct _FcConfig {
371     /*
372      * File names loaded from the configuration -- saved here as the
373      * cache file must be consulted before the directories are scanned,
374      * and those directives may occur in any order
375      */
376     FcStrSet    *configDirs;        /* directories to scan for fonts */
377     FcChar8     *cache;             /* name of per-user cache file */
378     /*
379      * Set of allowed blank chars -- used to
380      * trim fonts of bogus glyphs
381      */
382     FcBlanks    *blanks;
383     /*
384      * List of directories containing fonts,
385      * built by recursively scanning the set 
386      * of configured directories
387      */
388     FcStrSet    *fontDirs;
389     /*
390      * Names of all of the configuration files used
391      * to create this configuration
392      */
393     FcStrSet    *configFiles;       /* config files loaded */
394     /*
395      * Substitution instructions for patterns and fonts;
396      * maxObjects is used to allocate appropriate intermediate storage
397      * while performing a whole set of substitutions
398      */
399     FcSubst     *substPattern;      /* substitutions for patterns */
400     FcSubst     *substFont;         /* substitutions for fonts */
401     int         maxObjects;         /* maximum number of tests in all substs */
402     /*
403      * List of patterns used to control font file selection
404      */
405     FcStrSet    *acceptGlobs;
406     FcStrSet    *rejectGlobs;
407     FcFontSet   *acceptPatterns;
408     FcFontSet   *rejectPatterns;
409     /*
410      * The set of fonts loaded from the listed directories; the
411      * order within the set does not determine the font selection,
412      * except in the case of identical matches in which case earlier fonts
413      * match preferrentially
414      */
415     FcFontSet   *fonts[FcSetApplication + 1];
416     /*
417      * Fontconfig can periodically rescan the system configuration
418      * and font directories.  This rescanning occurs when font
419      * listing requests are made, but no more often than rescanInterval
420      * seconds apart.
421      */
422     time_t      rescanTime;         /* last time information was scanned */
423     int         rescanInterval;     /* interval between scans */
424 };
425  
426 extern FcConfig *_fcConfig;
427
428 typedef struct _FcFileTime {
429     time_t  time;
430     FcBool  set;
431 } FcFileTime;
432
433 typedef struct _FcCharMap FcCharMap;
434
435 #define ALIGN(v,type) ((__typeof__(v))(((uintptr_t)(v) + __alignof__(type) - 1) & ~(__alignof__(type) - 1)))
436
437 /* fcblanks.c */
438
439 /* fccache.c */
440
441 FcGlobalCache *
442 FcGlobalCacheCreate (void);
443
444 void
445 FcGlobalCacheDestroy (FcGlobalCache *cache);
446
447 FcBool
448 FcGlobalCacheReadDir (FcFontSet     *set, 
449                       FcStrSet      *dirs, 
450                       FcGlobalCache *cache, 
451                       const char    *dir, 
452                       FcConfig      *config);
453
454 void
455 FcGlobalCacheLoad (FcGlobalCache    *cache,
456                    FcStrSet         *staleDirs,
457                    const FcChar8    *cache_file,
458                    FcConfig         *config);
459
460 FcBool
461 FcGlobalCacheUpdate (FcGlobalCache  *cache,
462                      FcStrSet       *dirs,
463                      const char     *file,
464                      FcFontSet      *set,
465                      FcConfig       *config);
466
467 FcBool
468 FcGlobalCacheSave (FcGlobalCache    *cache,
469                    const FcChar8    *cache_file,
470                    FcConfig         *config);
471
472 FcFontSet *
473 FcCacheRead (FcConfig *config, FcGlobalCache * cache);
474
475 FcBool
476 FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir);
477
478 FcBool
479 FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
480
481 extern int *_fcBankId, *_fcBankIdx;
482 int
483 FcCacheBankToIndexMTF (int bank);
484
485 static __inline__ int
486 FcCacheBankToIndex (int bank)
487 {
488     return (_fcBankId[*_fcBankIdx] == bank) ? *_fcBankIdx : FcCacheBankToIndexMTF(bank);
489 }
490
491 const char *
492 FcCacheFindBankDir (int bank);
493  
494 /* fccfg.c */
495
496 FcBool
497 FcConfigAddConfigDir (FcConfig      *config,
498                       const FcChar8 *d);
499
500 FcBool
501 FcConfigAddFontDir (FcConfig        *config,
502                     const FcChar8   *d);
503
504 FcBool
505 FcConfigAddDir (FcConfig        *config,
506                 const FcChar8   *d);
507
508 FcBool
509 FcConfigAddConfigFile (FcConfig         *config,
510                        const FcChar8    *f);
511
512 FcBool
513 FcConfigSetCache (FcConfig      *config,
514                   const FcChar8 *c);
515
516 FcBool
517 FcConfigAddBlank (FcConfig      *config,
518                   FcChar32      blank);
519
520 FcBool
521 FcConfigAddEdit (FcConfig       *config,
522                  FcTest         *test,
523                  FcEdit         *edit,
524                  FcMatchKind    kind);
525
526 void
527 FcConfigSetFonts (FcConfig      *config,
528                   FcFontSet     *fonts,
529                   FcSetName     set);
530
531 FcBool
532 FcConfigCompareValue (const FcValue *m,
533                       FcOp          op,
534                       const FcValue *v);
535
536 FcBool
537 FcConfigGlobAdd (FcConfig       *config,
538                  const FcChar8  *glob,
539                  FcBool         accept);
540
541 FcBool
542 FcConfigAcceptFilename (FcConfig        *config,
543                         const FcChar8   *filename);
544
545 FcBool
546 FcConfigPatternsAdd (FcConfig   *config,
547                      FcPattern  *pattern,
548                      FcBool     accept);
549
550 FcBool
551 FcConfigAcceptFont (FcConfig        *config,
552                     const FcPattern *font);
553
554 FcFileTime
555 FcConfigModifiedTime (FcConfig *config);
556
557 /* fccharset.c */
558 void
559 FcLangCharSetPopulate (void);
560
561 FcCharSet *
562 FcCharSetFreeze (FcCharSet *cs);
563
564 void
565 FcCharSetThawAll (void);
566
567 FcBool
568 FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
569
570 FcCharSet *
571 FcNameParseCharSet (FcChar8 *string);
572
573 FcCharLeaf *
574 FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
575
576 void
577 FcCharSetNewBank (void);
578
579 int
580 FcCharSetNeededBytes (const FcCharSet *c);
581
582 int
583 FcCharSetNeededBytesAlign (void);
584
585 void *
586 FcCharSetDistributeBytes (FcCache * metadata,
587                           void * block_ptr);
588
589 FcCharSet *
590 FcCharSetSerialize(int bank, FcCharSet *c);
591
592 void *
593 FcCharSetUnserialize (FcCache * metadata, void *block_ptr);
594
595 FcCharLeaf *
596 FcCharSetGetLeaf(const FcCharSet *c, int i);
597
598 FcChar16 *
599 FcCharSetGetNumbers(const FcCharSet *c);
600
601 /* fcdbg.c */
602 void
603 FcValueListPrint (const FcValueListPtr l);
604
605 void
606 FcLangSetPrint (const FcLangSet *ls);
607
608 void
609 FcOpPrint (FcOp op);
610
611 void
612 FcTestPrint (const FcTest *test);
613
614 void
615 FcExprPrint (const FcExpr *expr);
616
617 void
618 FcEditPrint (const FcEdit *edit);
619
620 void
621 FcSubstPrint (const FcSubst *subst);
622
623 extern int FcDebugVal;
624
625 static __inline__ int
626 FcDebug (void) { return FcDebugVal; }
627
628 void
629 FcInitDebug (void);
630
631 /* fcdefault.c */
632 FcChar8 *
633 FcGetDefaultLang (void);
634
635 /* fcdir.c */
636
637 FcBool
638 FcFileIsDir (const FcChar8 *file);
639
640 FcBool
641 FcFileScanConfig (FcFontSet     *set,
642                   FcStrSet      *dirs,
643                   FcFileCache   *cache,
644                   FcBlanks      *blanks,
645                   const FcChar8 *file,
646                   FcBool        force,
647                   FcConfig      *config);
648
649 FcBool
650 FcDirScanConfig (FcFontSet      *set,
651                  FcStrSet       *dirs,
652                  FcFileCache    *cache,
653                  FcBlanks       *blanks,
654                  const FcChar8  *dir,
655                  FcBool         force,
656                  FcConfig       *config);
657
658 /* fcfont.c */
659 int
660 FcFontDebug (void);
661     
662 /* fcfreetype.c */
663 FcBool
664 FcFreeTypeIsExclusiveLang (const FcChar8  *lang);
665
666 FcBool
667 FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
668
669 FcChar32
670 FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
671
672 FcChar32
673 FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
674
675 const FcCharMap *
676 FcFreeTypeGetPrivateMap (FT_Encoding encoding);
677     
678 /* fcfs.c */
679
680 void
681 FcFontSetNewBank (void);
682
683 int
684 FcFontSetNeededBytes (FcFontSet *s);
685
686 int
687 FcFontSetNeededBytesAlign (void);
688
689 void *
690 FcFontSetDistributeBytes (FcCache * metadata, void * block_ptr);
691
692 FcBool
693 FcFontSetSerialize (int bank, FcFontSet * s);
694
695 FcBool
696 FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr);
697
698 /* fcgram.y */
699 int
700 FcConfigparse (void);
701
702 int
703 FcConfigwrap (void);
704     
705 void
706 FcConfigerror (char *fmt, ...);
707     
708 char *
709 FcConfigSaveField (const char *field);
710
711 void
712 FcTestDestroy (FcTest *test);
713
714 FcExpr *
715 FcExprCreateInteger (int i);
716
717 FcExpr *
718 FcExprCreateDouble (double d);
719
720 FcExpr *
721 FcExprCreateString (const FcChar8 *s);
722
723 FcExpr *
724 FcExprCreateMatrix (const FcMatrix *m);
725
726 FcExpr *
727 FcExprCreateBool (FcBool b);
728
729 FcExpr *
730 FcExprCreateNil (void);
731
732 FcExpr *
733 FcExprCreateField (const char *field);
734
735 FcExpr *
736 FcExprCreateConst (const FcChar8 *constant);
737
738 FcExpr *
739 FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
740
741 void
742 FcExprDestroy (FcExpr *e);
743
744 void
745 FcEditDestroy (FcEdit *e);
746
747 /* fcinit.c */
748
749 void
750 FcMemReport (void);
751
752 void
753 FcMemAlloc (int kind, int size);
754
755 void
756 FcMemFree (int kind, int size);
757
758 /* fclang.c */
759 FcLangSet *
760 FcFreeTypeLangSet (const FcCharSet  *charset, 
761                    const FcChar8    *exclusiveLang);
762
763 FcLangResult
764 FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
765     
766 const FcCharSet *
767 FcCharSetForLang (const FcChar8 *lang);
768
769 FcLangSet *
770 FcLangSetPromote (const FcChar8 *lang);
771
772 FcLangSet *
773 FcNameParseLangSet (const FcChar8 *string);
774
775 FcBool
776 FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
777
778 void
779 FcLangSetNewBank (void);
780
781 int
782 FcLangSetNeededBytes (const FcLangSet *l);
783
784 int
785 FcLangSetNeededBytesAlign (void);
786
787 void *
788 FcLangSetDistributeBytes (FcCache * metadata,
789                           void * block_ptr);
790
791 FcLangSet *
792 FcLangSetSerialize (int bank, FcLangSet *l);
793
794 void *
795 FcLangSetUnserialize (FcCache * metadata, void *block_ptr);
796
797 /* fclist.c */
798
799 FcBool
800 FcListPatternMatchAny (const FcPattern *p,
801                        const FcPattern *font);
802
803 /* fcmatch.c */
804
805 /* fcname.c */
806
807 FcBool
808 FcNameBool (const FcChar8 *v, FcBool *result);
809
810 void *
811 FcObjectDistributeBytes (FcCache * metadata,
812                          void * block_ptr);
813
814 FcObjectPtr
815 FcObjectToPtr (const char * si);
816
817 int
818 FcObjectNeededBytes (void);
819
820 int
821 FcObjectNeededBytesAlign (void);
822
823 void *
824 FcObjectUnserialize (FcCache * metadata, void *block_ptr);
825
826 void
827 FcObjectSerialize (void);
828
829 const char *
830 FcObjectPtrU (FcObjectPtr p);
831
832 static __inline__ int
833 FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
834 {
835     return a - b;
836 }
837
838 void
839 FcObjectStaticNameFini (void);
840
841 /* fcpat.c */
842
843 FcValue
844 FcValueCanonicalize (const FcValue *v);
845
846 void
847 FcValueListDestroy (FcValueListPtr l);
848
849 FcPatternElt *
850 FcPatternFindElt (const FcPattern *p, const char *object);
851
852 FcPatternElt *
853 FcPatternInsertElt (FcPattern *p, const char *object);
854
855 FcBool
856 FcPatternAddWithBinding  (FcPattern         *p,
857                           const char        *object,
858                           FcValue           value,
859                           FcValueBinding    binding,
860                           FcBool            append);
861
862 FcPattern *
863 FcPatternFreeze (FcPattern *p);
864
865 void
866 FcPatternFini (void);
867
868 FcBool
869 FcPatternAppend (FcPattern *p, FcPattern *s);
870
871 void
872 FcPatternAddFullFname (const FcPattern *p, const char *fname);
873
874 void
875 FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig);
876
877 const FcChar8 *
878 FcStrStaticName (const FcChar8 *name);
879
880 FcChar32
881 FcStringHash (const FcChar8 *s);
882
883 void
884 FcPatternNewBank (void);
885
886 int
887 FcPatternNeededBytes (FcPattern *p);
888
889 int
890 FcPatternNeededBytesAlign (void);
891
892 void *
893 FcPatternDistributeBytes (FcCache * metadata, void * block_ptr);
894
895 /* please don't access these outside of fcpat.c! only visible so that
896  * *PtrU can be inlined. */
897 extern FcValueList ** _fcValueLists;
898 extern FcPatternElt ** _fcPatternElts;
899
900 static __inline__ FcValueList * 
901 FcValueListPtrU (FcValueListPtr pi)
902 {
903     if (pi.bank == FC_BANK_DYNAMIC)
904         return pi.u.dyn;
905
906     return &_fcValueLists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
907 }
908
909 static __inline__ FcPatternElt *
910 FcPatternEltU (FcPatternEltPtr pei)
911 {
912     if (pei.bank == FC_BANK_DYNAMIC)
913         return pei.u.dyn;
914
915     return &_fcPatternElts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
916 }
917
918 FcValueListPtr
919 FcValueListPtrCreateDynamic(FcValueList * p);
920
921 FcPattern *
922 FcPatternSerialize (int bank, FcPattern * p);
923
924 void *
925 FcPatternUnserialize (FcCache * metadata, void *block_ptr);
926
927 /* fcrender.c */
928
929 /* fcmatrix.c */
930
931 extern const FcMatrix    FcIdentityMatrix;
932
933 void
934 FcMatrixFree (FcMatrix *mat);
935
936 /* fcstr.c */
937 void
938 FcStrSetSort (FcStrSet * set);
939
940 FcChar8 *
941 FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
942     
943 void
944 FcStrFree (FcChar8 *s);
945
946 void
947 FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
948
949 void
950 FcStrBufDestroy (FcStrBuf *buf);
951
952 FcChar8 *
953 FcStrBufDone (FcStrBuf *buf);
954
955 FcBool
956 FcStrBufChar (FcStrBuf *buf, FcChar8 c);
957
958 FcBool
959 FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
960
961 FcBool
962 FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
963
964 int
965 FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
966
967 const FcChar8 *
968 FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
969
970 const FcChar8 *
971 FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
972
973 FcBool
974 FcStrUsesHome (const FcChar8 *s);
975
976 FcChar8 *
977 FcStrLastSlash (const FcChar8  *path);
978
979 FcChar32
980 FcStrHashIgnoreCase (const FcChar8 *s);
981
982 #endif /* _FC_INT_H_ */