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