]> git.wh0rd.org - fontconfig.git/blame - src/fcint.h
Move FcConfigNormalizeFontDir call so that it doesn't result in infinite
[fontconfig.git] / src / fcint.h
CommitLineData
24330d27 1/*
793e946c 2 * $RCSId: xc/lib/fontconfig/src/fcint.h,v 1.27 2002/08/31 22:17:32 keithp Exp $
24330d27 3 *
46b51147 4 * Copyright © 2000 Keith Packard
24330d27
KP
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>
7fd7221e 30#include <stdint.h>
24330d27
KP
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>
179c3995 37#include <time.h>
24330d27
KP
38#include <fontconfig/fontconfig.h>
39#include <fontconfig/fcprivate.h>
be094850 40#include <fontconfig/fcfreetype.h>
24330d27
KP
41#ifdef HAVE_CONFIG_H
42#include <config.h>
43#endif
44
24330d27
KP
45#ifndef FC_CONFIG_PATH
46#define FC_CONFIG_PATH "fonts.conf"
47#endif
48
179c3995
KP
49#define FC_FONT_FILE_INVALID ((FcChar8 *) ".")
50#define FC_FONT_FILE_DIR ((FcChar8 *) ".dir")
c60ec7cc 51#define FC_GLOBAL_MAGIC_COOKIE "GLOBAL"
179c3995 52
daeed6e0
TL
53#ifdef _WIN32
54#define FC_SEARCH_PATH_SEPARATOR ';'
55#else
56#define FC_SEARCH_PATH_SEPARATOR ':'
57#endif
58
24330d27
KP
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
4c003605 67#define FC_DBG_SCANV 256
24330d27 68#define FC_DBG_MEMORY 512
2d9c79c0 69#define FC_DBG_CONFIG 1024
24330d27
KP
70
71#define FC_MEM_CHARSET 0
d8d73958 72#define FC_MEM_CHARLEAF 1
24330d27
KP
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
d8d73958
KP
84#define FC_MEM_STRSET 13
85#define FC_MEM_STRLIST 14
86#define FC_MEM_CONFIG 15
87#define FC_MEM_LANGSET 16
9dac3c59
KP
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
1c52c0f0 100#define FC_MEM_STATICSTR 29
d8d73958 101
1c52c0f0 102#define FC_MEM_NUM 30
24330d27 103
1c9fdcca
PL
104#define FC_BANK_DYNAMIC 0
105#define FC_BANK_FIRST 1
82f35f8b
PL
106#define FC_BANK_LANGS 0xfcfcfcfc
107
4c003605 108typedef enum _FcValueBinding {
dda7794f 109 FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
4c003605
KP
110} FcValueBinding;
111
cd2ec1a9 112typedef struct _FcValueListPtr {
4262e0b3 113 int bank;
cd2ec1a9
PL
114 union {
115 int stat;
116 struct _FcValueList *dyn;
117 } u;
118} FcValueListPtr;
119
24330d27 120typedef struct _FcValueList {
cd2ec1a9
PL
121 FcValueListPtr next;
122
24330d27 123 FcValue value;
e709ddfa 124 FcValueBinding binding;
24330d27
KP
125} FcValueList;
126
4262e0b3
PL
127typedef int FcObjectPtr;
128
cd2ec1a9 129typedef struct _FcPatternEltPtr {
4262e0b3 130 int bank;
cd2ec1a9
PL
131 union {
132 int stat;
133 struct _FcPatternElt *dyn;
134 } u;
135} FcPatternEltPtr;
136
24330d27 137typedef struct _FcPatternElt {
cd2ec1a9
PL
138 FcObjectPtr object;
139 FcValueListPtr values;
24330d27
KP
140} FcPatternElt;
141
142struct _FcPattern {
143 int num;
144 int size;
cd2ec1a9 145 FcPatternEltPtr elts;
e709ddfa 146 int ref;
4262e0b3 147 int bank;
24330d27
KP
148};
149
150typedef enum _FcOp {
151 FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet,
152 FcOpNil,
153 FcOpField, FcOpConst,
154 FcOpAssign, FcOpAssignReplace,
155 FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
156 FcOpQuest,
74a623e0
KP
157 FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual,
158 FcOpContains, FcOpListing, FcOpNotContains,
24330d27
KP
159 FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
160 FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
3f7653c2
KP
161 FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
162 FcOpInvalid
24330d27
KP
163} FcOp;
164
165typedef struct _FcExpr {
166 FcOp op;
167 union {
168 int ival;
169 double dval;
ccb3e93b 170 FcChar8 *sval;
24330d27
KP
171 FcMatrix *mval;
172 FcBool bval;
173 FcCharSet *cval;
174 char *field;
ccb3e93b 175 FcChar8 *constant;
24330d27
KP
176 struct {
177 struct _FcExpr *left, *right;
178 } tree;
179 } u;
180} FcExpr;
181
182typedef enum _FcQual {
6f6563ed 183 FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
24330d27
KP
184} FcQual;
185
938bc633
KP
186#define FcMatchDefault ((FcMatchKind) -1)
187
24330d27
KP
188typedef struct _FcTest {
189 struct _FcTest *next;
938bc633 190 FcMatchKind kind;
24330d27
KP
191 FcQual qual;
192 const char *field;
193 FcOp op;
194 FcExpr *expr;
195} FcTest;
196
197typedef struct _FcEdit {
198 struct _FcEdit *next;
199 const char *field;
200 FcOp op;
201 FcExpr *expr;
6fff2cda 202 FcValueBinding binding;
24330d27
KP
203} FcEdit;
204
205typedef struct _FcSubst {
206 struct _FcSubst *next;
207 FcTest *test;
208 FcEdit *edit;
209} FcSubst;
210
20ac65ab 211typedef struct _FcCharLeaf {
24330d27 212 FcChar32 map[256/32];
20ac65ab 213} FcCharLeaf;
24330d27 214
d8d73958 215#define FC_REF_CONSTANT -1
82f4243f 216
24330d27 217struct _FcCharSet {
24330d27 218 int ref; /* reference count */
20ac65ab 219 int num; /* size of leaves and numbers arrays */
4262e0b3 220 int bank;
cd2ec1a9
PL
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;
24330d27
KP
231};
232
179c3995
KP
233struct _FcStrSet {
234 int ref; /* reference count */
235 int num;
236 int size;
4262e0b3 237 FcChar8 **strs;
179c3995
KP
238};
239
240struct _FcStrList {
241 FcStrSet *set;
242 int n;
243};
244
c2e7c611 245typedef struct _FcStrBuf {
24330d27
KP
246 FcChar8 *buf;
247 FcBool allocated;
248 FcBool failed;
249 int len;
250 int size;
c2e7c611 251} FcStrBuf;
24330d27 252
212c9f43 253typedef struct _FcCache {
c7beacf9
PL
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 */
a9698bed
PL
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;
4262e0b3
PL
264 int charset_leaf_count;
265 int charset_leaf_idx_count;
212c9f43
PL
266} FcCache;
267
7769c321
KP
268/*
269 * To map adobe glyph names to unicode values, a precomputed hash
270 * table is used
271 */
272
273typedef struct _FcGlyphName {
274 FcChar32 ucs; /* unicode value */
275 FcChar8 name[1]; /* name extends beyond struct */
276} FcGlyphName;
277
192296d8
KP
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
302typedef 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
2d9c79c0
KP
309#define FC_MAX_FILE_LEN 4096
310
4262e0b3
PL
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)
1c9fdcca 315#define fc_storage_type(v) ((v)->type & ~FC_STORAGE_STATIC)
4262e0b3 316
327a7fd4 317/*
f21f40f3 318 * The per-user ~/.fonts.cache-<version> file is loaded into
327a7fd4
KP
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
eb0cf671 327#define FC_CACHE_MAGIC 0xFC02FC02
327a7fd4 328
e712133c
KP
329typedef struct _FcGlobalCacheDir FcGlobalCacheDir;
330
e712133c 331struct _FcGlobalCacheDir {
327a7fd4 332 struct _FcGlobalCacheDir *next;
8245771d 333 char *name;
eb0cf671
PL
334 FcCache metadata;
335 off_t offset;
336 void *ent;
e712133c 337};
327a7fd4
KP
338
339typedef struct _FcGlobalCache {
eb0cf671 340 FcGlobalCacheDir *dirs;
327a7fd4 341 FcBool updated;
eb0cf671 342 int fd;
327a7fd4 343} FcGlobalCache;
24330d27 344
134f6011
KP
345struct _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
24330d27
KP
352struct _FcBlanks {
353 int nblank;
354 int sblank;
355 FcChar32 *blanks;
356};
357
358struct _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 */
179c3995 364 FcStrSet *configDirs; /* directories to scan for fonts */
ccb3e93b 365 FcChar8 *cache; /* name of per-user cache file */
24330d27
KP
366 /*
367 * Set of allowed blank chars -- used to
368 * trim fonts of bogus glyphs
369 */
370 FcBlanks *blanks;
179c3995
KP
371 /*
372 * List of directories containing fonts,
373 * built by recursively scanning the set
374 * of configured directories
375 */
376 FcStrSet *fontDirs;
24330d27
KP
377 /*
378 * Names of all of the configuration files used
379 * to create this configuration
380 */
179c3995 381 FcStrSet *configFiles; /* config files loaded */
24330d27
KP
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 */
d47c9d6e
KP
390 /*
391 * List of patterns used to control font file selection
392 */
393 FcStrSet *acceptGlobs;
394 FcStrSet *rejectGlobs;
4f27c1c0
KP
395 FcFontSet *acceptPatterns;
396 FcFontSet *rejectPatterns;
24330d27
KP
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];
179c3995
KP
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 */
24330d27
KP
412};
413
6e9fc5de
KP
414extern FcConfig *_fcConfig;
415
2b25f00c
PL
416typedef struct _FcFileTime {
417 time_t time;
418 FcBool set;
419} FcFileTime;
420
69937bd9
KP
421typedef struct _FcCharMap FcCharMap;
422
7fd7221e
PL
423#define ALIGN(v,type) ((__typeof__(v))(((uintptr_t)(v) + __alignof__(type) - 1) & ~(__alignof__(type) - 1)))
424
24330d27
KP
425/* fcblanks.c */
426
427/* fccache.c */
428
1b7be377
PL
429FcGlobalCache *
430FcGlobalCacheCreate (void);
431
432void
433FcGlobalCacheDestroy (FcGlobalCache *cache);
434
435FcBool
eb0cf671
PL
436FcGlobalCacheReadDir (FcFontSet *set,
437 FcStrSet *dirs,
438 FcGlobalCache *cache,
8245771d 439 const char *dir,
eb0cf671 440 FcConfig *config);
1b7be377
PL
441
442void
443FcGlobalCacheLoad (FcGlobalCache *cache,
03a212e5 444 FcStrSet *staleDirs,
2b25f00c
PL
445 const FcChar8 *cache_file,
446 FcConfig *config);
1b7be377
PL
447
448FcBool
449FcGlobalCacheUpdate (FcGlobalCache *cache,
8245771d 450 const char *file,
8a0b0ed6
PL
451 FcFontSet *set,
452 FcConfig *config);
1b7be377
PL
453
454FcBool
455FcGlobalCacheSave (FcGlobalCache *cache,
8a0b0ed6
PL
456 const FcChar8 *cache_file,
457 FcConfig *config);
1b7be377 458
4262e0b3 459FcFontSet *
1b7be377 460FcCacheRead (FcConfig *config, FcGlobalCache * cache);
24330d27
KP
461
462FcBool
2304e38f 463FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir);
4262e0b3 464
2eb84374 465FcBool
cd9bca69 466FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
2eb84374 467
b8948e85 468extern int *_fcBankId, *_fcBankIdx;
4262e0b3 469int
b8948e85
PL
470FcCacheBankToIndexMTF (int bank);
471
472static __inline__ int
473FcCacheBankToIndex (int bank)
474{
19ea60bc 475 return (_fcBankId[*_fcBankIdx] == bank) ? *_fcBankIdx : FcCacheBankToIndexMTF(bank);
b8948e85 476}
e77c1718
PL
477
478const char *
479FcCacheFindBankDir (int bank);
212c9f43 480
24330d27
KP
481/* fccfg.c */
482
179c3995
KP
483FcBool
484FcConfigAddConfigDir (FcConfig *config,
485 const FcChar8 *d);
486
487FcBool
488FcConfigAddFontDir (FcConfig *config,
489 const FcChar8 *d);
490
24330d27 491FcBool
ccb3e93b
KP
492FcConfigAddDir (FcConfig *config,
493 const FcChar8 *d);
24330d27
KP
494
495FcBool
ccb3e93b
KP
496FcConfigAddConfigFile (FcConfig *config,
497 const FcChar8 *f);
24330d27
KP
498
499FcBool
500FcConfigSetCache (FcConfig *config,
ccb3e93b 501 const FcChar8 *c);
24330d27
KP
502
503FcBool
504FcConfigAddBlank (FcConfig *config,
505 FcChar32 blank);
506
507FcBool
508FcConfigAddEdit (FcConfig *config,
509 FcTest *test,
510 FcEdit *edit,
511 FcMatchKind kind);
512
513void
514FcConfigSetFonts (FcConfig *config,
515 FcFontSet *fonts,
516 FcSetName set);
517
518FcBool
4262e0b3 519FcConfigCompareValue (const FcValue *m,
24330d27 520 FcOp op,
4262e0b3 521 const FcValue *v);
24330d27 522
d47c9d6e
KP
523FcBool
524FcConfigGlobAdd (FcConfig *config,
525 const FcChar8 *glob,
526 FcBool accept);
527
528FcBool
529FcConfigAcceptFilename (FcConfig *config,
530 const FcChar8 *filename);
531
4f27c1c0
KP
532FcBool
533FcConfigPatternsAdd (FcConfig *config,
534 FcPattern *pattern,
535 FcBool accept);
536
537FcBool
538FcConfigAcceptFont (FcConfig *config,
539 const FcPattern *font);
540
2b25f00c
PL
541FcFileTime
542FcConfigModifiedTime (FcConfig *config);
543
24330d27 544/* fccharset.c */
82f35f8b
PL
545void
546FcLangCharSetPopulate (void);
547
4c003605
KP
548FcCharSet *
549FcCharSetFreeze (FcCharSet *cs);
550
34cd0514
CW
551void
552FcCharSetThawAll (void);
553
24330d27 554FcBool
c2e7c611 555FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
24330d27
KP
556
557FcCharSet *
558FcNameParseCharSet (FcChar8 *string);
559
c647f6f1
KP
560FcCharLeaf *
561FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
69937bd9 562
cd2ec1a9 563void
4262e0b3 564FcCharSetNewBank (void);
cd2ec1a9 565
4262e0b3
PL
566int
567FcCharSetNeededBytes (const FcCharSet *c);
cd2ec1a9 568
7fd7221e
PL
569int
570FcCharSetNeededBytesAlign (void);
571
4262e0b3
PL
572void *
573FcCharSetDistributeBytes (FcCache * metadata,
574 void * block_ptr);
cd2ec1a9 575
4262e0b3
PL
576FcCharSet *
577FcCharSetSerialize(int bank, FcCharSet *c);
cd2ec1a9 578
4262e0b3 579void *
61571f3f 580FcCharSetUnserialize (FcCache * metadata, void *block_ptr);
cd2ec1a9
PL
581
582FcCharLeaf *
583FcCharSetGetLeaf(const FcCharSet *c, int i);
584
585FcChar16 *
586FcCharSetGetNumbers(const FcCharSet *c);
587
24330d27 588/* fcdbg.c */
24330d27 589void
cd2ec1a9 590FcValueListPrint (const FcValueListPtr l);
24330d27 591
793e946c
KP
592void
593FcLangSetPrint (const FcLangSet *ls);
594
24330d27
KP
595void
596FcOpPrint (FcOp op);
597
598void
938bc633 599FcTestPrint (const FcTest *test);
24330d27
KP
600
601void
938bc633 602FcExprPrint (const FcExpr *expr);
24330d27
KP
603
604void
938bc633 605FcEditPrint (const FcEdit *edit);
24330d27
KP
606
607void
938bc633 608FcSubstPrint (const FcSubst *subst);
24330d27 609
b97a34b5
PL
610extern int FcDebugVal;
611
612static __inline__ int
613FcDebug (void) { return FcDebugVal; }
614
615void
616FcInitDebug (void);
24330d27 617
90442681
PL
618/* fcdefault.c */
619FcChar8 *
620FcGetDefaultLang (void);
621
24330d27 622/* fcdir.c */
24330d27 623
2d9c79c0
KP
624FcBool
625FcFileIsDir (const FcChar8 *file);
626
d47c9d6e
KP
627FcBool
628FcFileScanConfig (FcFontSet *set,
629 FcStrSet *dirs,
630 FcFileCache *cache,
631 FcBlanks *blanks,
632 const FcChar8 *file,
633 FcBool force,
634 FcConfig *config);
635
636FcBool
637FcDirScanConfig (FcFontSet *set,
638 FcStrSet *dirs,
639 FcFileCache *cache,
640 FcBlanks *blanks,
641 const FcChar8 *dir,
642 FcBool force,
643 FcConfig *config);
644
24330d27
KP
645/* fcfont.c */
646int
647FcFontDebug (void);
648
82f4243f 649/* fcfreetype.c */
e50b9ae7
KP
650FcBool
651FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
652
82f4243f
KP
653FcBool
654FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
655
c647f6f1
KP
656FcChar32
657FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
658
659FcChar32
660FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
661
662const FcCharMap *
663FcFreeTypeGetPrivateMap (FT_Encoding encoding);
664
24330d27 665/* fcfs.c */
cd2ec1a9
PL
666
667void
4262e0b3 668FcFontSetNewBank (void);
cd2ec1a9 669
4262e0b3
PL
670int
671FcFontSetNeededBytes (FcFontSet *s);
cd2ec1a9 672
7fd7221e
PL
673int
674FcFontSetNeededBytesAlign (void);
675
4262e0b3
PL
676void *
677FcFontSetDistributeBytes (FcCache * metadata, void * block_ptr);
cd2ec1a9 678
212c9f43 679FcBool
4262e0b3 680FcFontSetSerialize (int bank, FcFontSet * s);
212c9f43
PL
681
682FcBool
61571f3f 683FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr);
212c9f43 684
24330d27
KP
685/* fcgram.y */
686int
687FcConfigparse (void);
688
689int
690FcConfigwrap (void);
691
692void
693FcConfigerror (char *fmt, ...);
694
695char *
696FcConfigSaveField (const char *field);
697
24330d27
KP
698void
699FcTestDestroy (FcTest *test);
700
701FcExpr *
702FcExprCreateInteger (int i);
703
704FcExpr *
705FcExprCreateDouble (double d);
706
707FcExpr *
ccb3e93b 708FcExprCreateString (const FcChar8 *s);
24330d27
KP
709
710FcExpr *
711FcExprCreateMatrix (const FcMatrix *m);
712
713FcExpr *
714FcExprCreateBool (FcBool b);
715
716FcExpr *
717FcExprCreateNil (void);
718
719FcExpr *
720FcExprCreateField (const char *field);
721
722FcExpr *
ccb3e93b 723FcExprCreateConst (const FcChar8 *constant);
24330d27
KP
724
725FcExpr *
726FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
727
728void
729FcExprDestroy (FcExpr *e);
730
24330d27
KP
731void
732FcEditDestroy (FcEdit *e);
733
734/* fcinit.c */
735
736void
737FcMemReport (void);
738
739void
740FcMemAlloc (int kind, int size);
741
742void
743FcMemFree (int kind, int size);
744
82f4243f 745/* fclang.c */
d8d73958
KP
746FcLangSet *
747FcFreeTypeLangSet (const FcCharSet *charset,
e50b9ae7 748 const FcChar8 *exclusiveLang);
82f4243f
KP
749
750FcLangResult
751FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
752
753const FcCharSet *
754FcCharSetForLang (const FcChar8 *lang);
755
d8d73958
KP
756FcLangSet *
757FcLangSetPromote (const FcChar8 *lang);
758
759FcLangSet *
760FcNameParseLangSet (const FcChar8 *string);
761
762FcBool
763FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
764
cd2ec1a9 765void
4262e0b3 766FcLangSetNewBank (void);
cd2ec1a9 767
4262e0b3
PL
768int
769FcLangSetNeededBytes (const FcLangSet *l);
cd2ec1a9 770
7fd7221e
PL
771int
772FcLangSetNeededBytesAlign (void);
773
4262e0b3
PL
774void *
775FcLangSetDistributeBytes (FcCache * metadata,
776 void * block_ptr);
cd2ec1a9
PL
777
778FcLangSet *
4262e0b3 779FcLangSetSerialize (int bank, FcLangSet *l);
cd2ec1a9 780
4262e0b3 781void *
61571f3f 782FcLangSetUnserialize (FcCache * metadata, void *block_ptr);
212c9f43 783
24330d27
KP
784/* fclist.c */
785
4f27c1c0
KP
786FcBool
787FcListPatternMatchAny (const FcPattern *p,
788 const FcPattern *font);
789
24330d27
KP
790/* fcmatch.c */
791
792/* fcname.c */
24330d27
KP
793
794FcBool
ca60d2b5 795FcNameBool (const FcChar8 *v, FcBool *result);
24330d27 796
4262e0b3
PL
797void *
798FcObjectDistributeBytes (FcCache * metadata,
799 void * block_ptr);
800
801FcObjectPtr
802FcObjectToPtr (const char * si);
803
804int
7f37423d
PL
805FcObjectNeededBytes (void);
806
7fd7221e
PL
807int
808FcObjectNeededBytesAlign (void);
809
7f37423d 810void *
61571f3f 811FcObjectUnserialize (FcCache * metadata, void *block_ptr);
4262e0b3
PL
812
813void
7f37423d 814FcObjectSerialize (void);
4262e0b3 815
7f37423d
PL
816const char *
817FcObjectPtrU (FcObjectPtr p);
818
9ab79bdf
PL
819static __inline__ int
820FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
821{
822 return a - b;
823}
7f37423d
PL
824
825void
826FcObjectStaticNameFini (void);
4262e0b3 827
24330d27 828/* fcpat.c */
4262e0b3
PL
829
830FcValue
831FcValueCanonicalize (const FcValue *v);
832
24330d27 833void
cd2ec1a9
PL
834FcValueListDestroy (FcValueListPtr l);
835
24330d27 836FcPatternElt *
e9be9cd1
KP
837FcPatternFindElt (const FcPattern *p, const char *object);
838
839FcPatternElt *
840FcPatternInsertElt (FcPattern *p, const char *object);
24330d27 841
82f4243f
KP
842FcBool
843FcPatternAddWithBinding (FcPattern *p,
844 const char *object,
845 FcValue value,
846 FcValueBinding binding,
847 FcBool append);
848
d8d73958
KP
849FcPattern *
850FcPatternFreeze (FcPattern *p);
851
34cd0514 852void
e1b9d091 853FcPatternFini (void);
34cd0514 854
4f27c1c0
KP
855FcBool
856FcPatternAppend (FcPattern *p, FcPattern *s);
857
e77c1718
PL
858void
859FcPatternAddFullFname (const FcPattern *p, const char *fname);
860
793154ed
PL
861void
862FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig);
e77c1718 863
8245771d
PL
864const FcChar8 *
865FcStrStaticName (const FcChar8 *name);
cd2ec1a9 866
7f37423d
PL
867FcChar32
868FcStringHash (const FcChar8 *s);
cd2ec1a9 869
cd2ec1a9 870void
4262e0b3 871FcPatternNewBank (void);
cd2ec1a9 872
4262e0b3
PL
873int
874FcPatternNeededBytes (FcPattern *p);
cd2ec1a9 875
7fd7221e
PL
876int
877FcPatternNeededBytesAlign (void);
878
4262e0b3
PL
879void *
880FcPatternDistributeBytes (FcCache * metadata, void * block_ptr);
cd2ec1a9 881
9ab79bdf
PL
882/* please don't access these outside of fcpat.c! only visible so that
883 * *PtrU can be inlined. */
81fe99fd
PL
884extern FcValueList ** _fcValueLists;
885extern FcPatternElt ** _fcPatternElts;
9ab79bdf
PL
886
887static __inline__ FcValueList *
888FcValueListPtrU (FcValueListPtr pi)
889{
890 if (pi.bank == FC_BANK_DYNAMIC)
891 return pi.u.dyn;
892
81fe99fd 893 return &_fcValueLists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
9ab79bdf
PL
894}
895
896static __inline__ FcPatternElt *
897FcPatternEltU (FcPatternEltPtr pei)
898{
899 if (pei.bank == FC_BANK_DYNAMIC)
900 return pei.u.dyn;
901
81fe99fd 902 return &_fcPatternElts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
9ab79bdf 903}
cd2ec1a9
PL
904
905FcPatternElt *
906FcPatternEltU (FcPatternEltPtr pei);
907
908FcValueListPtr
909FcValueListPtrCreateDynamic(FcValueList * p);
910
cd2ec1a9 911FcPattern *
4262e0b3 912FcPatternSerialize (int bank, FcPattern * p);
212c9f43 913
7f37423d 914void *
61571f3f 915FcPatternUnserialize (FcCache * metadata, void *block_ptr);
212c9f43 916
24330d27
KP
917/* fcrender.c */
918
919/* fcmatrix.c */
327a7fd4 920
4262e0b3 921extern const FcMatrix FcIdentityMatrix;
327a7fd4 922
24330d27
KP
923void
924FcMatrixFree (FcMatrix *mat);
925
926/* fcstr.c */
cd2ec1a9
PL
927void
928FcStrSetSort (FcStrSet * set);
929
ccb3e93b
KP
930FcChar8 *
931FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
24330d27
KP
932
933void
ccb3e93b 934FcStrFree (FcChar8 *s);
24330d27 935
c2e7c611
KP
936void
937FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
938
939void
940FcStrBufDestroy (FcStrBuf *buf);
941
942FcChar8 *
943FcStrBufDone (FcStrBuf *buf);
944
945FcBool
946FcStrBufChar (FcStrBuf *buf, FcChar8 c);
947
948FcBool
949FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
950
951FcBool
952FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
953
82f4243f
KP
954int
955FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
956
11fec41c
KP
957const FcChar8 *
958FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
959
960const FcChar8 *
961FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
962
ff3f1f98
KP
963FcBool
964FcStrUsesHome (const FcChar8 *s);
965
daeed6e0
TL
966FcChar8 *
967FcStrLastSlash (const FcChar8 *path);
968
192296d8
KP
969FcChar32
970FcStrHashIgnoreCase (const FcChar8 *s);
971
24330d27 972#endif /* _FC_INT_H_ */