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