]> git.wh0rd.org - fontconfig.git/blob - src/fcint.h
Fix up fc-cache and fc-cat for no global cache changes.
[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 int leafidx_offset;
231 int numbers_offset;
232 } stat;
233 struct {
234 FcCharLeaf **leaves;
235 FcChar16 *numbers;
236 } dyn;
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 subdirs; /* number of subdir strings */
263 off_t pos; /* position of data block in file */
264 off_t count; /* number of bytes of data in block */
265 int bank; /* bank ID */
266 int pattern_count; /* number of FcPatterns */
267 int patternelt_count; /* number of FcPatternElts */
268 int valuelist_count; /* number of FcValueLists */
269 int str_count; /* size of strings appearing as FcValues */
270 int langset_count; /* number of FcLangSets */
271 int charset_count; /* number of FcCharSets */
272 int charset_numbers_count;
273 int charset_leaf_count;
274 int charset_leaf_idx_count;
275 } FcCache;
276
277 /*
278 * To map adobe glyph names to unicode values, a precomputed hash
279 * table is used
280 */
281
282 typedef struct _FcGlyphName {
283 FcChar32 ucs; /* unicode value */
284 FcChar8 name[1]; /* name extends beyond struct */
285 } FcGlyphName;
286
287 /*
288 * To perform case-insensitive string comparisons, a table
289 * is used which holds three different kinds of folding data.
290 *
291 * The first is a range of upper case values mapping to a range
292 * of their lower case equivalents. Within each range, the offset
293 * between upper and lower case is constant.
294 *
295 * The second is a range of upper case values which are interleaved
296 * with their lower case equivalents.
297 *
298 * The third is a set of raw unicode values mapping to a list
299 * of unicode values for comparison purposes. This allows conversion
300 * of ß to "ss" so that SS, ss and ß all match. A separate array
301 * holds the list of unicode values for each entry.
302 *
303 * These are packed into a single table. Using a binary search,
304 * the appropriate entry can be located.
305 */
306
307 #define FC_CASE_FOLD_RANGE 0
308 #define FC_CASE_FOLD_EVEN_ODD 1
309 #define FC_CASE_FOLD_FULL 2
310
311 typedef struct _FcCaseFold {
312 FcChar32 upper;
313 FcChar16 method : 2;
314 FcChar16 count : 14;
315 short offset; /* lower - upper for RANGE, table id for FULL */
316 } FcCaseFold;
317
318 #define FC_MAX_FILE_LEN 4096
319
320 #define FC_STORAGE_STATIC 0x80
321 #define fc_value_string(v) (((v)->type & FC_STORAGE_STATIC) ? ((FcChar8 *) v) + (v)->u.s_off : (v) -> u.s)
322 #define fc_value_charset(v) (((v)->type & FC_STORAGE_STATIC) ? (const FcCharSet *)(((char *) v) + (v)->u.c_off) : (v) -> u.c)
323 #define fc_value_langset(v) (((v)->type & FC_STORAGE_STATIC) ? (const FcLangSet *)(((char *) v) + (v)->u.l_off) : (v) -> u.l)
324 #define fc_storage_type(v) ((v)->type & ~FC_STORAGE_STATIC)
325
326 #define fc_alignof(type) offsetof (struct { char c; type member; }, member)
327
328 #define FC_CACHE_MAGIC 0xFC02FC04
329
330 struct _FcAtomic {
331 FcChar8 *file; /* original file name */
332 FcChar8 *new; /* temp file name -- write data here */
333 FcChar8 *lck; /* lockfile name (used for locking) */
334 FcChar8 *tmp; /* tmpfile name (used for locking) */
335 };
336
337 struct _FcBlanks {
338 int nblank;
339 int sblank;
340 FcChar32 *blanks;
341 };
342
343 struct _FcConfig {
344 /*
345 * File names loaded from the configuration -- saved here as the
346 * cache file must be consulted before the directories are scanned,
347 * and those directives may occur in any order
348 */
349 FcStrSet *configDirs; /* directories to scan for fonts */
350 FcChar8 *cache; /* name of per-user cache file */
351 /*
352 * Set of allowed blank chars -- used to
353 * trim fonts of bogus glyphs
354 */
355 FcBlanks *blanks;
356 /*
357 * List of directories containing fonts,
358 * built by recursively scanning the set
359 * of configured directories
360 */
361 FcStrSet *fontDirs;
362 /*
363 * List of directories containing cache files.
364 */
365 FcStrSet *cacheDirs;
366 /*
367 * Names of all of the configuration files used
368 * to create this configuration
369 */
370 FcStrSet *configFiles; /* config files loaded */
371 /*
372 * Substitution instructions for patterns and fonts;
373 * maxObjects is used to allocate appropriate intermediate storage
374 * while performing a whole set of substitutions
375 */
376 FcSubst *substPattern; /* substitutions for patterns */
377 FcSubst *substFont; /* substitutions for fonts */
378 int maxObjects; /* maximum number of tests in all substs */
379 /*
380 * List of patterns used to control font file selection
381 */
382 FcStrSet *acceptGlobs;
383 FcStrSet *rejectGlobs;
384 FcFontSet *acceptPatterns;
385 FcFontSet *rejectPatterns;
386 /*
387 * The set of fonts loaded from the listed directories; the
388 * order within the set does not determine the font selection,
389 * except in the case of identical matches in which case earlier fonts
390 * match preferrentially
391 */
392 FcFontSet *fonts[FcSetApplication + 1];
393 /*
394 * Fontconfig can periodically rescan the system configuration
395 * and font directories. This rescanning occurs when font
396 * listing requests are made, but no more often than rescanInterval
397 * seconds apart.
398 */
399 time_t rescanTime; /* last time information was scanned */
400 int rescanInterval; /* interval between scans */
401 };
402
403 extern FcConfig *_fcConfig;
404
405 typedef struct _FcFileTime {
406 time_t time;
407 FcBool set;
408 } FcFileTime;
409
410 typedef struct _FcCharMap FcCharMap;
411
412 /* watch out; assumes that v is void * -PL */
413 #define ALIGN(v,type) ((void *)(((uintptr_t)(v) + fc_alignof(type) - 1) & ~(fc_alignof(type) - 1)))
414
415 /* fcblanks.c */
416
417 /* fccache.c */
418
419 FcFontSet *
420 FcCacheRead (FcConfig *config);
421
422 FcBool
423 FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
424
425 FcBool
426 FcDirCacheConsume (FILE *file, FcFontSet *set, FcStrSet *dirs,
427 const FcChar8 *dir, char *dirname);
428
429 FcBool
430 FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
431
432 extern int *_fcBankId, *_fcBankIdx;
433 int
434 FcCacheBankToIndexMTF (int bank);
435
436 static inline int
437 FcCacheBankToIndex (int bank)
438 {
439 return (_fcBankId[*_fcBankIdx] == bank) ? *_fcBankIdx : FcCacheBankToIndexMTF(bank);
440 }
441
442 const char *
443 FcCacheFindBankDir (int bank);
444
445 /* fccfg.c */
446
447 FcBool
448 FcConfigAddConfigDir (FcConfig *config,
449 const FcChar8 *d);
450
451 FcBool
452 FcConfigAddFontDir (FcConfig *config,
453 const FcChar8 *d);
454
455 FcBool
456 FcConfigAddDir (FcConfig *config,
457 const FcChar8 *d);
458
459 FcBool
460 FcConfigAddCacheDir (FcConfig *config,
461 const FcChar8 *d);
462
463 FcStrList *
464 FcConfigGetCacheDirs (FcConfig *config);
465
466 FcBool
467 FcConfigAddConfigFile (FcConfig *config,
468 const FcChar8 *f);
469
470 FcBool
471 FcConfigSetCache (FcConfig *config,
472 const FcChar8 *c);
473
474 FcBool
475 FcConfigAddBlank (FcConfig *config,
476 FcChar32 blank);
477
478 FcBool
479 FcConfigAddEdit (FcConfig *config,
480 FcTest *test,
481 FcEdit *edit,
482 FcMatchKind kind);
483
484 void
485 FcConfigSetFonts (FcConfig *config,
486 FcFontSet *fonts,
487 FcSetName set);
488
489 FcBool
490 FcConfigCompareValue (const FcValue *m,
491 FcOp op,
492 const FcValue *v);
493
494 FcBool
495 FcConfigGlobAdd (FcConfig *config,
496 const FcChar8 *glob,
497 FcBool accept);
498
499 FcBool
500 FcConfigAcceptFilename (FcConfig *config,
501 const FcChar8 *filename);
502
503 FcBool
504 FcConfigPatternsAdd (FcConfig *config,
505 FcPattern *pattern,
506 FcBool accept);
507
508 FcBool
509 FcConfigAcceptFont (FcConfig *config,
510 const FcPattern *font);
511
512 FcFileTime
513 FcConfigModifiedTime (FcConfig *config);
514
515 /* fccharset.c */
516 void
517 FcLangCharSetPopulate (void);
518
519 FcCharSet *
520 FcCharSetFreeze (FcCharSet *cs);
521
522 void
523 FcCharSetThawAll (void);
524
525 FcBool
526 FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
527
528 FcCharSet *
529 FcNameParseCharSet (FcChar8 *string);
530
531 FcCharLeaf *
532 FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
533
534 void
535 FcCharSetNewBank (void);
536
537 int
538 FcCharSetNeededBytes (const FcCharSet *c);
539
540 int
541 FcCharSetNeededBytesAlign (void);
542
543 void *
544 FcCharSetDistributeBytes (FcCache * metadata,
545 void * block_ptr);
546
547 FcCharSet *
548 FcCharSetSerialize(int bank, FcCharSet *c);
549
550 void *
551 FcCharSetUnserialize (FcCache * metadata, void *block_ptr);
552
553 FcCharLeaf *
554 FcCharSetGetLeaf(const FcCharSet *c, int i);
555
556 FcChar16 *
557 FcCharSetGetNumbers(const FcCharSet *c);
558
559 /* fcdbg.c */
560 void
561 FcValueListPrint (const FcValueListPtr l);
562
563 void
564 FcLangSetPrint (const FcLangSet *ls);
565
566 void
567 FcOpPrint (FcOp op);
568
569 void
570 FcTestPrint (const FcTest *test);
571
572 void
573 FcExprPrint (const FcExpr *expr);
574
575 void
576 FcEditPrint (const FcEdit *edit);
577
578 void
579 FcSubstPrint (const FcSubst *subst);
580
581 extern int FcDebugVal;
582
583 static inline int
584 FcDebug (void) { return FcDebugVal; }
585
586 void
587 FcInitDebug (void);
588
589 /* fcdefault.c */
590 FcChar8 *
591 FcGetDefaultLang (void);
592
593 /* fcdir.c */
594
595 FcBool
596 FcFileIsDir (const FcChar8 *file);
597
598 FcBool
599 FcFileScanConfig (FcFontSet *set,
600 FcStrSet *dirs,
601 FcBlanks *blanks,
602 const FcChar8 *file,
603 FcBool force,
604 FcConfig *config);
605
606 FcBool
607 FcDirScanConfig (FcFontSet *set,
608 FcStrSet *dirs,
609 FcBlanks *blanks,
610 const FcChar8 *dir,
611 FcBool force,
612 FcConfig *config);
613
614 /* fcfont.c */
615 int
616 FcFontDebug (void);
617
618 /* fcfreetype.c */
619 FcBool
620 FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
621
622 FcBool
623 FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
624
625 FcChar32
626 FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
627
628 FcChar32
629 FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
630
631 const FcCharMap *
632 FcFreeTypeGetPrivateMap (FT_Encoding encoding);
633
634 /* fcfs.c */
635
636 void
637 FcFontSetNewBank (void);
638
639 int
640 FcFontSetNeededBytes (FcFontSet *s);
641
642 int
643 FcFontSetNeededBytesAlign (void);
644
645 void *
646 FcFontSetDistributeBytes (FcCache * metadata, void * block_ptr);
647
648 FcBool
649 FcFontSetSerialize (int bank, FcFontSet * s);
650
651 FcBool
652 FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr);
653
654 /* fcgram.y */
655 int
656 FcConfigparse (void);
657
658 int
659 FcConfigwrap (void);
660
661 void
662 FcConfigerror (char *fmt, ...);
663
664 char *
665 FcConfigSaveField (const char *field);
666
667 void
668 FcTestDestroy (FcTest *test);
669
670 FcExpr *
671 FcExprCreateInteger (int i);
672
673 FcExpr *
674 FcExprCreateDouble (double d);
675
676 FcExpr *
677 FcExprCreateString (const FcChar8 *s);
678
679 FcExpr *
680 FcExprCreateMatrix (const FcMatrix *m);
681
682 FcExpr *
683 FcExprCreateBool (FcBool b);
684
685 FcExpr *
686 FcExprCreateNil (void);
687
688 FcExpr *
689 FcExprCreateField (const char *field);
690
691 FcExpr *
692 FcExprCreateConst (const FcChar8 *constant);
693
694 FcExpr *
695 FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
696
697 void
698 FcExprDestroy (FcExpr *e);
699
700 void
701 FcEditDestroy (FcEdit *e);
702
703 /* fcinit.c */
704
705 void
706 FcMemReport (void);
707
708 void
709 FcMemAlloc (int kind, int size);
710
711 void
712 FcMemFree (int kind, int size);
713
714 /* fclang.c */
715 FcLangSet *
716 FcFreeTypeLangSet (const FcCharSet *charset,
717 const FcChar8 *exclusiveLang);
718
719 FcLangResult
720 FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
721
722 const FcCharSet *
723 FcCharSetForLang (const FcChar8 *lang);
724
725 FcLangSet *
726 FcLangSetPromote (const FcChar8 *lang);
727
728 FcLangSet *
729 FcNameParseLangSet (const FcChar8 *string);
730
731 FcBool
732 FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
733
734 void
735 FcLangSetNewBank (void);
736
737 int
738 FcLangSetNeededBytes (const FcLangSet *l);
739
740 int
741 FcLangSetNeededBytesAlign (void);
742
743 void *
744 FcLangSetDistributeBytes (FcCache * metadata,
745 void * block_ptr);
746
747 FcLangSet *
748 FcLangSetSerialize (int bank, FcLangSet *l);
749
750 void *
751 FcLangSetUnserialize (FcCache * metadata, void *block_ptr);
752
753 /* fclist.c */
754
755 FcBool
756 FcListPatternMatchAny (const FcPattern *p,
757 const FcPattern *font);
758
759 /* fcmatch.c */
760
761 /* fcname.c */
762
763 FcBool
764 FcNameBool (const FcChar8 *v, FcBool *result);
765
766 void *
767 FcObjectDistributeBytes (FcCache * metadata,
768 void * block_ptr);
769
770 FcObjectPtr
771 FcObjectToPtr (const char * si);
772
773 int
774 FcObjectNeededBytes (void);
775
776 int
777 FcObjectNeededBytesAlign (void);
778
779 void *
780 FcObjectUnserialize (FcCache * metadata, void *block_ptr);
781
782 void
783 FcObjectSerialize (void);
784
785 const char *
786 FcObjectPtrU (FcObjectPtr p);
787
788 static inline int
789 FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
790 {
791 return a - b;
792 }
793
794 void
795 FcObjectStaticNameFini (void);
796
797 /* fcpat.c */
798
799 FcValue
800 FcValueCanonicalize (const FcValue *v);
801
802 void
803 FcValueListDestroy (FcValueListPtr l);
804
805 FcPatternElt *
806 FcPatternFindElt (const FcPattern *p, const char *object);
807
808 FcPatternElt *
809 FcPatternInsertElt (FcPattern *p, const char *object);
810
811 FcBool
812 FcPatternAddWithBinding (FcPattern *p,
813 const char *object,
814 FcValue value,
815 FcValueBinding binding,
816 FcBool append);
817
818 void
819 FcPatternFini (void);
820
821 FcBool
822 FcPatternAppend (FcPattern *p, FcPattern *s);
823
824 const FcChar8 *
825 FcStrStaticName (const FcChar8 *name);
826
827 FcChar32
828 FcStringHash (const FcChar8 *s);
829
830 void
831 FcPatternNewBank (void);
832
833 int
834 FcPatternNeededBytes (FcPattern *p);
835
836 int
837 FcPatternNeededBytesAlign (void);
838
839 void *
840 FcPatternDistributeBytes (FcCache * metadata, void * block_ptr);
841
842 /* please don't access these outside of fcpat.c! only visible so that
843 * *PtrU can be inlined. */
844 extern FcValueList ** _fcValueLists;
845 extern FcPatternElt ** _fcPatternElts;
846
847 static inline FcValueList *
848 FcValueListPtrU (FcValueListPtr pi)
849 {
850 if (pi.bank == FC_BANK_DYNAMIC)
851 return pi.u.dyn;
852
853 return &_fcValueLists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
854 }
855
856 static inline FcPatternElt *
857 FcPatternEltU (FcPatternEltPtr pei)
858 {
859 if (pei.bank == FC_BANK_DYNAMIC)
860 return pei.u.dyn;
861
862 return &_fcPatternElts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
863 }
864
865 FcValueListPtr
866 FcValueListPtrCreateDynamic(FcValueList * p);
867
868 FcPattern *
869 FcPatternSerialize (int bank, FcPattern * p);
870
871 void *
872 FcPatternUnserialize (FcCache * metadata, void *block_ptr);
873
874 /* fcrender.c */
875
876 /* fcmatrix.c */
877
878 extern const FcMatrix FcIdentityMatrix;
879
880 void
881 FcMatrixFree (FcMatrix *mat);
882
883 /* fcstr.c */
884 void
885 FcStrSetSort (FcStrSet * set);
886
887 FcChar8 *
888 FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
889
890 void
891 FcStrFree (FcChar8 *s);
892
893 void
894 FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
895
896 void
897 FcStrBufDestroy (FcStrBuf *buf);
898
899 FcChar8 *
900 FcStrBufDone (FcStrBuf *buf);
901
902 FcBool
903 FcStrBufChar (FcStrBuf *buf, FcChar8 c);
904
905 FcBool
906 FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
907
908 FcBool
909 FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
910
911 int
912 FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
913
914 const FcChar8 *
915 FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
916
917 const FcChar8 *
918 FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
919
920 FcBool
921 FcStrUsesHome (const FcChar8 *s);
922
923 FcChar8 *
924 FcStrLastSlash (const FcChar8 *path);
925
926 FcChar32
927 FcStrHashIgnoreCase (const FcChar8 *s);
928
929 #endif /* _FC_INT_H_ */