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