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