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