]> git.wh0rd.org - fontconfig.git/blob - src/fcint.h
Compare device numbers as well as inodes. Always normalize directory names
[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 FcConfig *config);
453
454 FcBool
455 FcGlobalCacheSave (FcGlobalCache *cache,
456 const FcChar8 *cache_file,
457 FcConfig *config);
458
459 FcFontSet *
460 FcCacheRead (FcConfig *config, FcGlobalCache * cache);
461
462 FcBool
463 FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir);
464
465 FcBool
466 FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
467
468 extern int *_fcBankId, *_fcBankIdx;
469 int
470 FcCacheBankToIndexMTF (int bank);
471
472 static __inline__ int
473 FcCacheBankToIndex (int bank)
474 {
475 return (_fcBankId[*_fcBankIdx] == bank) ? *_fcBankIdx : FcCacheBankToIndexMTF(bank);
476 }
477
478 const char *
479 FcCacheFindBankDir (int bank);
480
481 /* fccfg.c */
482
483 FcBool
484 FcConfigAddConfigDir (FcConfig *config,
485 const FcChar8 *d);
486
487 FcBool
488 FcConfigAddFontDir (FcConfig *config,
489 const FcChar8 *d);
490
491 FcBool
492 FcConfigAddDir (FcConfig *config,
493 const FcChar8 *d);
494
495 FcBool
496 FcConfigAddConfigFile (FcConfig *config,
497 const FcChar8 *f);
498
499 const FcChar8 *
500 FcConfigNormalizeFontDir (FcConfig *config,
501 const FcChar8 *d);
502
503 FcBool
504 FcConfigSetCache (FcConfig *config,
505 const FcChar8 *c);
506
507 FcBool
508 FcConfigAddBlank (FcConfig *config,
509 FcChar32 blank);
510
511 FcBool
512 FcConfigAddEdit (FcConfig *config,
513 FcTest *test,
514 FcEdit *edit,
515 FcMatchKind kind);
516
517 void
518 FcConfigSetFonts (FcConfig *config,
519 FcFontSet *fonts,
520 FcSetName set);
521
522 FcBool
523 FcConfigCompareValue (const FcValue *m,
524 FcOp op,
525 const FcValue *v);
526
527 FcBool
528 FcConfigGlobAdd (FcConfig *config,
529 const FcChar8 *glob,
530 FcBool accept);
531
532 FcBool
533 FcConfigAcceptFilename (FcConfig *config,
534 const FcChar8 *filename);
535
536 FcBool
537 FcConfigPatternsAdd (FcConfig *config,
538 FcPattern *pattern,
539 FcBool accept);
540
541 FcBool
542 FcConfigAcceptFont (FcConfig *config,
543 const FcPattern *font);
544
545 FcFileTime
546 FcConfigModifiedTime (FcConfig *config);
547
548 /* fccharset.c */
549 void
550 FcLangCharSetPopulate (void);
551
552 FcCharSet *
553 FcCharSetFreeze (FcCharSet *cs);
554
555 void
556 FcCharSetThawAll (void);
557
558 FcBool
559 FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
560
561 FcCharSet *
562 FcNameParseCharSet (FcChar8 *string);
563
564 FcCharLeaf *
565 FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
566
567 void
568 FcCharSetNewBank (void);
569
570 int
571 FcCharSetNeededBytes (const FcCharSet *c);
572
573 int
574 FcCharSetNeededBytesAlign (void);
575
576 void *
577 FcCharSetDistributeBytes (FcCache * metadata,
578 void * block_ptr);
579
580 FcCharSet *
581 FcCharSetSerialize(int bank, FcCharSet *c);
582
583 void *
584 FcCharSetUnserialize (FcCache * metadata, void *block_ptr);
585
586 FcCharLeaf *
587 FcCharSetGetLeaf(const FcCharSet *c, int i);
588
589 FcChar16 *
590 FcCharSetGetNumbers(const FcCharSet *c);
591
592 /* fcdbg.c */
593 void
594 FcValueListPrint (const FcValueListPtr l);
595
596 void
597 FcLangSetPrint (const FcLangSet *ls);
598
599 void
600 FcOpPrint (FcOp op);
601
602 void
603 FcTestPrint (const FcTest *test);
604
605 void
606 FcExprPrint (const FcExpr *expr);
607
608 void
609 FcEditPrint (const FcEdit *edit);
610
611 void
612 FcSubstPrint (const FcSubst *subst);
613
614 extern int FcDebugVal;
615
616 static __inline__ int
617 FcDebug (void) { return FcDebugVal; }
618
619 void
620 FcInitDebug (void);
621
622 /* fcdefault.c */
623 FcChar8 *
624 FcGetDefaultLang (void);
625
626 /* fcdir.c */
627
628 FcBool
629 FcFileIsDir (const FcChar8 *file);
630
631 FcBool
632 FcFileScanConfig (FcFontSet *set,
633 FcStrSet *dirs,
634 FcFileCache *cache,
635 FcBlanks *blanks,
636 const FcChar8 *file,
637 FcBool force,
638 FcConfig *config);
639
640 FcBool
641 FcDirScanConfig (FcFontSet *set,
642 FcStrSet *dirs,
643 FcFileCache *cache,
644 FcBlanks *blanks,
645 const FcChar8 *dir,
646 FcBool force,
647 FcConfig *config);
648
649 /* fcfont.c */
650 int
651 FcFontDebug (void);
652
653 /* fcfreetype.c */
654 FcBool
655 FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
656
657 FcBool
658 FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
659
660 FcChar32
661 FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
662
663 FcChar32
664 FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
665
666 const FcCharMap *
667 FcFreeTypeGetPrivateMap (FT_Encoding encoding);
668
669 /* fcfs.c */
670
671 void
672 FcFontSetNewBank (void);
673
674 int
675 FcFontSetNeededBytes (FcFontSet *s);
676
677 int
678 FcFontSetNeededBytesAlign (void);
679
680 void *
681 FcFontSetDistributeBytes (FcCache * metadata, void * block_ptr);
682
683 FcBool
684 FcFontSetSerialize (int bank, FcFontSet * s);
685
686 FcBool
687 FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr);
688
689 /* fcgram.y */
690 int
691 FcConfigparse (void);
692
693 int
694 FcConfigwrap (void);
695
696 void
697 FcConfigerror (char *fmt, ...);
698
699 char *
700 FcConfigSaveField (const char *field);
701
702 void
703 FcTestDestroy (FcTest *test);
704
705 FcExpr *
706 FcExprCreateInteger (int i);
707
708 FcExpr *
709 FcExprCreateDouble (double d);
710
711 FcExpr *
712 FcExprCreateString (const FcChar8 *s);
713
714 FcExpr *
715 FcExprCreateMatrix (const FcMatrix *m);
716
717 FcExpr *
718 FcExprCreateBool (FcBool b);
719
720 FcExpr *
721 FcExprCreateNil (void);
722
723 FcExpr *
724 FcExprCreateField (const char *field);
725
726 FcExpr *
727 FcExprCreateConst (const FcChar8 *constant);
728
729 FcExpr *
730 FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
731
732 void
733 FcExprDestroy (FcExpr *e);
734
735 void
736 FcEditDestroy (FcEdit *e);
737
738 /* fcinit.c */
739
740 void
741 FcMemReport (void);
742
743 void
744 FcMemAlloc (int kind, int size);
745
746 void
747 FcMemFree (int kind, int size);
748
749 /* fclang.c */
750 FcLangSet *
751 FcFreeTypeLangSet (const FcCharSet *charset,
752 const FcChar8 *exclusiveLang);
753
754 FcLangResult
755 FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
756
757 const FcCharSet *
758 FcCharSetForLang (const FcChar8 *lang);
759
760 FcLangSet *
761 FcLangSetPromote (const FcChar8 *lang);
762
763 FcLangSet *
764 FcNameParseLangSet (const FcChar8 *string);
765
766 FcBool
767 FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
768
769 void
770 FcLangSetNewBank (void);
771
772 int
773 FcLangSetNeededBytes (const FcLangSet *l);
774
775 int
776 FcLangSetNeededBytesAlign (void);
777
778 void *
779 FcLangSetDistributeBytes (FcCache * metadata,
780 void * block_ptr);
781
782 FcLangSet *
783 FcLangSetSerialize (int bank, FcLangSet *l);
784
785 void *
786 FcLangSetUnserialize (FcCache * metadata, void *block_ptr);
787
788 /* fclist.c */
789
790 FcBool
791 FcListPatternMatchAny (const FcPattern *p,
792 const FcPattern *font);
793
794 /* fcmatch.c */
795
796 /* fcname.c */
797
798 FcBool
799 FcNameBool (const FcChar8 *v, FcBool *result);
800
801 void *
802 FcObjectDistributeBytes (FcCache * metadata,
803 void * block_ptr);
804
805 FcObjectPtr
806 FcObjectToPtr (const char * si);
807
808 int
809 FcObjectNeededBytes (void);
810
811 int
812 FcObjectNeededBytesAlign (void);
813
814 void *
815 FcObjectUnserialize (FcCache * metadata, void *block_ptr);
816
817 void
818 FcObjectSerialize (void);
819
820 const char *
821 FcObjectPtrU (FcObjectPtr p);
822
823 static __inline__ int
824 FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
825 {
826 return a - b;
827 }
828
829 void
830 FcObjectStaticNameFini (void);
831
832 /* fcpat.c */
833
834 FcValue
835 FcValueCanonicalize (const FcValue *v);
836
837 void
838 FcValueListDestroy (FcValueListPtr l);
839
840 FcPatternElt *
841 FcPatternFindElt (const FcPattern *p, const char *object);
842
843 FcPatternElt *
844 FcPatternInsertElt (FcPattern *p, const char *object);
845
846 FcBool
847 FcPatternAddWithBinding (FcPattern *p,
848 const char *object,
849 FcValue value,
850 FcValueBinding binding,
851 FcBool append);
852
853 FcPattern *
854 FcPatternFreeze (FcPattern *p);
855
856 void
857 FcPatternFini (void);
858
859 FcBool
860 FcPatternAppend (FcPattern *p, FcPattern *s);
861
862 void
863 FcPatternAddFullFname (const FcPattern *p, const char *fname);
864
865 void
866 FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig);
867
868 const FcChar8 *
869 FcStrStaticName (const FcChar8 *name);
870
871 FcChar32
872 FcStringHash (const FcChar8 *s);
873
874 void
875 FcPatternNewBank (void);
876
877 int
878 FcPatternNeededBytes (FcPattern *p);
879
880 int
881 FcPatternNeededBytesAlign (void);
882
883 void *
884 FcPatternDistributeBytes (FcCache * metadata, void * block_ptr);
885
886 /* please don't access these outside of fcpat.c! only visible so that
887 * *PtrU can be inlined. */
888 extern FcValueList ** _fcValueLists;
889 extern FcPatternElt ** _fcPatternElts;
890
891 static __inline__ FcValueList *
892 FcValueListPtrU (FcValueListPtr pi)
893 {
894 if (pi.bank == FC_BANK_DYNAMIC)
895 return pi.u.dyn;
896
897 return &_fcValueLists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
898 }
899
900 static __inline__ FcPatternElt *
901 FcPatternEltU (FcPatternEltPtr pei)
902 {
903 if (pei.bank == FC_BANK_DYNAMIC)
904 return pei.u.dyn;
905
906 return &_fcPatternElts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
907 }
908
909 FcPatternElt *
910 FcPatternEltU (FcPatternEltPtr pei);
911
912 FcValueListPtr
913 FcValueListPtrCreateDynamic(FcValueList * p);
914
915 FcPattern *
916 FcPatternSerialize (int bank, FcPattern * p);
917
918 void *
919 FcPatternUnserialize (FcCache * metadata, void *block_ptr);
920
921 /* fcrender.c */
922
923 /* fcmatrix.c */
924
925 extern const FcMatrix FcIdentityMatrix;
926
927 void
928 FcMatrixFree (FcMatrix *mat);
929
930 /* fcstr.c */
931 void
932 FcStrSetSort (FcStrSet * set);
933
934 FcChar8 *
935 FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
936
937 void
938 FcStrFree (FcChar8 *s);
939
940 void
941 FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
942
943 void
944 FcStrBufDestroy (FcStrBuf *buf);
945
946 FcChar8 *
947 FcStrBufDone (FcStrBuf *buf);
948
949 FcBool
950 FcStrBufChar (FcStrBuf *buf, FcChar8 c);
951
952 FcBool
953 FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
954
955 FcBool
956 FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
957
958 int
959 FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
960
961 const FcChar8 *
962 FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
963
964 const FcChar8 *
965 FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
966
967 FcBool
968 FcStrUsesHome (const FcChar8 *s);
969
970 FcChar8 *
971 FcStrLastSlash (const FcChar8 *path);
972
973 FcChar32
974 FcStrHashIgnoreCase (const FcChar8 *s);
975
976 #endif /* _FC_INT_H_ */