]> git.wh0rd.org - fontconfig.git/blob - src/fcint.h
Portability fixes for HP-UX (reported by Christoph Bauer). Replace
[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 #define fc_alignof(type) offsetof (struct { char c; type member; }, member)
325
326 /*
327 * The per-user ~/.fonts.cache-<version> file is loaded into
328 * this data structure. Each directory gets a substructure
329 * which is validated by comparing the directory timestamp with
330 * that saved in the cache. When valid, the entire directory cache
331 * can be immediately loaded without reading the directory. Otherwise,
332 * the files are checked individually; updated files are loaded into the
333 * cache which is then rewritten to the users home directory
334 */
335
336 #define FC_CACHE_MAGIC 0xFC02FC03
337
338 typedef struct _FcGlobalCacheDir FcGlobalCacheDir;
339
340 enum FcGCDirState {
341 FcGCDirDisabled, FcGCDirFileRead, FcGCDirConsumed, FcGCDirUpdated
342 };
343 struct _FcGlobalCacheDir {
344 struct _FcGlobalCacheDir *next;
345 char *name;
346 FcCache metadata;
347 off_t offset;
348 FcStrSet *subdirs;
349 void *ent;
350 enum FcGCDirState state;
351 };
352
353 typedef struct _FcGlobalCache {
354 FcGlobalCacheDir *dirs;
355 FcBool updated;
356 int fd;
357 } FcGlobalCache;
358
359 struct _FcAtomic {
360 FcChar8 *file; /* original file name */
361 FcChar8 *new; /* temp file name -- write data here */
362 FcChar8 *lck; /* lockfile name (used for locking) */
363 FcChar8 *tmp; /* tmpfile name (used for locking) */
364 };
365
366 struct _FcBlanks {
367 int nblank;
368 int sblank;
369 FcChar32 *blanks;
370 };
371
372 struct _FcConfig {
373 /*
374 * File names loaded from the configuration -- saved here as the
375 * cache file must be consulted before the directories are scanned,
376 * and those directives may occur in any order
377 */
378 FcStrSet *configDirs; /* directories to scan for fonts */
379 FcChar8 *cache; /* name of per-user cache file */
380 /*
381 * Set of allowed blank chars -- used to
382 * trim fonts of bogus glyphs
383 */
384 FcBlanks *blanks;
385 /*
386 * List of directories containing fonts,
387 * built by recursively scanning the set
388 * of configured directories
389 */
390 FcStrSet *fontDirs;
391 /*
392 * Names of all of the configuration files used
393 * to create this configuration
394 */
395 FcStrSet *configFiles; /* config files loaded */
396 /*
397 * Substitution instructions for patterns and fonts;
398 * maxObjects is used to allocate appropriate intermediate storage
399 * while performing a whole set of substitutions
400 */
401 FcSubst *substPattern; /* substitutions for patterns */
402 FcSubst *substFont; /* substitutions for fonts */
403 int maxObjects; /* maximum number of tests in all substs */
404 /*
405 * List of patterns used to control font file selection
406 */
407 FcStrSet *acceptGlobs;
408 FcStrSet *rejectGlobs;
409 FcFontSet *acceptPatterns;
410 FcFontSet *rejectPatterns;
411 /*
412 * The set of fonts loaded from the listed directories; the
413 * order within the set does not determine the font selection,
414 * except in the case of identical matches in which case earlier fonts
415 * match preferrentially
416 */
417 FcFontSet *fonts[FcSetApplication + 1];
418 /*
419 * Fontconfig can periodically rescan the system configuration
420 * and font directories. This rescanning occurs when font
421 * listing requests are made, but no more often than rescanInterval
422 * seconds apart.
423 */
424 time_t rescanTime; /* last time information was scanned */
425 int rescanInterval; /* interval between scans */
426 };
427
428 extern FcConfig *_fcConfig;
429
430 typedef struct _FcFileTime {
431 time_t time;
432 FcBool set;
433 } FcFileTime;
434
435 typedef struct _FcCharMap FcCharMap;
436
437 /* watch out; assumes that v is void * -PL */
438 #define ALIGN(v,type) ((void *)(((uintptr_t)(v) + fc_alignof(type) - 1) & ~(fc_alignof(type) - 1)))
439
440 /* fcblanks.c */
441
442 /* fccache.c */
443
444 FcGlobalCache *
445 FcGlobalCacheCreate (void);
446
447 void
448 FcGlobalCacheDestroy (FcGlobalCache *cache);
449
450 FcBool
451 FcGlobalCacheReadDir (FcFontSet *set,
452 FcStrSet *dirs,
453 FcGlobalCache *cache,
454 const char *dir,
455 FcConfig *config);
456
457 void
458 FcGlobalCacheLoad (FcGlobalCache *cache,
459 FcStrSet *staleDirs,
460 const FcChar8 *cache_file,
461 FcConfig *config);
462
463 FcBool
464 FcGlobalCacheUpdate (FcGlobalCache *cache,
465 FcStrSet *dirs,
466 const char *file,
467 FcFontSet *set,
468 FcConfig *config);
469
470 FcBool
471 FcGlobalCacheSave (FcGlobalCache *cache,
472 const FcChar8 *cache_file,
473 FcConfig *config);
474
475 FcFontSet *
476 FcCacheRead (FcConfig *config, FcGlobalCache * cache);
477
478 FcBool
479 FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir);
480
481 FcBool
482 FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
483
484 extern int *_fcBankId, *_fcBankIdx;
485 int
486 FcCacheBankToIndexMTF (int bank);
487
488 static inline int
489 FcCacheBankToIndex (int bank)
490 {
491 return (_fcBankId[*_fcBankIdx] == bank) ? *_fcBankIdx : FcCacheBankToIndexMTF(bank);
492 }
493
494 const char *
495 FcCacheFindBankDir (int bank);
496
497 /* fccfg.c */
498
499 FcBool
500 FcConfigAddConfigDir (FcConfig *config,
501 const FcChar8 *d);
502
503 FcBool
504 FcConfigAddFontDir (FcConfig *config,
505 const FcChar8 *d);
506
507 FcBool
508 FcConfigAddDir (FcConfig *config,
509 const FcChar8 *d);
510
511 FcBool
512 FcConfigAddConfigFile (FcConfig *config,
513 const FcChar8 *f);
514
515 FcBool
516 FcConfigSetCache (FcConfig *config,
517 const FcChar8 *c);
518
519 FcBool
520 FcConfigAddBlank (FcConfig *config,
521 FcChar32 blank);
522
523 FcBool
524 FcConfigAddEdit (FcConfig *config,
525 FcTest *test,
526 FcEdit *edit,
527 FcMatchKind kind);
528
529 void
530 FcConfigSetFonts (FcConfig *config,
531 FcFontSet *fonts,
532 FcSetName set);
533
534 FcBool
535 FcConfigCompareValue (const FcValue *m,
536 FcOp op,
537 const FcValue *v);
538
539 FcBool
540 FcConfigGlobAdd (FcConfig *config,
541 const FcChar8 *glob,
542 FcBool accept);
543
544 FcBool
545 FcConfigAcceptFilename (FcConfig *config,
546 const FcChar8 *filename);
547
548 FcBool
549 FcConfigPatternsAdd (FcConfig *config,
550 FcPattern *pattern,
551 FcBool accept);
552
553 FcBool
554 FcConfigAcceptFont (FcConfig *config,
555 const FcPattern *font);
556
557 FcFileTime
558 FcConfigModifiedTime (FcConfig *config);
559
560 /* fccharset.c */
561 void
562 FcLangCharSetPopulate (void);
563
564 FcCharSet *
565 FcCharSetFreeze (FcCharSet *cs);
566
567 void
568 FcCharSetThawAll (void);
569
570 FcBool
571 FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
572
573 FcCharSet *
574 FcNameParseCharSet (FcChar8 *string);
575
576 FcCharLeaf *
577 FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
578
579 void
580 FcCharSetNewBank (void);
581
582 int
583 FcCharSetNeededBytes (const FcCharSet *c);
584
585 int
586 FcCharSetNeededBytesAlign (void);
587
588 void *
589 FcCharSetDistributeBytes (FcCache * metadata,
590 void * block_ptr);
591
592 FcCharSet *
593 FcCharSetSerialize(int bank, FcCharSet *c);
594
595 void *
596 FcCharSetUnserialize (FcCache * metadata, void *block_ptr);
597
598 FcCharLeaf *
599 FcCharSetGetLeaf(const FcCharSet *c, int i);
600
601 FcChar16 *
602 FcCharSetGetNumbers(const FcCharSet *c);
603
604 /* fcdbg.c */
605 void
606 FcValueListPrint (const FcValueListPtr l);
607
608 void
609 FcLangSetPrint (const FcLangSet *ls);
610
611 void
612 FcOpPrint (FcOp op);
613
614 void
615 FcTestPrint (const FcTest *test);
616
617 void
618 FcExprPrint (const FcExpr *expr);
619
620 void
621 FcEditPrint (const FcEdit *edit);
622
623 void
624 FcSubstPrint (const FcSubst *subst);
625
626 extern int FcDebugVal;
627
628 static inline int
629 FcDebug (void) { return FcDebugVal; }
630
631 void
632 FcInitDebug (void);
633
634 /* fcdefault.c */
635 FcChar8 *
636 FcGetDefaultLang (void);
637
638 /* fcdir.c */
639
640 FcBool
641 FcFileIsDir (const FcChar8 *file);
642
643 FcBool
644 FcFileScanConfig (FcFontSet *set,
645 FcStrSet *dirs,
646 FcFileCache *cache,
647 FcBlanks *blanks,
648 const FcChar8 *file,
649 FcBool force,
650 FcConfig *config);
651
652 FcBool
653 FcDirScanConfig (FcFontSet *set,
654 FcStrSet *dirs,
655 FcFileCache *cache,
656 FcBlanks *blanks,
657 const FcChar8 *dir,
658 FcBool force,
659 FcConfig *config);
660
661 /* fcfont.c */
662 int
663 FcFontDebug (void);
664
665 /* fcfreetype.c */
666 FcBool
667 FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
668
669 FcBool
670 FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
671
672 FcChar32
673 FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
674
675 FcChar32
676 FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
677
678 const FcCharMap *
679 FcFreeTypeGetPrivateMap (FT_Encoding encoding);
680
681 /* fcfs.c */
682
683 void
684 FcFontSetNewBank (void);
685
686 int
687 FcFontSetNeededBytes (FcFontSet *s);
688
689 int
690 FcFontSetNeededBytesAlign (void);
691
692 void *
693 FcFontSetDistributeBytes (FcCache * metadata, void * block_ptr);
694
695 FcBool
696 FcFontSetSerialize (int bank, FcFontSet * s);
697
698 FcBool
699 FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr);
700
701 /* fcgram.y */
702 int
703 FcConfigparse (void);
704
705 int
706 FcConfigwrap (void);
707
708 void
709 FcConfigerror (char *fmt, ...);
710
711 char *
712 FcConfigSaveField (const char *field);
713
714 void
715 FcTestDestroy (FcTest *test);
716
717 FcExpr *
718 FcExprCreateInteger (int i);
719
720 FcExpr *
721 FcExprCreateDouble (double d);
722
723 FcExpr *
724 FcExprCreateString (const FcChar8 *s);
725
726 FcExpr *
727 FcExprCreateMatrix (const FcMatrix *m);
728
729 FcExpr *
730 FcExprCreateBool (FcBool b);
731
732 FcExpr *
733 FcExprCreateNil (void);
734
735 FcExpr *
736 FcExprCreateField (const char *field);
737
738 FcExpr *
739 FcExprCreateConst (const FcChar8 *constant);
740
741 FcExpr *
742 FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
743
744 void
745 FcExprDestroy (FcExpr *e);
746
747 void
748 FcEditDestroy (FcEdit *e);
749
750 /* fcinit.c */
751
752 void
753 FcMemReport (void);
754
755 void
756 FcMemAlloc (int kind, int size);
757
758 void
759 FcMemFree (int kind, int size);
760
761 /* fclang.c */
762 FcLangSet *
763 FcFreeTypeLangSet (const FcCharSet *charset,
764 const FcChar8 *exclusiveLang);
765
766 FcLangResult
767 FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
768
769 const FcCharSet *
770 FcCharSetForLang (const FcChar8 *lang);
771
772 FcLangSet *
773 FcLangSetPromote (const FcChar8 *lang);
774
775 FcLangSet *
776 FcNameParseLangSet (const FcChar8 *string);
777
778 FcBool
779 FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
780
781 void
782 FcLangSetNewBank (void);
783
784 int
785 FcLangSetNeededBytes (const FcLangSet *l);
786
787 int
788 FcLangSetNeededBytesAlign (void);
789
790 void *
791 FcLangSetDistributeBytes (FcCache * metadata,
792 void * block_ptr);
793
794 FcLangSet *
795 FcLangSetSerialize (int bank, FcLangSet *l);
796
797 void *
798 FcLangSetUnserialize (FcCache * metadata, void *block_ptr);
799
800 /* fclist.c */
801
802 FcBool
803 FcListPatternMatchAny (const FcPattern *p,
804 const FcPattern *font);
805
806 /* fcmatch.c */
807
808 /* fcname.c */
809
810 FcBool
811 FcNameBool (const FcChar8 *v, FcBool *result);
812
813 void *
814 FcObjectDistributeBytes (FcCache * metadata,
815 void * block_ptr);
816
817 FcObjectPtr
818 FcObjectToPtr (const char * si);
819
820 int
821 FcObjectNeededBytes (void);
822
823 int
824 FcObjectNeededBytesAlign (void);
825
826 void *
827 FcObjectUnserialize (FcCache * metadata, void *block_ptr);
828
829 void
830 FcObjectSerialize (void);
831
832 const char *
833 FcObjectPtrU (FcObjectPtr p);
834
835 static inline int
836 FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
837 {
838 return a - b;
839 }
840
841 void
842 FcObjectStaticNameFini (void);
843
844 /* fcpat.c */
845
846 FcValue
847 FcValueCanonicalize (const FcValue *v);
848
849 void
850 FcValueListDestroy (FcValueListPtr l);
851
852 FcPatternElt *
853 FcPatternFindElt (const FcPattern *p, const char *object);
854
855 FcPatternElt *
856 FcPatternInsertElt (FcPattern *p, const char *object);
857
858 FcBool
859 FcPatternAddWithBinding (FcPattern *p,
860 const char *object,
861 FcValue value,
862 FcValueBinding binding,
863 FcBool append);
864
865 FcPattern *
866 FcPatternFreeze (FcPattern *p);
867
868 void
869 FcPatternFini (void);
870
871 FcBool
872 FcPatternAppend (FcPattern *p, FcPattern *s);
873
874 void
875 FcPatternAddFullFname (const FcPattern *p, const char *fname);
876
877 void
878 FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig);
879
880 const FcChar8 *
881 FcStrStaticName (const FcChar8 *name);
882
883 FcChar32
884 FcStringHash (const FcChar8 *s);
885
886 void
887 FcPatternNewBank (void);
888
889 int
890 FcPatternNeededBytes (FcPattern *p);
891
892 int
893 FcPatternNeededBytesAlign (void);
894
895 void *
896 FcPatternDistributeBytes (FcCache * metadata, void * block_ptr);
897
898 /* please don't access these outside of fcpat.c! only visible so that
899 * *PtrU can be inlined. */
900 extern FcValueList ** _fcValueLists;
901 extern FcPatternElt ** _fcPatternElts;
902
903 static inline FcValueList *
904 FcValueListPtrU (FcValueListPtr pi)
905 {
906 if (pi.bank == FC_BANK_DYNAMIC)
907 return pi.u.dyn;
908
909 return &_fcValueLists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
910 }
911
912 static inline FcPatternElt *
913 FcPatternEltU (FcPatternEltPtr pei)
914 {
915 if (pei.bank == FC_BANK_DYNAMIC)
916 return pei.u.dyn;
917
918 return &_fcPatternElts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
919 }
920
921 FcValueListPtr
922 FcValueListPtrCreateDynamic(FcValueList * p);
923
924 FcPattern *
925 FcPatternSerialize (int bank, FcPattern * p);
926
927 void *
928 FcPatternUnserialize (FcCache * metadata, void *block_ptr);
929
930 /* fcrender.c */
931
932 /* fcmatrix.c */
933
934 extern const FcMatrix FcIdentityMatrix;
935
936 void
937 FcMatrixFree (FcMatrix *mat);
938
939 /* fcstr.c */
940 void
941 FcStrSetSort (FcStrSet * set);
942
943 FcChar8 *
944 FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
945
946 void
947 FcStrFree (FcChar8 *s);
948
949 void
950 FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
951
952 void
953 FcStrBufDestroy (FcStrBuf *buf);
954
955 FcChar8 *
956 FcStrBufDone (FcStrBuf *buf);
957
958 FcBool
959 FcStrBufChar (FcStrBuf *buf, FcChar8 c);
960
961 FcBool
962 FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
963
964 FcBool
965 FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
966
967 int
968 FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
969
970 const FcChar8 *
971 FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
972
973 const FcChar8 *
974 FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
975
976 FcBool
977 FcStrUsesHome (const FcChar8 *s);
978
979 FcChar8 *
980 FcStrLastSlash (const FcChar8 *path);
981
982 FcChar32
983 FcStrHashIgnoreCase (const FcChar8 *s);
984
985 #endif /* _FC_INT_H_ */