]> git.wh0rd.org - fontconfig.git/blame - src/fcint.h
Patrick Lam <plam@mit.edu>
[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>
dc70c15a
PL
30#ifdef HAVE_INTTYPES_H
31#include <inttypes.h>
32#else
7fd7221e 33#include <stdint.h>
dc70c15a 34#endif
24330d27
KP
35#include <string.h>
36#include <ctype.h>
37#include <errno.h>
38#include <unistd.h>
39#include <sys/types.h>
40#include <sys/stat.h>
179c3995 41#include <time.h>
24330d27
KP
42#include <fontconfig/fontconfig.h>
43#include <fontconfig/fcprivate.h>
be094850 44#include <fontconfig/fcfreetype.h>
24330d27
KP
45#ifdef HAVE_CONFIG_H
46#include <config.h>
47#endif
48
24330d27
KP
49#ifndef FC_CONFIG_PATH
50#define FC_CONFIG_PATH "fonts.conf"
51#endif
52
179c3995
KP
53#define FC_FONT_FILE_INVALID ((FcChar8 *) ".")
54#define FC_FONT_FILE_DIR ((FcChar8 *) ".dir")
c60ec7cc 55#define FC_GLOBAL_MAGIC_COOKIE "GLOBAL"
179c3995 56
daeed6e0
TL
57#ifdef _WIN32
58#define FC_SEARCH_PATH_SEPARATOR ';'
59#else
60#define FC_SEARCH_PATH_SEPARATOR ':'
61#endif
62
24330d27
KP
63#define FC_DBG_MATCH 1
64#define FC_DBG_MATCHV 2
65#define FC_DBG_EDIT 4
66#define FC_DBG_FONTSET 8
67#define FC_DBG_CACHE 16
68#define FC_DBG_CACHEV 32
69#define FC_DBG_PARSE 64
70#define FC_DBG_SCAN 128
4c003605 71#define FC_DBG_SCANV 256
24330d27 72#define FC_DBG_MEMORY 512
2d9c79c0 73#define FC_DBG_CONFIG 1024
24330d27
KP
74
75#define FC_MEM_CHARSET 0
d8d73958 76#define FC_MEM_CHARLEAF 1
24330d27
KP
77#define FC_MEM_FONTSET 2
78#define FC_MEM_FONTPTR 3
79#define FC_MEM_OBJECTSET 4
80#define FC_MEM_OBJECTPTR 5
81#define FC_MEM_MATRIX 6
82#define FC_MEM_PATTERN 7
83#define FC_MEM_PATELT 8
84#define FC_MEM_VALLIST 9
85#define FC_MEM_SUBSTATE 10
86#define FC_MEM_STRING 11
87#define FC_MEM_LISTBUCK 12
d8d73958
KP
88#define FC_MEM_STRSET 13
89#define FC_MEM_STRLIST 14
90#define FC_MEM_CONFIG 15
91#define FC_MEM_LANGSET 16
9dac3c59
KP
92#define FC_MEM_ATOMIC 17
93#define FC_MEM_BLANKS 18
94#define FC_MEM_CACHE 19
95#define FC_MEM_STRBUF 20
96#define FC_MEM_SUBST 21
97#define FC_MEM_OBJECTTYPE 22
98#define FC_MEM_CONSTANT 23
99#define FC_MEM_TEST 24
100#define FC_MEM_EXPR 25
101#define FC_MEM_VSTACK 26
102#define FC_MEM_ATTR 27
103#define FC_MEM_PSTACK 28
1c52c0f0 104#define FC_MEM_STATICSTR 29
d8d73958 105
1c52c0f0 106#define FC_MEM_NUM 30
24330d27 107
1c9fdcca
PL
108#define FC_BANK_DYNAMIC 0
109#define FC_BANK_FIRST 1
82f35f8b
PL
110#define FC_BANK_LANGS 0xfcfcfcfc
111
4c003605 112typedef enum _FcValueBinding {
dda7794f 113 FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
4c003605
KP
114} FcValueBinding;
115
cd2ec1a9 116typedef struct _FcValueListPtr {
4262e0b3 117 int bank;
cd2ec1a9
PL
118 union {
119 int stat;
120 struct _FcValueList *dyn;
121 } u;
122} FcValueListPtr;
123
24330d27 124typedef struct _FcValueList {
cd2ec1a9
PL
125 FcValueListPtr next;
126
24330d27 127 FcValue value;
e709ddfa 128 FcValueBinding binding;
24330d27
KP
129} FcValueList;
130
4262e0b3
PL
131typedef int FcObjectPtr;
132
cd2ec1a9 133typedef struct _FcPatternEltPtr {
4262e0b3 134 int bank;
cd2ec1a9
PL
135 union {
136 int stat;
137 struct _FcPatternElt *dyn;
138 } u;
139} FcPatternEltPtr;
140
24330d27 141typedef struct _FcPatternElt {
cd2ec1a9
PL
142 FcObjectPtr object;
143 FcValueListPtr values;
24330d27
KP
144} FcPatternElt;
145
146struct _FcPattern {
147 int num;
148 int size;
cd2ec1a9 149 FcPatternEltPtr elts;
e709ddfa 150 int ref;
4262e0b3 151 int bank;
24330d27
KP
152};
153
154typedef enum _FcOp {
155 FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet,
156 FcOpNil,
157 FcOpField, FcOpConst,
158 FcOpAssign, FcOpAssignReplace,
159 FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
160 FcOpQuest,
74a623e0
KP
161 FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual,
162 FcOpContains, FcOpListing, FcOpNotContains,
24330d27
KP
163 FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
164 FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
3f7653c2
KP
165 FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
166 FcOpInvalid
24330d27
KP
167} FcOp;
168
169typedef struct _FcExpr {
170 FcOp op;
171 union {
172 int ival;
173 double dval;
ccb3e93b 174 FcChar8 *sval;
24330d27
KP
175 FcMatrix *mval;
176 FcBool bval;
177 FcCharSet *cval;
178 char *field;
ccb3e93b 179 FcChar8 *constant;
24330d27
KP
180 struct {
181 struct _FcExpr *left, *right;
182 } tree;
183 } u;
184} FcExpr;
185
186typedef enum _FcQual {
6f6563ed 187 FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
24330d27
KP
188} FcQual;
189
938bc633
KP
190#define FcMatchDefault ((FcMatchKind) -1)
191
24330d27
KP
192typedef struct _FcTest {
193 struct _FcTest *next;
938bc633 194 FcMatchKind kind;
24330d27
KP
195 FcQual qual;
196 const char *field;
197 FcOp op;
198 FcExpr *expr;
199} FcTest;
200
201typedef struct _FcEdit {
202 struct _FcEdit *next;
203 const char *field;
204 FcOp op;
205 FcExpr *expr;
6fff2cda 206 FcValueBinding binding;
24330d27
KP
207} FcEdit;
208
209typedef struct _FcSubst {
210 struct _FcSubst *next;
211 FcTest *test;
212 FcEdit *edit;
213} FcSubst;
214
20ac65ab 215typedef struct _FcCharLeaf {
24330d27 216 FcChar32 map[256/32];
20ac65ab 217} FcCharLeaf;
24330d27 218
d8d73958 219#define FC_REF_CONSTANT -1
82f4243f 220
24330d27 221struct _FcCharSet {
24330d27 222 int ref; /* reference count */
20ac65ab 223 int num; /* size of leaves and numbers arrays */
4262e0b3 224 int bank;
cd2ec1a9
PL
225 union {
226 struct {
227 FcCharLeaf **leaves;
228 FcChar16 *numbers;
229 } dyn;
230 struct {
231 int leafidx_offset;
232 int numbers_offset;
233 } stat;
234 } u;
24330d27
KP
235};
236
179c3995
KP
237struct _FcStrSet {
238 int ref; /* reference count */
239 int num;
240 int size;
4262e0b3 241 FcChar8 **strs;
179c3995
KP
242};
243
244struct _FcStrList {
245 FcStrSet *set;
246 int n;
247};
248
c2e7c611 249typedef struct _FcStrBuf {
24330d27
KP
250 FcChar8 *buf;
251 FcBool allocated;
252 FcBool failed;
253 int len;
254 int size;
c2e7c611 255} FcStrBuf;
24330d27 256
212c9f43 257typedef struct _FcCache {
31081737 258 int magic; /* FC_CACHE_MAGIC */
c7beacf9
PL
259 int count; /* number of bytes of data in block */
260 int bank; /* bank ID */
261 int pattern_count; /* number of FcPatterns */
262 int patternelt_count; /* number of FcPatternElts */
263 int valuelist_count; /* number of FcValueLists */
a9698bed
PL
264 int str_count; /* size of strings appearing as FcValues */
265 int langset_count; /* number of FcLangSets */
266 int charset_count; /* number of FcCharSets */
267 int charset_numbers_count;
4262e0b3
PL
268 int charset_leaf_count;
269 int charset_leaf_idx_count;
212c9f43
PL
270} FcCache;
271
7769c321
KP
272/*
273 * To map adobe glyph names to unicode values, a precomputed hash
274 * table is used
275 */
276
277typedef struct _FcGlyphName {
278 FcChar32 ucs; /* unicode value */
279 FcChar8 name[1]; /* name extends beyond struct */
280} FcGlyphName;
281
192296d8
KP
282/*
283 * To perform case-insensitive string comparisons, a table
284 * is used which holds three different kinds of folding data.
285 *
286 * The first is a range of upper case values mapping to a range
287 * of their lower case equivalents. Within each range, the offset
288 * between upper and lower case is constant.
289 *
290 * The second is a range of upper case values which are interleaved
291 * with their lower case equivalents.
292 *
293 * The third is a set of raw unicode values mapping to a list
294 * of unicode values for comparison purposes. This allows conversion
295 * of ß to "ss" so that SS, ss and ß all match. A separate array
296 * holds the list of unicode values for each entry.
297 *
298 * These are packed into a single table. Using a binary search,
299 * the appropriate entry can be located.
300 */
301
302#define FC_CASE_FOLD_RANGE 0
303#define FC_CASE_FOLD_EVEN_ODD 1
304#define FC_CASE_FOLD_FULL 2
305
306typedef struct _FcCaseFold {
307 FcChar32 upper;
308 FcChar16 method : 2;
309 FcChar16 count : 14;
310 short offset; /* lower - upper for RANGE, table id for FULL */
311} FcCaseFold;
312
2d9c79c0
KP
313#define FC_MAX_FILE_LEN 4096
314
4262e0b3
PL
315#define FC_STORAGE_STATIC 0x80
316#define fc_value_string(v) (((v)->type & FC_STORAGE_STATIC) ? ((FcChar8 *) v) + (v)->u.s_off : (v) -> u.s)
317#define fc_value_charset(v) (((v)->type & FC_STORAGE_STATIC) ? (const FcCharSet *)(((char *) v) + (v)->u.c_off) : (v) -> u.c)
318#define fc_value_langset(v) (((v)->type & FC_STORAGE_STATIC) ? (const FcLangSet *)(((char *) v) + (v)->u.l_off) : (v) -> u.l)
1c9fdcca 319#define fc_storage_type(v) ((v)->type & ~FC_STORAGE_STATIC)
4262e0b3 320
327a7fd4 321/*
f21f40f3 322 * The per-user ~/.fonts.cache-<version> file is loaded into
327a7fd4
KP
323 * this data structure. Each directory gets a substructure
324 * which is validated by comparing the directory timestamp with
325 * that saved in the cache. When valid, the entire directory cache
326 * can be immediately loaded without reading the directory. Otherwise,
327 * the files are checked individually; updated files are loaded into the
328 * cache which is then rewritten to the users home directory
329 */
330
31081737 331#define FC_CACHE_MAGIC 0xFC02FC03
327a7fd4 332
e712133c
KP
333typedef struct _FcGlobalCacheDir FcGlobalCacheDir;
334
fff5a5af
PL
335enum FcGCDirState {
336 FcGCDirDisabled, FcGCDirFileRead, FcGCDirConsumed, FcGCDirUpdated
337};
e712133c 338struct _FcGlobalCacheDir {
327a7fd4 339 struct _FcGlobalCacheDir *next;
8245771d 340 char *name;
eb0cf671
PL
341 FcCache metadata;
342 off_t offset;
971cf180 343 FcStrSet *subdirs;
eb0cf671 344 void *ent;
fff5a5af 345 enum FcGCDirState state;
e712133c 346};
327a7fd4
KP
347
348typedef struct _FcGlobalCache {
eb0cf671 349 FcGlobalCacheDir *dirs;
327a7fd4 350 FcBool updated;
eb0cf671 351 int fd;
327a7fd4 352} FcGlobalCache;
24330d27 353
134f6011
KP
354struct _FcAtomic {
355 FcChar8 *file; /* original file name */
356 FcChar8 *new; /* temp file name -- write data here */
357 FcChar8 *lck; /* lockfile name (used for locking) */
358 FcChar8 *tmp; /* tmpfile name (used for locking) */
359};
360
24330d27
KP
361struct _FcBlanks {
362 int nblank;
363 int sblank;
364 FcChar32 *blanks;
365};
366
367struct _FcConfig {
368 /*
369 * File names loaded from the configuration -- saved here as the
370 * cache file must be consulted before the directories are scanned,
371 * and those directives may occur in any order
372 */
179c3995 373 FcStrSet *configDirs; /* directories to scan for fonts */
ccb3e93b 374 FcChar8 *cache; /* name of per-user cache file */
24330d27
KP
375 /*
376 * Set of allowed blank chars -- used to
377 * trim fonts of bogus glyphs
378 */
379 FcBlanks *blanks;
179c3995
KP
380 /*
381 * List of directories containing fonts,
382 * built by recursively scanning the set
383 * of configured directories
384 */
385 FcStrSet *fontDirs;
24330d27
KP
386 /*
387 * Names of all of the configuration files used
388 * to create this configuration
389 */
179c3995 390 FcStrSet *configFiles; /* config files loaded */
24330d27
KP
391 /*
392 * Substitution instructions for patterns and fonts;
393 * maxObjects is used to allocate appropriate intermediate storage
394 * while performing a whole set of substitutions
395 */
396 FcSubst *substPattern; /* substitutions for patterns */
397 FcSubst *substFont; /* substitutions for fonts */
398 int maxObjects; /* maximum number of tests in all substs */
d47c9d6e
KP
399 /*
400 * List of patterns used to control font file selection
401 */
402 FcStrSet *acceptGlobs;
403 FcStrSet *rejectGlobs;
4f27c1c0
KP
404 FcFontSet *acceptPatterns;
405 FcFontSet *rejectPatterns;
24330d27
KP
406 /*
407 * The set of fonts loaded from the listed directories; the
408 * order within the set does not determine the font selection,
409 * except in the case of identical matches in which case earlier fonts
410 * match preferrentially
411 */
412 FcFontSet *fonts[FcSetApplication + 1];
179c3995
KP
413 /*
414 * Fontconfig can periodically rescan the system configuration
415 * and font directories. This rescanning occurs when font
416 * listing requests are made, but no more often than rescanInterval
417 * seconds apart.
418 */
419 time_t rescanTime; /* last time information was scanned */
420 int rescanInterval; /* interval between scans */
24330d27
KP
421};
422
6e9fc5de
KP
423extern FcConfig *_fcConfig;
424
2b25f00c
PL
425typedef struct _FcFileTime {
426 time_t time;
427 FcBool set;
428} FcFileTime;
429
69937bd9
KP
430typedef struct _FcCharMap FcCharMap;
431
7fd7221e
PL
432#define ALIGN(v,type) ((__typeof__(v))(((uintptr_t)(v) + __alignof__(type) - 1) & ~(__alignof__(type) - 1)))
433
24330d27
KP
434/* fcblanks.c */
435
436/* fccache.c */
437
1b7be377
PL
438FcGlobalCache *
439FcGlobalCacheCreate (void);
440
441void
442FcGlobalCacheDestroy (FcGlobalCache *cache);
443
444FcBool
eb0cf671
PL
445FcGlobalCacheReadDir (FcFontSet *set,
446 FcStrSet *dirs,
447 FcGlobalCache *cache,
8245771d 448 const char *dir,
eb0cf671 449 FcConfig *config);
1b7be377
PL
450
451void
452FcGlobalCacheLoad (FcGlobalCache *cache,
03a212e5 453 FcStrSet *staleDirs,
2b25f00c
PL
454 const FcChar8 *cache_file,
455 FcConfig *config);
1b7be377
PL
456
457FcBool
458FcGlobalCacheUpdate (FcGlobalCache *cache,
971cf180 459 FcStrSet *dirs,
8245771d 460 const char *file,
8a0b0ed6
PL
461 FcFontSet *set,
462 FcConfig *config);
1b7be377
PL
463
464FcBool
465FcGlobalCacheSave (FcGlobalCache *cache,
8a0b0ed6
PL
466 const FcChar8 *cache_file,
467 FcConfig *config);
1b7be377 468
4262e0b3 469FcFontSet *
1b7be377 470FcCacheRead (FcConfig *config, FcGlobalCache * cache);
24330d27
KP
471
472FcBool
2304e38f 473FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir);
4262e0b3 474
2eb84374 475FcBool
cd9bca69 476FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config);
2eb84374 477
b8948e85 478extern int *_fcBankId, *_fcBankIdx;
4262e0b3 479int
b8948e85
PL
480FcCacheBankToIndexMTF (int bank);
481
482static __inline__ int
483FcCacheBankToIndex (int bank)
484{
19ea60bc 485 return (_fcBankId[*_fcBankIdx] == bank) ? *_fcBankIdx : FcCacheBankToIndexMTF(bank);
b8948e85 486}
e77c1718
PL
487
488const char *
489FcCacheFindBankDir (int bank);
212c9f43 490
24330d27
KP
491/* fccfg.c */
492
179c3995
KP
493FcBool
494FcConfigAddConfigDir (FcConfig *config,
495 const FcChar8 *d);
496
497FcBool
498FcConfigAddFontDir (FcConfig *config,
499 const FcChar8 *d);
500
24330d27 501FcBool
ccb3e93b
KP
502FcConfigAddDir (FcConfig *config,
503 const FcChar8 *d);
24330d27
KP
504
505FcBool
ccb3e93b
KP
506FcConfigAddConfigFile (FcConfig *config,
507 const FcChar8 *f);
24330d27
KP
508
509FcBool
510FcConfigSetCache (FcConfig *config,
ccb3e93b 511 const FcChar8 *c);
24330d27
KP
512
513FcBool
514FcConfigAddBlank (FcConfig *config,
515 FcChar32 blank);
516
517FcBool
518FcConfigAddEdit (FcConfig *config,
519 FcTest *test,
520 FcEdit *edit,
521 FcMatchKind kind);
522
523void
524FcConfigSetFonts (FcConfig *config,
525 FcFontSet *fonts,
526 FcSetName set);
527
528FcBool
4262e0b3 529FcConfigCompareValue (const FcValue *m,
24330d27 530 FcOp op,
4262e0b3 531 const FcValue *v);
24330d27 532
d47c9d6e
KP
533FcBool
534FcConfigGlobAdd (FcConfig *config,
535 const FcChar8 *glob,
536 FcBool accept);
537
538FcBool
539FcConfigAcceptFilename (FcConfig *config,
540 const FcChar8 *filename);
541
4f27c1c0
KP
542FcBool
543FcConfigPatternsAdd (FcConfig *config,
544 FcPattern *pattern,
545 FcBool accept);
546
547FcBool
548FcConfigAcceptFont (FcConfig *config,
549 const FcPattern *font);
550
2b25f00c
PL
551FcFileTime
552FcConfigModifiedTime (FcConfig *config);
553
24330d27 554/* fccharset.c */
82f35f8b
PL
555void
556FcLangCharSetPopulate (void);
557
4c003605
KP
558FcCharSet *
559FcCharSetFreeze (FcCharSet *cs);
560
34cd0514
CW
561void
562FcCharSetThawAll (void);
563
24330d27 564FcBool
c2e7c611 565FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
24330d27
KP
566
567FcCharSet *
568FcNameParseCharSet (FcChar8 *string);
569
c647f6f1
KP
570FcCharLeaf *
571FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
69937bd9 572
cd2ec1a9 573void
4262e0b3 574FcCharSetNewBank (void);
cd2ec1a9 575
4262e0b3
PL
576int
577FcCharSetNeededBytes (const FcCharSet *c);
cd2ec1a9 578
7fd7221e
PL
579int
580FcCharSetNeededBytesAlign (void);
581
4262e0b3
PL
582void *
583FcCharSetDistributeBytes (FcCache * metadata,
584 void * block_ptr);
cd2ec1a9 585
4262e0b3
PL
586FcCharSet *
587FcCharSetSerialize(int bank, FcCharSet *c);
cd2ec1a9 588
4262e0b3 589void *
61571f3f 590FcCharSetUnserialize (FcCache * metadata, void *block_ptr);
cd2ec1a9
PL
591
592FcCharLeaf *
593FcCharSetGetLeaf(const FcCharSet *c, int i);
594
595FcChar16 *
596FcCharSetGetNumbers(const FcCharSet *c);
597
24330d27 598/* fcdbg.c */
24330d27 599void
cd2ec1a9 600FcValueListPrint (const FcValueListPtr l);
24330d27 601
793e946c
KP
602void
603FcLangSetPrint (const FcLangSet *ls);
604
24330d27
KP
605void
606FcOpPrint (FcOp op);
607
608void
938bc633 609FcTestPrint (const FcTest *test);
24330d27
KP
610
611void
938bc633 612FcExprPrint (const FcExpr *expr);
24330d27
KP
613
614void
938bc633 615FcEditPrint (const FcEdit *edit);
24330d27
KP
616
617void
938bc633 618FcSubstPrint (const FcSubst *subst);
24330d27 619
b97a34b5
PL
620extern int FcDebugVal;
621
622static __inline__ int
623FcDebug (void) { return FcDebugVal; }
624
625void
626FcInitDebug (void);
24330d27 627
90442681
PL
628/* fcdefault.c */
629FcChar8 *
630FcGetDefaultLang (void);
631
24330d27 632/* fcdir.c */
24330d27 633
2d9c79c0
KP
634FcBool
635FcFileIsDir (const FcChar8 *file);
636
d47c9d6e
KP
637FcBool
638FcFileScanConfig (FcFontSet *set,
639 FcStrSet *dirs,
640 FcFileCache *cache,
641 FcBlanks *blanks,
642 const FcChar8 *file,
643 FcBool force,
644 FcConfig *config);
645
646FcBool
647FcDirScanConfig (FcFontSet *set,
648 FcStrSet *dirs,
649 FcFileCache *cache,
650 FcBlanks *blanks,
651 const FcChar8 *dir,
652 FcBool force,
653 FcConfig *config);
654
24330d27
KP
655/* fcfont.c */
656int
657FcFontDebug (void);
658
82f4243f 659/* fcfreetype.c */
e50b9ae7
KP
660FcBool
661FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
662
82f4243f
KP
663FcBool
664FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
665
c647f6f1
KP
666FcChar32
667FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
668
669FcChar32
670FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
671
672const FcCharMap *
673FcFreeTypeGetPrivateMap (FT_Encoding encoding);
674
24330d27 675/* fcfs.c */
cd2ec1a9
PL
676
677void
4262e0b3 678FcFontSetNewBank (void);
cd2ec1a9 679
4262e0b3
PL
680int
681FcFontSetNeededBytes (FcFontSet *s);
cd2ec1a9 682
7fd7221e
PL
683int
684FcFontSetNeededBytesAlign (void);
685
4262e0b3
PL
686void *
687FcFontSetDistributeBytes (FcCache * metadata, void * block_ptr);
cd2ec1a9 688
212c9f43 689FcBool
4262e0b3 690FcFontSetSerialize (int bank, FcFontSet * s);
212c9f43
PL
691
692FcBool
61571f3f 693FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr);
212c9f43 694
24330d27
KP
695/* fcgram.y */
696int
697FcConfigparse (void);
698
699int
700FcConfigwrap (void);
701
702void
703FcConfigerror (char *fmt, ...);
704
705char *
706FcConfigSaveField (const char *field);
707
24330d27
KP
708void
709FcTestDestroy (FcTest *test);
710
711FcExpr *
712FcExprCreateInteger (int i);
713
714FcExpr *
715FcExprCreateDouble (double d);
716
717FcExpr *
ccb3e93b 718FcExprCreateString (const FcChar8 *s);
24330d27
KP
719
720FcExpr *
721FcExprCreateMatrix (const FcMatrix *m);
722
723FcExpr *
724FcExprCreateBool (FcBool b);
725
726FcExpr *
727FcExprCreateNil (void);
728
729FcExpr *
730FcExprCreateField (const char *field);
731
732FcExpr *
ccb3e93b 733FcExprCreateConst (const FcChar8 *constant);
24330d27
KP
734
735FcExpr *
736FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
737
738void
739FcExprDestroy (FcExpr *e);
740
24330d27
KP
741void
742FcEditDestroy (FcEdit *e);
743
744/* fcinit.c */
745
746void
747FcMemReport (void);
748
749void
750FcMemAlloc (int kind, int size);
751
752void
753FcMemFree (int kind, int size);
754
82f4243f 755/* fclang.c */
d8d73958
KP
756FcLangSet *
757FcFreeTypeLangSet (const FcCharSet *charset,
e50b9ae7 758 const FcChar8 *exclusiveLang);
82f4243f
KP
759
760FcLangResult
761FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
762
763const FcCharSet *
764FcCharSetForLang (const FcChar8 *lang);
765
d8d73958
KP
766FcLangSet *
767FcLangSetPromote (const FcChar8 *lang);
768
769FcLangSet *
770FcNameParseLangSet (const FcChar8 *string);
771
772FcBool
773FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
774
cd2ec1a9 775void
4262e0b3 776FcLangSetNewBank (void);
cd2ec1a9 777
4262e0b3
PL
778int
779FcLangSetNeededBytes (const FcLangSet *l);
cd2ec1a9 780
7fd7221e
PL
781int
782FcLangSetNeededBytesAlign (void);
783
4262e0b3
PL
784void *
785FcLangSetDistributeBytes (FcCache * metadata,
786 void * block_ptr);
cd2ec1a9
PL
787
788FcLangSet *
4262e0b3 789FcLangSetSerialize (int bank, FcLangSet *l);
cd2ec1a9 790
4262e0b3 791void *
61571f3f 792FcLangSetUnserialize (FcCache * metadata, void *block_ptr);
212c9f43 793
24330d27
KP
794/* fclist.c */
795
4f27c1c0
KP
796FcBool
797FcListPatternMatchAny (const FcPattern *p,
798 const FcPattern *font);
799
24330d27
KP
800/* fcmatch.c */
801
802/* fcname.c */
24330d27
KP
803
804FcBool
ca60d2b5 805FcNameBool (const FcChar8 *v, FcBool *result);
24330d27 806
4262e0b3
PL
807void *
808FcObjectDistributeBytes (FcCache * metadata,
809 void * block_ptr);
810
811FcObjectPtr
812FcObjectToPtr (const char * si);
813
814int
7f37423d
PL
815FcObjectNeededBytes (void);
816
7fd7221e
PL
817int
818FcObjectNeededBytesAlign (void);
819
7f37423d 820void *
61571f3f 821FcObjectUnserialize (FcCache * metadata, void *block_ptr);
4262e0b3
PL
822
823void
7f37423d 824FcObjectSerialize (void);
4262e0b3 825
7f37423d
PL
826const char *
827FcObjectPtrU (FcObjectPtr p);
828
9ab79bdf
PL
829static __inline__ int
830FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
831{
832 return a - b;
833}
7f37423d
PL
834
835void
836FcObjectStaticNameFini (void);
4262e0b3 837
24330d27 838/* fcpat.c */
4262e0b3
PL
839
840FcValue
841FcValueCanonicalize (const FcValue *v);
842
24330d27 843void
cd2ec1a9
PL
844FcValueListDestroy (FcValueListPtr l);
845
24330d27 846FcPatternElt *
e9be9cd1
KP
847FcPatternFindElt (const FcPattern *p, const char *object);
848
849FcPatternElt *
850FcPatternInsertElt (FcPattern *p, const char *object);
24330d27 851
82f4243f
KP
852FcBool
853FcPatternAddWithBinding (FcPattern *p,
854 const char *object,
855 FcValue value,
856 FcValueBinding binding,
857 FcBool append);
858
d8d73958
KP
859FcPattern *
860FcPatternFreeze (FcPattern *p);
861
34cd0514 862void
e1b9d091 863FcPatternFini (void);
34cd0514 864
4f27c1c0
KP
865FcBool
866FcPatternAppend (FcPattern *p, FcPattern *s);
867
e77c1718
PL
868void
869FcPatternAddFullFname (const FcPattern *p, const char *fname);
870
793154ed
PL
871void
872FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig);
e77c1718 873
8245771d
PL
874const FcChar8 *
875FcStrStaticName (const FcChar8 *name);
cd2ec1a9 876
7f37423d
PL
877FcChar32
878FcStringHash (const FcChar8 *s);
cd2ec1a9 879
cd2ec1a9 880void
4262e0b3 881FcPatternNewBank (void);
cd2ec1a9 882
4262e0b3
PL
883int
884FcPatternNeededBytes (FcPattern *p);
cd2ec1a9 885
7fd7221e
PL
886int
887FcPatternNeededBytesAlign (void);
888
4262e0b3
PL
889void *
890FcPatternDistributeBytes (FcCache * metadata, void * block_ptr);
cd2ec1a9 891
9ab79bdf
PL
892/* please don't access these outside of fcpat.c! only visible so that
893 * *PtrU can be inlined. */
81fe99fd
PL
894extern FcValueList ** _fcValueLists;
895extern FcPatternElt ** _fcPatternElts;
9ab79bdf
PL
896
897static __inline__ FcValueList *
898FcValueListPtrU (FcValueListPtr pi)
899{
900 if (pi.bank == FC_BANK_DYNAMIC)
901 return pi.u.dyn;
902
81fe99fd 903 return &_fcValueLists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
9ab79bdf
PL
904}
905
906static __inline__ FcPatternElt *
907FcPatternEltU (FcPatternEltPtr pei)
908{
909 if (pei.bank == FC_BANK_DYNAMIC)
910 return pei.u.dyn;
911
81fe99fd 912 return &_fcPatternElts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
9ab79bdf 913}
cd2ec1a9 914
cd2ec1a9
PL
915FcValueListPtr
916FcValueListPtrCreateDynamic(FcValueList * p);
917
cd2ec1a9 918FcPattern *
4262e0b3 919FcPatternSerialize (int bank, FcPattern * p);
212c9f43 920
7f37423d 921void *
61571f3f 922FcPatternUnserialize (FcCache * metadata, void *block_ptr);
212c9f43 923
24330d27
KP
924/* fcrender.c */
925
926/* fcmatrix.c */
327a7fd4 927
4262e0b3 928extern const FcMatrix FcIdentityMatrix;
327a7fd4 929
24330d27
KP
930void
931FcMatrixFree (FcMatrix *mat);
932
933/* fcstr.c */
cd2ec1a9
PL
934void
935FcStrSetSort (FcStrSet * set);
936
ccb3e93b
KP
937FcChar8 *
938FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
24330d27
KP
939
940void
ccb3e93b 941FcStrFree (FcChar8 *s);
24330d27 942
c2e7c611
KP
943void
944FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
945
946void
947FcStrBufDestroy (FcStrBuf *buf);
948
949FcChar8 *
950FcStrBufDone (FcStrBuf *buf);
951
952FcBool
953FcStrBufChar (FcStrBuf *buf, FcChar8 c);
954
955FcBool
956FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
957
958FcBool
959FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
960
82f4243f
KP
961int
962FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
963
11fec41c
KP
964const FcChar8 *
965FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
966
967const FcChar8 *
968FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
969
ff3f1f98
KP
970FcBool
971FcStrUsesHome (const FcChar8 *s);
972
daeed6e0
TL
973FcChar8 *
974FcStrLastSlash (const FcChar8 *path);
975
192296d8
KP
976FcChar32
977FcStrHashIgnoreCase (const FcChar8 *s);
978
24330d27 979#endif /* _FC_INT_H_ */