]> git.wh0rd.org - fontconfig.git/blame - src/fcint.h
Remove fcprivate.h, move the remaining macros to fcint.h.
[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 48#include <fontconfig/fontconfig.h>
be094850 49#include <fontconfig/fcfreetype.h>
24330d27 50
24330d27
KP
51#ifndef FC_CONFIG_PATH
52#define FC_CONFIG_PATH "fonts.conf"
53#endif
54
daeed6e0
TL
55#ifdef _WIN32
56#define FC_SEARCH_PATH_SEPARATOR ';'
57#else
58#define FC_SEARCH_PATH_SEPARATOR ':'
59#endif
60
24330d27
KP
61#define FC_DBG_MATCH 1
62#define FC_DBG_MATCHV 2
63#define FC_DBG_EDIT 4
64#define FC_DBG_FONTSET 8
65#define FC_DBG_CACHE 16
66#define FC_DBG_CACHEV 32
67#define FC_DBG_PARSE 64
68#define FC_DBG_SCAN 128
4c003605 69#define FC_DBG_SCANV 256
24330d27 70#define FC_DBG_MEMORY 512
2d9c79c0 71#define FC_DBG_CONFIG 1024
7ce19673 72#define FC_DBG_LANGSET 2048
bc5e487f 73#define FC_DBG_OBJTYPES 4096
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
4984242e 112/* slim_internal.h */
7a1a7c0c 113#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun)
4984242e 114#define FcPrivate __attribute__((__visibility__("hidden")))
f6cfbe16
KP
115#define HAVE_GNUC_ATTRIBUTE 1
116#include "fcalias.h"
4984242e
KP
117#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
118#define FcPrivate __hidden
119#else /* not gcc >= 3.3 and not Sun Studio >= 8 */
120#define FcPrivate
121#endif
122
4c003605 123typedef enum _FcValueBinding {
dda7794f 124 FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
4c003605
KP
125} FcValueBinding;
126
7ce19673
KP
127/*
128 * Serialized data structures use only offsets instead of pointers
129 * A low bit of 1 indicates an offset.
130 */
131
132/* Is the provided pointer actually an offset? */
133#define FcIsEncodedOffset(p) ((((intptr_t) (p)) & 1) != 0)
cd2ec1a9 134
7ce19673
KP
135/* Encode offset in a pointer of type t */
136#define FcOffsetEncode(o,t) ((t *) ((o) | 1))
137
138/* Decode a pointer into an offset */
139#define FcOffsetDecode(p) (((intptr_t) (p)) & ~1)
140
141/* Compute pointer offset */
142#define FcPtrToOffset(b,p) ((intptr_t) (p) - (intptr_t) (b))
143
144/* Given base address, offset and type, return a pointer */
145#define FcOffsetToPtr(b,o,t) ((t *) ((intptr_t) (b) + (o)))
146
147/* Given base address, encoded offset and type, return a pointer */
148#define FcEncodedOffsetToPtr(b,p,t) FcOffsetToPtr(b,FcOffsetDecode(p),t)
cd2ec1a9 149
7ce19673
KP
150/* Given base address, pointer and type, return an encoded offset */
151#define FcPtrToEncodedOffset(b,p,t) FcOffsetEncode(FcPtrToOffset(b,p),t)
152
153/* Given a structure, offset member and type, return pointer */
154#define FcOffsetMember(s,m,t) FcOffsetToPtr(s,(s)->m,t)
155
156/* Given a structure, encoded offset member and type, return pointer to member */
157#define FcEncodedOffsetMember(s,m,t) FcOffsetToPtr(s,FcOffsetDecode((s)->m), t)
158
159/* Given a structure, member and type, convert the member to a pointer */
160#define FcPointerMember(s,m,t) (FcIsEncodedOffset((s)->m) ? \
161 FcEncodedOffsetMember (s,m,t) : \
162 (s)->m)
163
164/*
165 * Serialized values may hold strings, charsets and langsets as pointers,
166 * unfortunately FcValue is an exposed type so we can't just always use
167 * offsets
168 */
169#define FcValueString(v) FcPointerMember(v,u.s,FcChar8)
170#define FcValueCharSet(v) FcPointerMember(v,u.c,const FcCharSet)
171#define FcValueLangSet(v) FcPointerMember(v,u.l,const FcLangSet)
172
173typedef struct _FcValueList *FcValueListPtr;
174
175typedef struct _FcValueList {
176 struct _FcValueList *next;
177 FcValue value;
178 FcValueBinding binding;
24330d27
KP
179} FcValueList;
180
7ce19673
KP
181#define FcValueListNext(vl) FcPointerMember(vl,next,FcValueList)
182
183typedef int FcObject;
4262e0b3 184
7ce19673 185typedef struct _FcPatternElt *FcPatternEltPtr;
cd2ec1a9 186
7ce19673
KP
187/*
188 * Pattern elts are stuck in a structure connected to the pattern,
189 * so they get moved around when the pattern is resized. Hence, the
190 * values field must be a pointer/offset instead of just an offset
191 */
24330d27 192typedef struct _FcPatternElt {
7ce19673
KP
193 FcObject object;
194 FcValueList *values;
24330d27
KP
195} FcPatternElt;
196
7ce19673
KP
197#define FcPatternEltValues(pe) FcPointerMember(pe,values,FcValueList)
198
24330d27
KP
199struct _FcPattern {
200 int num;
201 int size;
7ce19673 202 intptr_t elts_offset;
e709ddfa 203 int ref;
24330d27
KP
204};
205
7ce19673
KP
206#define FcPatternElts(p) FcOffsetMember(p,elts_offset,FcPatternElt)
207
208#define FcFontSetFonts(fs) FcPointerMember(fs,fonts,FcPattern *)
c0288648 209
7ce19673 210#define FcFontSetFont(fs,i) (FcIsEncodedOffset((fs)->fonts) ? \
09bd9ae2 211 FcEncodedOffsetToPtr(fs, \
c0288648
KP
212 FcFontSetFonts(fs)[i], \
213 FcPattern) : \
214 fs->fonts[i])
7ce19673 215
24330d27
KP
216typedef enum _FcOp {
217 FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet,
218 FcOpNil,
219 FcOpField, FcOpConst,
220 FcOpAssign, FcOpAssignReplace,
221 FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
222 FcOpQuest,
74a623e0
KP
223 FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual,
224 FcOpContains, FcOpListing, FcOpNotContains,
24330d27
KP
225 FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
226 FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
3f7653c2
KP
227 FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
228 FcOpInvalid
24330d27
KP
229} FcOp;
230
231typedef struct _FcExpr {
232 FcOp op;
233 union {
234 int ival;
235 double dval;
ccb3e93b 236 FcChar8 *sval;
24330d27
KP
237 FcMatrix *mval;
238 FcBool bval;
239 FcCharSet *cval;
7ce19673 240 FcObject object;
ccb3e93b 241 FcChar8 *constant;
24330d27
KP
242 struct {
243 struct _FcExpr *left, *right;
244 } tree;
245 } u;
246} FcExpr;
247
248typedef enum _FcQual {
6f6563ed 249 FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
24330d27
KP
250} FcQual;
251
938bc633
KP
252#define FcMatchDefault ((FcMatchKind) -1)
253
24330d27
KP
254typedef struct _FcTest {
255 struct _FcTest *next;
938bc633 256 FcMatchKind kind;
24330d27 257 FcQual qual;
7ce19673 258 FcObject object;
24330d27
KP
259 FcOp op;
260 FcExpr *expr;
261} FcTest;
262
263typedef struct _FcEdit {
264 struct _FcEdit *next;
7ce19673 265 FcObject object;
24330d27
KP
266 FcOp op;
267 FcExpr *expr;
6fff2cda 268 FcValueBinding binding;
24330d27
KP
269} FcEdit;
270
271typedef struct _FcSubst {
272 struct _FcSubst *next;
273 FcTest *test;
274 FcEdit *edit;
275} FcSubst;
276
20ac65ab 277typedef struct _FcCharLeaf {
24330d27 278 FcChar32 map[256/32];
20ac65ab 279} FcCharLeaf;
24330d27 280
d8d73958 281#define FC_REF_CONSTANT -1
82f4243f 282
24330d27 283struct _FcCharSet {
24330d27 284 int ref; /* reference count */
20ac65ab 285 int num; /* size of leaves and numbers arrays */
7ce19673
KP
286 intptr_t leaves_offset;
287 intptr_t numbers_offset;
24330d27
KP
288};
289
7ce19673
KP
290#define FcCharSetLeaves(c) FcOffsetMember(c,leaves_offset,intptr_t)
291#define FcCharSetLeaf(c,i) (FcOffsetToPtr(FcCharSetLeaves(c), \
292 FcCharSetLeaves(c)[i], \
293 FcCharLeaf))
294#define FcCharSetNumbers(c) FcOffsetMember(c,numbers_offset,FcChar16)
295
179c3995
KP
296struct _FcStrSet {
297 int ref; /* reference count */
298 int num;
299 int size;
4262e0b3 300 FcChar8 **strs;
179c3995
KP
301};
302
303struct _FcStrList {
304 FcStrSet *set;
305 int n;
306};
307
c2e7c611 308typedef struct _FcStrBuf {
24330d27
KP
309 FcChar8 *buf;
310 FcBool allocated;
311 FcBool failed;
312 int len;
313 int size;
c2e7c611 314} FcStrBuf;
24330d27 315
4984242e 316struct _FcCache {
bc5e487f
KP
317 int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */
318 int version; /* FC_CACHE_CONTENT_VERSION */
c50ea916 319 intptr_t size; /* size of file */
7ce19673
KP
320 intptr_t dir; /* offset to dir name */
321 intptr_t dirs; /* offset to subdirs */
322 int dirs_count; /* number of subdir strings */
323 intptr_t set; /* offset to font set */
db6f19f1 324 int mtime; /* low bits of directory mtime */
4984242e 325};
212c9f43 326
23816bf9
KP
327#undef FcCacheDir
328#undef FcCacheSubdir
7ce19673
KP
329#define FcCacheDir(c) FcOffsetMember(c,dir,FcChar8)
330#define FcCacheDirs(c) FcOffsetMember(c,dirs,intptr_t)
331#define FcCacheSet(c) FcOffsetMember(c,set,FcFontSet)
4984242e
KP
332#define FcCacheSubdir(c,i) FcOffsetToPtr (FcCacheDirs(c),\
333 FcCacheDirs(c)[i], \
bc5e487f 334 FcChar8)
7ce19673
KP
335
336/*
337 * Used while constructing a directory cache object
338 */
339
340#define FC_SERIALIZE_HASH_SIZE 8191
341
342typedef struct _FcSerializeBucket {
343 struct _FcSerializeBucket *next;
344 const void *object;
345 intptr_t offset;
346} FcSerializeBucket;
347
bc5e487f
KP
348typedef struct _FcCharSetFreezer FcCharSetFreezer;
349
7ce19673
KP
350typedef struct _FcSerialize {
351 intptr_t size;
bc5e487f 352 FcCharSetFreezer *cs_freezer;
7ce19673
KP
353 void *linear;
354 FcSerializeBucket *buckets[FC_SERIALIZE_HASH_SIZE];
355} FcSerialize;
356
7769c321
KP
357/*
358 * To map adobe glyph names to unicode values, a precomputed hash
359 * table is used
360 */
361
362typedef struct _FcGlyphName {
363 FcChar32 ucs; /* unicode value */
364 FcChar8 name[1]; /* name extends beyond struct */
365} FcGlyphName;
366
192296d8
KP
367/*
368 * To perform case-insensitive string comparisons, a table
369 * is used which holds three different kinds of folding data.
370 *
371 * The first is a range of upper case values mapping to a range
372 * of their lower case equivalents. Within each range, the offset
373 * between upper and lower case is constant.
374 *
375 * The second is a range of upper case values which are interleaved
376 * with their lower case equivalents.
377 *
378 * The third is a set of raw unicode values mapping to a list
379 * of unicode values for comparison purposes. This allows conversion
380 * of ß to "ss" so that SS, ss and ß all match. A separate array
381 * holds the list of unicode values for each entry.
382 *
383 * These are packed into a single table. Using a binary search,
384 * the appropriate entry can be located.
385 */
386
387#define FC_CASE_FOLD_RANGE 0
388#define FC_CASE_FOLD_EVEN_ODD 1
389#define FC_CASE_FOLD_FULL 2
390
391typedef struct _FcCaseFold {
392 FcChar32 upper;
393 FcChar16 method : 2;
394 FcChar16 count : 14;
395 short offset; /* lower - upper for RANGE, table id for FULL */
396} FcCaseFold;
397
2d9c79c0
KP
398#define FC_MAX_FILE_LEN 4096
399
7ce19673
KP
400/* XXX remove these when we're ready */
401
402#define fc_value_string(v) FcValueString(v)
403#define fc_value_charset(v) FcValueCharSet(v)
404#define fc_value_langset(v) FcValueLangSet(v)
405#define fc_storage_type(v) ((v)->type)
4262e0b3 406
44415a07
PL
407#define fc_alignof(type) offsetof (struct { char c; type member; }, member)
408
bc5e487f
KP
409#define FC_CACHE_MAGIC_MMAP 0xFC02FC04
410#define FC_CACHE_MAGIC_ALLOC 0xFC02FC05
db6f19f1 411#define FC_CACHE_CONTENT_VERSION 2
327a7fd4 412
134f6011
KP
413struct _FcAtomic {
414 FcChar8 *file; /* original file name */
415 FcChar8 *new; /* temp file name -- write data here */
416 FcChar8 *lck; /* lockfile name (used for locking) */
417 FcChar8 *tmp; /* tmpfile name (used for locking) */
418};
419
24330d27
KP
420struct _FcBlanks {
421 int nblank;
422 int sblank;
423 FcChar32 *blanks;
424};
425
426struct _FcConfig {
427 /*
428 * File names loaded from the configuration -- saved here as the
429 * cache file must be consulted before the directories are scanned,
430 * and those directives may occur in any order
431 */
179c3995 432 FcStrSet *configDirs; /* directories to scan for fonts */
24330d27
KP
433 /*
434 * Set of allowed blank chars -- used to
435 * trim fonts of bogus glyphs
436 */
437 FcBlanks *blanks;
179c3995
KP
438 /*
439 * List of directories containing fonts,
440 * built by recursively scanning the set
441 * of configured directories
442 */
443 FcStrSet *fontDirs;
7410e40b
PL
444 /*
445 * List of directories containing cache files.
446 */
447 FcStrSet *cacheDirs;
24330d27
KP
448 /*
449 * Names of all of the configuration files used
450 * to create this configuration
451 */
179c3995 452 FcStrSet *configFiles; /* config files loaded */
24330d27
KP
453 /*
454 * Substitution instructions for patterns and fonts;
455 * maxObjects is used to allocate appropriate intermediate storage
456 * while performing a whole set of substitutions
457 */
458 FcSubst *substPattern; /* substitutions for patterns */
459 FcSubst *substFont; /* substitutions for fonts */
c2c6976d 460 FcSubst *substScan; /* substitutions for scanned fonts */
24330d27 461 int maxObjects; /* maximum number of tests in all substs */
d47c9d6e
KP
462 /*
463 * List of patterns used to control font file selection
464 */
465 FcStrSet *acceptGlobs;
466 FcStrSet *rejectGlobs;
4f27c1c0
KP
467 FcFontSet *acceptPatterns;
468 FcFontSet *rejectPatterns;
24330d27
KP
469 /*
470 * The set of fonts loaded from the listed directories; the
471 * order within the set does not determine the font selection,
472 * except in the case of identical matches in which case earlier fonts
473 * match preferrentially
474 */
475 FcFontSet *fonts[FcSetApplication + 1];
179c3995
KP
476 /*
477 * Fontconfig can periodically rescan the system configuration
478 * and font directories. This rescanning occurs when font
479 * listing requests are made, but no more often than rescanInterval
480 * seconds apart.
481 */
482 time_t rescanTime; /* last time information was scanned */
483 int rescanInterval; /* interval between scans */
24330d27
KP
484};
485
4984242e 486extern FcPrivate FcConfig *_fcConfig;
6e9fc5de 487
2b25f00c
PL
488typedef struct _FcFileTime {
489 time_t time;
490 FcBool set;
491} FcFileTime;
492
69937bd9
KP
493typedef struct _FcCharMap FcCharMap;
494
44415a07
PL
495/* watch out; assumes that v is void * -PL */
496#define ALIGN(v,type) ((void *)(((uintptr_t)(v) + fc_alignof(type) - 1) & ~(fc_alignof(type) - 1)))
7fd7221e 497
b6079229
KP
498/*
499 * I tried this with functions that took va_list* arguments
500 * but portability concerns made me change these functions
501 * into macros (sigh).
502 */
503
504#define FcPatternVapBuild(result, orig, va) \
505{ \
506 FcPattern *__p__ = (orig); \
507 const char *__o__; \
508 FcValue __v__; \
509 \
510 if (!__p__) \
511 { \
512 __p__ = FcPatternCreate (); \
513 if (!__p__) \
514 goto _FcPatternVapBuild_bail0; \
515 } \
516 for (;;) \
517 { \
518 __o__ = va_arg (va, const char *); \
519 if (!__o__) \
520 break; \
521 __v__.type = va_arg (va, FcType); \
522 switch (__v__.type) { \
523 case FcTypeVoid: \
524 goto _FcPatternVapBuild_bail1; \
525 case FcTypeInteger: \
526 __v__.u.i = va_arg (va, int); \
527 break; \
528 case FcTypeDouble: \
529 __v__.u.d = va_arg (va, double); \
530 break; \
531 case FcTypeString: \
532 __v__.u.s = va_arg (va, const FcChar8 *); \
533 break; \
534 case FcTypeBool: \
535 __v__.u.b = va_arg (va, FcBool); \
536 break; \
537 case FcTypeMatrix: \
538 __v__.u.m = va_arg (va, const FcMatrix *); \
539 break; \
540 case FcTypeCharSet: \
541 __v__.u.c = va_arg (va, const FcCharSet *); \
542 break; \
543 case FcTypeFTFace: \
544 __v__.u.f = va_arg (va, FT_Face); \
545 break; \
546 case FcTypeLangSet: \
547 __v__.u.l = va_arg (va, const FcLangSet *); \
548 break; \
549 } \
550 if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \
551 goto _FcPatternVapBuild_bail1; \
552 } \
553 result = __p__; \
554 goto _FcPatternVapBuild_return; \
555 \
556_FcPatternVapBuild_bail1: \
557 if (!orig) \
558 FcPatternDestroy (__p__); \
559_FcPatternVapBuild_bail0: \
560 result = (void*)0; \
561 \
562_FcPatternVapBuild_return: \
563 ; \
564}
565
566
567#define FcObjectSetVapBuild(__ret__, __first__, __va__) \
568{ \
569 FcObjectSet *__os__; \
570 const char *__ob__; \
571 \
572 __ret__ = 0; \
573 __os__ = FcObjectSetCreate (); \
574 if (!__os__) \
575 goto _FcObjectSetVapBuild_bail0; \
576 __ob__ = __first__; \
577 while (__ob__) \
578 { \
579 if (!FcObjectSetAdd (__os__, __ob__)) \
580 goto _FcObjectSetVapBuild_bail1; \
581 __ob__ = va_arg (__va__, const char *); \
582 } \
583 __ret__ = __os__; \
584 \
585_FcObjectSetVapBuild_bail1: \
586 if (!__ret__ && __os__) \
587 FcObjectSetDestroy (__os__); \
588_FcObjectSetVapBuild_bail0: \
589 ; \
590}
591
24330d27
KP
592/* fcblanks.c */
593
594/* fccache.c */
595
4984242e 596FcPrivate FcCache *
bc5e487f
KP
597FcDirCacheScan (const FcChar8 *dir, FcConfig *config);
598
4984242e 599FcPrivate FcCache *
db6f19f1 600FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcStrSet *dirs);
bc5e487f 601
4984242e 602FcPrivate FcBool
bc5e487f
KP
603FcDirCacheWrite (FcCache *cache, FcConfig *config);
604
9e612141
KP
605FcPrivate void
606FcCacheObjectReference (void *object);
607
608FcPrivate void
609FcCacheObjectDereference (void *object);
610
8fe2104a
KP
611FcPrivate void
612FcCacheFini (void);
613
23816bf9 614FcPrivate void
17389539
KP
615FcDirCacheReference (FcCache *cache, int nref);
616
24330d27
KP
617/* fccfg.c */
618
4984242e 619FcPrivate FcBool
179c3995
KP
620FcConfigAddConfigDir (FcConfig *config,
621 const FcChar8 *d);
622
4984242e 623FcPrivate FcBool
179c3995
KP
624FcConfigAddFontDir (FcConfig *config,
625 const FcChar8 *d);
626
4984242e 627FcPrivate FcBool
ccb3e93b
KP
628FcConfigAddDir (FcConfig *config,
629 const FcChar8 *d);
24330d27 630
4984242e 631FcPrivate FcBool
7410e40b
PL
632FcConfigAddCacheDir (FcConfig *config,
633 const FcChar8 *d);
634
4984242e 635FcPrivate FcBool
ccb3e93b
KP
636FcConfigAddConfigFile (FcConfig *config,
637 const FcChar8 *f);
24330d27 638
4984242e 639FcPrivate FcBool
24330d27
KP
640FcConfigAddBlank (FcConfig *config,
641 FcChar32 blank);
642
4984242e 643FcPrivate FcBool
24330d27
KP
644FcConfigAddEdit (FcConfig *config,
645 FcTest *test,
646 FcEdit *edit,
647 FcMatchKind kind);
648
4984242e 649FcPrivate void
24330d27
KP
650FcConfigSetFonts (FcConfig *config,
651 FcFontSet *fonts,
652 FcSetName set);
653
4984242e 654FcPrivate FcBool
4262e0b3 655FcConfigCompareValue (const FcValue *m,
24330d27 656 FcOp op,
4262e0b3 657 const FcValue *v);
24330d27 658
4984242e 659FcPrivate FcBool
d47c9d6e
KP
660FcConfigGlobAdd (FcConfig *config,
661 const FcChar8 *glob,
662 FcBool accept);
663
4984242e 664FcPrivate FcBool
d47c9d6e
KP
665FcConfigAcceptFilename (FcConfig *config,
666 const FcChar8 *filename);
667
4984242e 668FcPrivate FcBool
4f27c1c0
KP
669FcConfigPatternsAdd (FcConfig *config,
670 FcPattern *pattern,
671 FcBool accept);
672
4984242e 673FcPrivate FcBool
4f27c1c0
KP
674FcConfigAcceptFont (FcConfig *config,
675 const FcPattern *font);
676
4984242e 677FcPrivate FcFileTime
2b25f00c
PL
678FcConfigModifiedTime (FcConfig *config);
679
4984242e 680FcPrivate FcBool
97c3d5b6
KP
681FcConfigAddCache (FcConfig *config, FcCache *cache,
682 FcSetName set, FcStrSet *dirSet);
2d3387fd
KP
683
684/* fcserialize.c */
4984242e 685FcPrivate intptr_t
7ce19673
KP
686FcAlignSize (intptr_t size);
687
4984242e 688FcPrivate FcSerialize *
7ce19673
KP
689FcSerializeCreate (void);
690
4984242e 691FcPrivate void
7ce19673
KP
692FcSerializeDestroy (FcSerialize *serialize);
693
4984242e 694FcPrivate FcBool
7ce19673
KP
695FcSerializeAlloc (FcSerialize *serialize, const void *object, int size);
696
4984242e 697FcPrivate intptr_t
7ce19673
KP
698FcSerializeReserve (FcSerialize *serialize, int size);
699
4984242e 700FcPrivate intptr_t
7ce19673
KP
701FcSerializeOffset (FcSerialize *serialize, const void *object);
702
4984242e 703FcPrivate void *
7ce19673
KP
704FcSerializePtr (FcSerialize *serialize, const void *object);
705
4984242e 706FcPrivate FcBool
7ce19673
KP
707FcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l);
708
4984242e 709FcPrivate FcLangSet *
7ce19673
KP
710FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l);
711
24330d27 712/* fccharset.c */
4984242e 713FcPrivate void
82f35f8b
PL
714FcLangCharSetPopulate (void);
715
4984242e 716FcPrivate FcCharSetFreezer *
18b6857c
KP
717FcCharSetFreezerCreate (void);
718
4984242e 719FcPrivate const FcCharSet *
18b6857c
KP
720FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs);
721
4984242e 722FcPrivate void
bc5e487f 723FcCharSetFreezerDestroy (FcCharSetFreezer *freezer);
34cd0514 724
4984242e 725FcPrivate FcBool
c2e7c611 726FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
24330d27 727
4984242e 728FcPrivate FcCharSet *
24330d27
KP
729FcNameParseCharSet (FcChar8 *string);
730
4984242e 731FcPrivate FcCharLeaf *
c647f6f1 732FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
69937bd9 733
4984242e 734FcPrivate FcBool
7ce19673 735FcCharSetSerializeAlloc(FcSerialize *serialize, const FcCharSet *cs);
cd2ec1a9 736
4984242e 737FcPrivate FcCharSet *
7ce19673 738FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs);
cd2ec1a9 739
4984242e 740FcPrivate FcChar16 *
cd2ec1a9
PL
741FcCharSetGetNumbers(const FcCharSet *c);
742
24330d27 743/* fcdbg.c */
4984242e 744FcPrivate void
cd2ec1a9 745FcValueListPrint (const FcValueListPtr l);
24330d27 746
4984242e 747FcPrivate void
793e946c
KP
748FcLangSetPrint (const FcLangSet *ls);
749
4984242e 750FcPrivate void
24330d27
KP
751FcOpPrint (FcOp op);
752
4984242e 753FcPrivate void
938bc633 754FcTestPrint (const FcTest *test);
24330d27 755
4984242e 756FcPrivate void
938bc633 757FcExprPrint (const FcExpr *expr);
24330d27 758
4984242e 759FcPrivate void
938bc633 760FcEditPrint (const FcEdit *edit);
24330d27 761
4984242e 762FcPrivate void
938bc633 763FcSubstPrint (const FcSubst *subst);
24330d27 764
4984242e 765FcPrivate void
7ce19673
KP
766FcCharSetPrint (const FcCharSet *c);
767
4984242e 768extern FcPrivate int FcDebugVal;
b97a34b5 769
4984242e 770#define FcDebug() (FcDebugVal)
b97a34b5 771
4984242e 772FcPrivate void
b97a34b5 773FcInitDebug (void);
24330d27 774
90442681 775/* fcdefault.c */
4984242e 776FcPrivate FcChar8 *
90442681
PL
777FcGetDefaultLang (void);
778
24330d27 779/* fcdir.c */
24330d27 780
4984242e 781FcPrivate FcBool
d47c9d6e
KP
782FcFileScanConfig (FcFontSet *set,
783 FcStrSet *dirs,
d47c9d6e
KP
784 FcBlanks *blanks,
785 const FcChar8 *file,
d47c9d6e
KP
786 FcConfig *config);
787
4984242e 788FcPrivate FcBool
d47c9d6e
KP
789FcDirScanConfig (FcFontSet *set,
790 FcStrSet *dirs,
d47c9d6e 791 FcBlanks *blanks,
bc5e487f 792 const FcChar8 *dir,
d47c9d6e
KP
793 FcBool force,
794 FcConfig *config);
795
24330d27 796/* fcfont.c */
4984242e 797FcPrivate int
24330d27
KP
798FcFontDebug (void);
799
82f4243f 800/* fcfreetype.c */
4984242e 801FcPrivate FcBool
e50b9ae7
KP
802FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
803
4984242e 804FcPrivate FcBool
82f4243f
KP
805FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
806
4984242e 807FcPrivate FcChar32
c647f6f1
KP
808FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map);
809
4984242e 810FcPrivate FcChar32
c647f6f1
KP
811FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map);
812
4984242e 813FcPrivate const FcCharMap *
c647f6f1
KP
814FcFreeTypeGetPrivateMap (FT_Encoding encoding);
815
24330d27 816/* fcfs.c */
cd2ec1a9 817
4984242e 818FcPrivate FcBool
7ce19673 819FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s);
212c9f43 820
4984242e 821FcPrivate FcFontSet *
7ce19673
KP
822FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
823
24330d27 824/* fcgram.y */
4984242e 825FcPrivate int
24330d27
KP
826FcConfigparse (void);
827
4984242e 828FcPrivate int
24330d27
KP
829FcConfigwrap (void);
830
4984242e 831FcPrivate void
24330d27
KP
832FcConfigerror (char *fmt, ...);
833
4984242e 834FcPrivate char *
24330d27
KP
835FcConfigSaveField (const char *field);
836
4984242e 837FcPrivate void
24330d27
KP
838FcTestDestroy (FcTest *test);
839
4984242e 840FcPrivate FcExpr *
24330d27
KP
841FcExprCreateInteger (int i);
842
4984242e 843FcPrivate FcExpr *
24330d27
KP
844FcExprCreateDouble (double d);
845
4984242e 846FcPrivate FcExpr *
ccb3e93b 847FcExprCreateString (const FcChar8 *s);
24330d27 848
4984242e 849FcPrivate FcExpr *
24330d27
KP
850FcExprCreateMatrix (const FcMatrix *m);
851
4984242e 852FcPrivate FcExpr *
24330d27
KP
853FcExprCreateBool (FcBool b);
854
4984242e 855FcPrivate FcExpr *
24330d27
KP
856FcExprCreateNil (void);
857
4984242e 858FcPrivate FcExpr *
24330d27
KP
859FcExprCreateField (const char *field);
860
4984242e 861FcPrivate FcExpr *
ccb3e93b 862FcExprCreateConst (const FcChar8 *constant);
24330d27 863
4984242e 864FcPrivate FcExpr *
24330d27
KP
865FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
866
4984242e 867FcPrivate void
24330d27
KP
868FcExprDestroy (FcExpr *e);
869
4984242e 870FcPrivate void
24330d27
KP
871FcEditDestroy (FcEdit *e);
872
873/* fcinit.c */
874
4984242e 875FcPrivate void
24330d27
KP
876FcMemReport (void);
877
4984242e 878FcPrivate void
24330d27
KP
879FcMemAlloc (int kind, int size);
880
4984242e 881FcPrivate void
24330d27
KP
882FcMemFree (int kind, int size);
883
82f4243f 884/* fclang.c */
4984242e 885FcPrivate FcLangSet *
d8d73958 886FcFreeTypeLangSet (const FcCharSet *charset,
e50b9ae7 887 const FcChar8 *exclusiveLang);
82f4243f 888
4984242e 889FcPrivate FcLangResult
82f4243f
KP
890FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
891
4984242e 892FcPrivate const FcCharSet *
82f4243f
KP
893FcCharSetForLang (const FcChar8 *lang);
894
4984242e 895FcPrivate FcLangSet *
d8d73958
KP
896FcLangSetPromote (const FcChar8 *lang);
897
4984242e 898FcPrivate FcLangSet *
d8d73958
KP
899FcNameParseLangSet (const FcChar8 *string);
900
4984242e 901FcPrivate FcBool
d8d73958
KP
902FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
903
4984242e 904FcPrivate FcChar8 *
f57783d2
KP
905FcNameUnparseEscaped (FcPattern *pat, FcBool escape);
906
24330d27
KP
907/* fclist.c */
908
4984242e 909FcPrivate FcBool
4f27c1c0
KP
910FcListPatternMatchAny (const FcPattern *p,
911 const FcPattern *font);
912
24330d27
KP
913/* fcmatch.c */
914
915/* fcname.c */
24330d27 916
7ce19673
KP
917/*
918 * NOTE -- this ordering is part of the cache file format.
919 * It must also match the ordering in fcname.c
920 */
4262e0b3 921
7ce19673
KP
922#define FC_FAMILY_OBJECT 1
923#define FC_FAMILYLANG_OBJECT 2
924#define FC_STYLE_OBJECT 3
925#define FC_STYLELANG_OBJECT 4
926#define FC_FULLNAME_OBJECT 5
927#define FC_FULLNAMELANG_OBJECT 6
928#define FC_SLANT_OBJECT 7
929#define FC_WEIGHT_OBJECT 8
930#define FC_WIDTH_OBJECT 9
931#define FC_SIZE_OBJECT 10
932#define FC_ASPECT_OBJECT 11
933#define FC_PIXEL_SIZE_OBJECT 12
934#define FC_SPACING_OBJECT 13
935#define FC_FOUNDRY_OBJECT 14
936#define FC_ANTIALIAS_OBJECT 15
937#define FC_HINT_STYLE_OBJECT 16
938#define FC_HINTING_OBJECT 17
939#define FC_VERTICAL_LAYOUT_OBJECT 18
940#define FC_AUTOHINT_OBJECT 19
941#define FC_GLOBAL_ADVANCE_OBJECT 20
942#define FC_FILE_OBJECT 21
943#define FC_INDEX_OBJECT 22
944#define FC_RASTERIZER_OBJECT 23
945#define FC_OUTLINE_OBJECT 24
946#define FC_SCALABLE_OBJECT 25
947#define FC_DPI_OBJECT 26
948#define FC_RGBA_OBJECT 27
949#define FC_SCALE_OBJECT 28
950#define FC_MINSPACE_OBJECT 29
951#define FC_CHAR_WIDTH_OBJECT 30
952#define FC_CHAR_HEIGHT_OBJECT 31
953#define FC_MATRIX_OBJECT 32
954#define FC_CHARSET_OBJECT 33
955#define FC_LANG_OBJECT 34
956#define FC_FONTVERSION_OBJECT 35
957#define FC_CAPABILITY_OBJECT 36
958#define FC_FONTFORMAT_OBJECT 37
959#define FC_EMBOLDEN_OBJECT 38
960#define FC_EMBEDDED_BITMAP_OBJECT 39
c2c6976d 961#define FC_DECORATIVE_OBJECT 40
0f963b0d 962#define FC_MAX_BASE_OBJECT FC_DECORATIVE_OBJECT
7f37423d 963
4984242e 964FcPrivate FcBool
7ce19673 965FcNameBool (const FcChar8 *v, FcBool *result);
7fd7221e 966
4984242e 967FcPrivate FcBool
7ce19673 968FcObjectValidType (FcObject object, FcType type);
4262e0b3 969
4984242e 970FcPrivate FcObject
7ce19673 971FcObjectFromName (const char * name);
4262e0b3 972
4984242e 973FcPrivate const char *
7ce19673 974FcObjectName (FcObject object);
7f37423d 975
4984242e 976FcPrivate FcBool
09f9f6f6 977FcObjectInit (void);
7f37423d 978
4984242e 979FcPrivate void
09f9f6f6
KP
980FcObjectFini (void);
981
982#define FcObjectCompare(a, b) ((int) a - (int) b)
4262e0b3 983
24330d27 984/* fcpat.c */
4262e0b3 985
4984242e 986FcPrivate FcValue
4262e0b3
PL
987FcValueCanonicalize (const FcValue *v);
988
4984242e 989FcPrivate void
cd2ec1a9
PL
990FcValueListDestroy (FcValueListPtr l);
991
4984242e 992FcPrivate FcPatternElt *
7ce19673 993FcPatternObjectFindElt (const FcPattern *p, FcObject object);
e9be9cd1 994
4984242e 995FcPrivate FcPatternElt *
7ce19673 996FcPatternObjectInsertElt (FcPattern *p, FcObject object);
24330d27 997
4984242e 998FcPrivate FcBool
7ce19673
KP
999FcPatternObjectAddWithBinding (FcPattern *p,
1000 FcObject object,
1001 FcValue value,
1002 FcValueBinding binding,
1003 FcBool append);
82f4243f 1004
4984242e 1005FcPrivate FcBool
7ce19673
KP
1006FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append);
1007
4984242e 1008FcPrivate FcBool
7ce19673
KP
1009FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
1010
4984242e 1011FcPrivate FcResult
7ce19673
KP
1012FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
1013
4984242e 1014FcPrivate FcBool
7ce19673 1015FcPatternObjectDel (FcPattern *p, FcObject object);
34cd0514 1016
4984242e 1017FcPrivate FcBool
7ce19673 1018FcPatternObjectRemove (FcPattern *p, FcObject object, int id);
4f27c1c0 1019
4984242e 1020FcPrivate FcBool
7ce19673 1021FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i);
cd2ec1a9 1022
4984242e 1023FcPrivate FcBool
7ce19673 1024FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d);
cd2ec1a9 1025
4984242e 1026FcPrivate FcBool
7ce19673 1027FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s);
cd2ec1a9 1028
4984242e 1029FcPrivate FcBool
7ce19673 1030FcPatternObjectAddMatrix (FcPattern *p, FcObject object, const FcMatrix *s);
cd2ec1a9 1031
4984242e 1032FcPrivate FcBool
7ce19673 1033FcPatternObjectAddCharSet (FcPattern *p, FcObject object, const FcCharSet *c);
7fd7221e 1034
4984242e 1035FcPrivate FcBool
7ce19673 1036FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b);
cd2ec1a9 1037
4984242e 1038FcPrivate FcBool
7ce19673
KP
1039FcPatternObjectAddLangSet (FcPattern *p, FcObject object, const FcLangSet *ls);
1040
4984242e 1041FcPrivate FcResult
7ce19673
KP
1042FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int n, int *i);
1043
4984242e 1044FcPrivate FcResult
7ce19673 1045FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int n, double *d);
9ab79bdf 1046
4984242e 1047FcPrivate FcResult
7ce19673 1048FcPatternObjectGetString (const FcPattern *p, FcObject object, int n, FcChar8 ** s);
9ab79bdf 1049
4984242e 1050FcPrivate FcResult
7ce19673 1051FcPatternObjectGetMatrix (const FcPattern *p, FcObject object, int n, FcMatrix **s);
9ab79bdf 1052
4984242e 1053FcPrivate FcResult
7ce19673 1054FcPatternObjectGetCharSet (const FcPattern *p, FcObject object, int n, FcCharSet **c);
9ab79bdf 1055
4984242e 1056FcPrivate FcResult
7ce19673 1057FcPatternObjectGetBool (const FcPattern *p, FcObject object, int n, FcBool *b);
cd2ec1a9 1058
4984242e 1059FcPrivate FcResult
7ce19673
KP
1060FcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet **ls);
1061
4984242e 1062FcPrivate void
7ce19673
KP
1063FcPatternFini (void);
1064
4984242e 1065FcPrivate FcBool
7ce19673
KP
1066FcPatternAppend (FcPattern *p, FcPattern *s);
1067
4984242e 1068FcPrivate const FcChar8 *
7ce19673
KP
1069FcStrStaticName (const FcChar8 *name);
1070
4984242e 1071FcPrivate FcChar32
7ce19673
KP
1072FcStringHash (const FcChar8 *s);
1073
4984242e 1074FcPrivate FcBool
7ce19673 1075FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat);
cd2ec1a9 1076
4984242e 1077FcPrivate FcPattern *
7ce19673 1078FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat);
212c9f43 1079
4984242e 1080FcPrivate FcBool
7ce19673
KP
1081FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *pat);
1082
4984242e 1083FcPrivate FcValueList *
7ce19673 1084FcValueListSerialize (FcSerialize *serialize, const FcValueList *pat);
212c9f43 1085
24330d27
KP
1086/* fcrender.c */
1087
1088/* fcmatrix.c */
327a7fd4 1089
4984242e 1090extern FcPrivate const FcMatrix FcIdentityMatrix;
327a7fd4 1091
4984242e 1092FcPrivate void
24330d27
KP
1093FcMatrixFree (FcMatrix *mat);
1094
1095/* fcstr.c */
4984242e 1096FcPrivate void
cd2ec1a9
PL
1097FcStrSetSort (FcStrSet * set);
1098
4984242e 1099FcPrivate void
c2e7c611
KP
1100FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
1101
4984242e 1102FcPrivate void
c2e7c611
KP
1103FcStrBufDestroy (FcStrBuf *buf);
1104
4984242e 1105FcPrivate FcChar8 *
c2e7c611
KP
1106FcStrBufDone (FcStrBuf *buf);
1107
4984242e 1108FcPrivate FcBool
c2e7c611
KP
1109FcStrBufChar (FcStrBuf *buf, FcChar8 c);
1110
4984242e 1111FcPrivate FcBool
c2e7c611
KP
1112FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
1113
4984242e 1114FcPrivate FcBool
c2e7c611
KP
1115FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
1116
4984242e 1117FcPrivate int
82f4243f
KP
1118FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
1119
4984242e 1120FcPrivate const FcChar8 *
11fec41c
KP
1121FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
1122
4984242e 1123FcPrivate const FcChar8 *
11fec41c
KP
1124FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
1125
4ee9ca67
KP
1126FcPrivate const FcChar8 *
1127FcStrContainsWord (const FcChar8 *s1, const FcChar8 *s2);
1128
4984242e 1129FcPrivate FcBool
ff3f1f98
KP
1130FcStrUsesHome (const FcChar8 *s);
1131
4984242e 1132FcPrivate FcChar8 *
daeed6e0
TL
1133FcStrLastSlash (const FcChar8 *path);
1134
4984242e 1135FcPrivate FcChar32
192296d8
KP
1136FcStrHashIgnoreCase (const FcChar8 *s);
1137
4984242e 1138FcPrivate FcChar8 *
0d9e31c8
KP
1139FcStrCanonFilename (const FcChar8 *s);
1140
4984242e 1141FcPrivate FcBool
7ce19673
KP
1142FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str);
1143
4984242e 1144FcPrivate FcChar8 *
7ce19673
KP
1145FcStrSerialize (FcSerialize *serialize, const FcChar8 *str);
1146
24330d27 1147#endif /* _FC_INT_H_ */