1b5b73dd3Smrg/*
2b5b73dd3Smrg * fontconfig/src/fcint.h
3b5b73dd3Smrg *
4b5b73dd3Smrg * Copyright © 2000 Keith Packard
5b5b73dd3Smrg *
6b5b73dd3Smrg * Permission to use, copy, modify, distribute, and sell this software and its
7b5b73dd3Smrg * documentation for any purpose is hereby granted without fee, provided that
8b5b73dd3Smrg * the above copyright notice appear in all copies and that both that
9b5b73dd3Smrg * copyright notice and this permission notice appear in supporting
10b5b73dd3Smrg * documentation, and that the name of the author(s) not be used in
11b5b73dd3Smrg * advertising or publicity pertaining to distribution of the software without
12b5b73dd3Smrg * specific, written prior permission.  The authors make no
13b5b73dd3Smrg * representations about the suitability of this software for any purpose.  It
14b5b73dd3Smrg * is provided "as is" without express or implied warranty.
15b5b73dd3Smrg *
16b5b73dd3Smrg * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17b5b73dd3Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18b5b73dd3Smrg * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19b5b73dd3Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20b5b73dd3Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21b5b73dd3Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22b5b73dd3Smrg * PERFORMANCE OF THIS SOFTWARE.
23b5b73dd3Smrg */
24b5b73dd3Smrg
25b5b73dd3Smrg#ifndef _FCINT_H_
26b5b73dd3Smrg#define _FCINT_H_
27b5b73dd3Smrg
28b5b73dd3Smrg#ifdef HAVE_CONFIG_H
29b5b73dd3Smrg#include <config.h>
30b5b73dd3Smrg#endif
31b5b73dd3Smrg
32b5b73dd3Smrg#include "fcstdint.h"
33b5b73dd3Smrg
34b5b73dd3Smrg#include <stdlib.h>
35b5b73dd3Smrg#include <stdio.h>
36b5b73dd3Smrg#include <string.h>
37b5b73dd3Smrg#include <ctype.h>
38b5b73dd3Smrg#include <assert.h>
39b5b73dd3Smrg#include <errno.h>
40b5b73dd3Smrg#include <limits.h>
41b5b73dd3Smrg#include <float.h>
42b5b73dd3Smrg#include <math.h>
43b5b73dd3Smrg#ifdef HAVE_UNISTD_H
44b5b73dd3Smrg#include <unistd.h>
45b5b73dd3Smrg#endif
46b5b73dd3Smrg#include <stddef.h>
47b5b73dd3Smrg#include <sys/types.h>
48b5b73dd3Smrg#include <sys/stat.h>
49b5b73dd3Smrg#include <time.h>
50b5b73dd3Smrg#include <fontconfig/fontconfig.h>
51b5b73dd3Smrg#include <fontconfig/fcprivate.h>
52b5b73dd3Smrg#include "fcdeprecate.h"
53b5b73dd3Smrg#include "fcmutex.h"
54b5b73dd3Smrg#include "fcatomic.h"
55b5b73dd3Smrg
56b5b73dd3Smrg#ifndef FC_CONFIG_PATH
57b5b73dd3Smrg#define FC_CONFIG_PATH "fonts.conf"
58b5b73dd3Smrg#endif
59b5b73dd3Smrg
60b5b73dd3Smrg#ifdef _WIN32
61b5b73dd3Smrg#define FC_LIKELY(expr) (expr)
62b5b73dd3Smrg#define FC_UNLIKELY(expr) (expr)
63b5b73dd3Smrg#else
64b5b73dd3Smrg#define FC_LIKELY(expr) (__builtin_expect (((expr) ? 1 : 0), 1))
65b5b73dd3Smrg#define FC_UNLIKELY(expr) (__builtin_expect (((expr) ? 1 : 0), 0))
66b5b73dd3Smrg#endif
67b5b73dd3Smrg
68b5b73dd3Smrg#ifdef _WIN32
69b5b73dd3Smrg#  include "fcwindows.h"
70b5b73dd3Smrgtypedef UINT (WINAPI *pfnGetSystemWindowsDirectory)(LPSTR, UINT);
71b5b73dd3Smrgtypedef HRESULT (WINAPI *pfnSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
72b5b73dd3Smrgextern pfnGetSystemWindowsDirectory pGetSystemWindowsDirectory;
73b5b73dd3Smrgextern pfnSHGetFolderPathA pSHGetFolderPathA;
74b5b73dd3Smrg#  define FC_SEARCH_PATH_SEPARATOR ';'
75b5b73dd3Smrg#  define FC_DIR_SEPARATOR         '\\'
76b5b73dd3Smrg#  define FC_DIR_SEPARATOR_S       "\\"
77b5b73dd3Smrg#else
78b5b73dd3Smrg#  define FC_SEARCH_PATH_SEPARATOR ':'
79b5b73dd3Smrg#  define FC_DIR_SEPARATOR         '/'
80b5b73dd3Smrg#  define FC_DIR_SEPARATOR_S       "/"
81b5b73dd3Smrg#endif
82b5b73dd3Smrg
83b5b73dd3Smrg#ifdef PATH_MAX
84b5b73dd3Smrg#define FC_PATH_MAX	PATH_MAX
85b5b73dd3Smrg#else
86b5b73dd3Smrg#define FC_PATH_MAX	128
87b5b73dd3Smrg#endif
88b5b73dd3Smrg
89b5b73dd3Smrg/*
90b5b73dd3Smrg * SCO OpenServer 5.0.7/3.2 has no MAXPATHLEN, but it has PATH_MAX (256).
91b5b73dd3Smrg * in limits.h. PATH_MAX is defined alternatively under non-OpenServer OS,
92b5b73dd3Smrg * and it is used in dirname.c of bmake.
93b5b73dd3Smrg */
94b5b73dd3Smrg#if !defined(PATH_MAX)
95b5b73dd3Smrg#if defined(_SCO_DS)
96b5b73dd3Smrg#define PATH_MAX	1024
97b5b73dd3Smrg#endif
98b5b73dd3Smrg#endif
99b5b73dd3Smrg
100b5b73dd3Smrg#if __GNUC__ >= 4
101b5b73dd3Smrg#define FC_UNUSED	__attribute__((unused))
102b5b73dd3Smrg#else
103b5b73dd3Smrg#define FC_UNUSED
104b5b73dd3Smrg#endif
105b5b73dd3Smrg
106b5b73dd3Smrg#ifndef FC_UINT64_FORMAT
107b5b73dd3Smrg#define FC_UINT64_FORMAT	"llu"
108b5b73dd3Smrg#endif
109b5b73dd3Smrg
110b5b73dd3Smrg#define FC_DBG_MATCH	1
111b5b73dd3Smrg#define FC_DBG_MATCHV	2
112b5b73dd3Smrg#define FC_DBG_EDIT	4
113b5b73dd3Smrg#define FC_DBG_FONTSET	8
114b5b73dd3Smrg#define FC_DBG_CACHE	16
115b5b73dd3Smrg#define FC_DBG_CACHEV	32
116b5b73dd3Smrg#define FC_DBG_PARSE	64
117b5b73dd3Smrg#define FC_DBG_SCAN	128
118b5b73dd3Smrg#define FC_DBG_SCANV	256
119b5b73dd3Smrg#define FC_DBG_CONFIG	1024
120b5b73dd3Smrg#define FC_DBG_LANGSET	2048
121b5b73dd3Smrg#define FC_DBG_MATCH2	4096
122b5b73dd3Smrg
123b5b73dd3Smrg#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1] FC_UNUSED
124b5b73dd3Smrg#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
125b5b73dd3Smrg#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond))
126b5b73dd3Smrg
127b5b73dd3Smrg#define FC_MIN(a,b) ((a) < (b) ? (a) : (b))
128b5b73dd3Smrg#define FC_MAX(a,b) ((a) > (b) ? (a) : (b))
129b5b73dd3Smrg
130b5b73dd3Smrg/* slim_internal.h */
131b5b73dd3Smrg/* Bug of GCC 4.2 (visibility and -fPIC)
132b5b73dd3Smrg   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46861 */
133b5b73dd3Smrg#if (__GNUC__ == 4 && __GNUC_MINOR__ == 2) && defined(__ELF__) && !defined(__sun)
134b5b73dd3Smrg#define FcPrivate
135b5b73dd3Smrg#define HAVE_GNUC_ATTRIBUTE 1
136b5b73dd3Smrg#include "fcalias.h"
137b5b73dd3Smrg#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
138b5b73dd3Smrg#define FcPrivate		__attribute__((__visibility__("hidden")))
139b5b73dd3Smrg#define HAVE_GNUC_ATTRIBUTE 1
140b5b73dd3Smrg#include "fcalias.h"
141b5b73dd3Smrg#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
142b5b73dd3Smrg#define FcPrivate		__hidden
143b5b73dd3Smrg#else /* not gcc >= 3.3 and not Sun Studio >= 8 */
144b5b73dd3Smrg#define FcPrivate
145b5b73dd3Smrg#endif
146b5b73dd3Smrg
147b5b73dd3Smrg/* NLS */
148b5b73dd3Smrg#ifdef ENABLE_NLS
149b5b73dd3Smrg#include <libintl.h>
150b5b73dd3Smrg#define _(x)		(dgettext(GETTEXT_PACKAGE, x))
151b5b73dd3Smrg#else
152b5b73dd3Smrg#define dgettext(d, s)	(s)
153b5b73dd3Smrg#define _(x)		(x)
154b5b73dd3Smrg#endif
155b5b73dd3Smrg
156b5b73dd3Smrg#define N_(x)	x
157b5b73dd3Smrg
158b5b73dd3SmrgFC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
159b5b73dd3Smrg
160b5b73dd3Smrg#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
161b5b73dd3Smrg#define FcFree(s) (free ((FcChar8 *) (s)))
162b5b73dd3Smrg
163b5b73dd3Smrg/*
164b5b73dd3Smrg * Serialized data structures use only offsets instead of pointers
165b5b73dd3Smrg * A low bit of 1 indicates an offset.
166b5b73dd3Smrg */
167b5b73dd3Smrg
168b5b73dd3Smrg/* Is the provided pointer actually an offset? */
169b5b73dd3Smrg#define FcIsEncodedOffset(p)	((((intptr_t) (p)) & 1) != 0)
170b5b73dd3Smrg
171b5b73dd3Smrg/* Encode offset in a pointer of type t */
172b5b73dd3Smrg#define FcOffsetEncode(o,t)	((t *) (intptr_t) ((o) | 1))
173b5b73dd3Smrg
174b5b73dd3Smrg/* Decode a pointer into an offset */
175b5b73dd3Smrg#define FcOffsetDecode(p)	(((intptr_t) (p)) & ~1)
176b5b73dd3Smrg
177b5b73dd3Smrg/* Compute pointer offset */
178b5b73dd3Smrg#define FcPtrToOffset(b,p)	((ptrdiff_t) ((intptr_t) (p) - (intptr_t) (b)))
179b5b73dd3Smrg
180b5b73dd3Smrg/* Given base address, offset and type, return a pointer */
181b5b73dd3Smrg#define FcOffsetToPtr(b,o,t)	((t *) ((intptr_t) (b) + (ptrdiff_t) (o)))
182b5b73dd3Smrg
183b5b73dd3Smrg/* Given base address, encoded offset and type, return a pointer */
184b5b73dd3Smrg#define FcEncodedOffsetToPtr(b,p,t) FcOffsetToPtr(b,FcOffsetDecode(p),t)
185b5b73dd3Smrg
186b5b73dd3Smrg/* Given base address, pointer and type, return an encoded offset */
187b5b73dd3Smrg#define FcPtrToEncodedOffset(b,p,t) FcOffsetEncode(FcPtrToOffset(b,p),t)
188b5b73dd3Smrg
189b5b73dd3Smrg/* Given a structure, offset member and type, return pointer */
190b5b73dd3Smrg#define FcOffsetMember(s,m,t)	    FcOffsetToPtr(s,(s)->m,t)
191b5b73dd3Smrg
192b5b73dd3Smrg/* Given a structure, encoded offset member and type, return pointer to member */
193b5b73dd3Smrg#define FcEncodedOffsetMember(s,m,t) FcOffsetToPtr(s,FcOffsetDecode((s)->m), t)
194b5b73dd3Smrg
195b5b73dd3Smrg/* Given a structure, member and type, convert the member to a pointer */
196b5b73dd3Smrg#define FcPointerMember(s,m,t)	(FcIsEncodedOffset((s)->m) ? \
197b5b73dd3Smrg				 FcEncodedOffsetMember (s,m,t) : \
198b5b73dd3Smrg				 (s)->m)
199b5b73dd3Smrg
200b5b73dd3Smrg/*
201b5b73dd3Smrg * Serialized values may hold strings, charsets and langsets as pointers,
202b5b73dd3Smrg * unfortunately FcValue is an exposed type so we can't just always use
203b5b73dd3Smrg * offsets
204b5b73dd3Smrg */
205b5b73dd3Smrg#define FcValueString(v)	FcPointerMember(v,u.s,FcChar8)
206b5b73dd3Smrg#define FcValueCharSet(v)	FcPointerMember(v,u.c,const FcCharSet)
207b5b73dd3Smrg#define FcValueLangSet(v)	FcPointerMember(v,u.l,const FcLangSet)
208b5b73dd3Smrg#define FcValueRange(v)		FcPointerMember(v,u.r,const FcRange)
209b5b73dd3Smrg
210b5b73dd3Smrgtypedef struct _FcValueList *FcValueListPtr;
211b5b73dd3Smrg
212b5b73dd3Smrgtypedef struct _FcValueList {
213b5b73dd3Smrg    struct _FcValueList	*next;
214b5b73dd3Smrg    FcValue		value;
215b5b73dd3Smrg    FcValueBinding	binding;
216b5b73dd3Smrg} FcValueList;
217b5b73dd3Smrg
218b5b73dd3Smrg#define FcValueListNext(vl)	FcPointerMember(vl,next,FcValueList)
219b5b73dd3Smrg
220b5b73dd3Smrgtypedef int FcObject;
221b5b73dd3Smrg
222b5b73dd3Smrg/* The 1024 is to leave some room for future added internal objects, such
223b5b73dd3Smrg * that caches from newer fontconfig can still be used with older fontconfig
224b5b73dd3Smrg * without getting confused. */
225b5b73dd3Smrg#define FC_EXT_OBJ_INDEX	1024
226b5b73dd3Smrg#define FC_OBJ_ID(_n_)	((_n_) & (~FC_EXT_OBJ_INDEX))
227b5b73dd3Smrg
228b5b73dd3Smrgtypedef struct _FcPatternElt *FcPatternEltPtr;
229b5b73dd3Smrg
230b5b73dd3Smrg/*
231b5b73dd3Smrg * Pattern elts are stuck in a structure connected to the pattern,
232b5b73dd3Smrg * so they get moved around when the pattern is resized. Hence, the
233b5b73dd3Smrg * values field must be a pointer/offset instead of just an offset
234b5b73dd3Smrg */
235b5b73dd3Smrgtypedef struct _FcPatternElt {
236b5b73dd3Smrg    FcObject		object;
237b5b73dd3Smrg    FcValueList		*values;
238b5b73dd3Smrg} FcPatternElt;
239b5b73dd3Smrg
240b5b73dd3Smrg#define FcPatternEltValues(pe)	FcPointerMember(pe,values,FcValueList)
241b5b73dd3Smrg
242b5b73dd3Smrgstruct _FcPattern {
243b5b73dd3Smrg    int		    num;
244b5b73dd3Smrg    int		    size;
245b5b73dd3Smrg    intptr_t	    elts_offset;
246b5b73dd3Smrg    FcRef	    ref;
247b5b73dd3Smrg};
248b5b73dd3Smrg
249b5b73dd3Smrg#define FcPatternElts(p)	FcOffsetMember(p,elts_offset,FcPatternElt)
250b5b73dd3Smrg
251b5b73dd3Smrg#define FcFontSetFonts(fs)	FcPointerMember(fs,fonts,FcPattern *)
252b5b73dd3Smrg
253b5b73dd3Smrg#define FcFontSetFont(fs,i)	(FcIsEncodedOffset((fs)->fonts) ? \
254b5b73dd3Smrg				 FcEncodedOffsetToPtr(fs, \
255b5b73dd3Smrg						      FcFontSetFonts(fs)[i], \
256b5b73dd3Smrg						      FcPattern) : \
257b5b73dd3Smrg				 fs->fonts[i])
258b5b73dd3Smrg
259b5b73dd3Smrgtypedef enum _FcOp {
260b5b73dd3Smrg    FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpRange, FcOpBool, FcOpCharSet, FcOpLangSet,
261b5b73dd3Smrg    FcOpNil,
262b5b73dd3Smrg    FcOpField, FcOpConst,
263b5b73dd3Smrg    FcOpAssign, FcOpAssignReplace,
264b5b73dd3Smrg    FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
265b5b73dd3Smrg    FcOpDelete, FcOpDeleteAll,
266b5b73dd3Smrg    FcOpQuest,
267b5b73dd3Smrg    FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual,
268b5b73dd3Smrg    FcOpContains, FcOpListing, FcOpNotContains,
269b5b73dd3Smrg    FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
270b5b73dd3Smrg    FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
271b5b73dd3Smrg    FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
272b5b73dd3Smrg    FcOpInvalid
273b5b73dd3Smrg} FcOp;
274b5b73dd3Smrg
275b5b73dd3Smrgtypedef enum _FcOpFlags {
276b5b73dd3Smrg	FcOpFlagIgnoreBlanks = 1U << 0
277b5b73dd3Smrg} FcOpFlags;
278b5b73dd3Smrg
279b5b73dd3Smrg#define FC_OP_GET_OP(_x_)	((_x_) & 0xffff)
280b5b73dd3Smrg#define FC_OP_GET_FLAGS(_x_)	(((_x_) & 0xffff0000) >> 16)
281b5b73dd3Smrg#define FC_OP(_x_,_f_)		(FC_OP_GET_OP (_x_) | ((_f_) << 16))
282b5b73dd3Smrg
283b5b73dd3Smrgtypedef struct _FcExprMatrix {
284b5b73dd3Smrg  struct _FcExpr *xx, *xy, *yx, *yy;
285b5b73dd3Smrg} FcExprMatrix;
286b5b73dd3Smrg
287b5b73dd3Smrgtypedef struct _FcExprName {
288b5b73dd3Smrg  FcObject	object;
289b5b73dd3Smrg  FcMatchKind	kind;
290b5b73dd3Smrg} FcExprName;
291b5b73dd3Smrg
292b5b73dd3Smrgstruct _FcRange {
293b5b73dd3Smrg    double begin;
294b5b73dd3Smrg    double end;
295b5b73dd3Smrg};
296b5b73dd3Smrg
297b5b73dd3Smrg
298b5b73dd3Smrgtypedef struct _FcExpr {
299b5b73dd3Smrg    FcOp   op;
300b5b73dd3Smrg    union {
301b5b73dd3Smrg	int		ival;
302b5b73dd3Smrg	double		dval;
303b5b73dd3Smrg	const FcChar8	*sval;
304b5b73dd3Smrg	FcExprMatrix	*mexpr;
305b5b73dd3Smrg	FcBool		bval;
306b5b73dd3Smrg	FcCharSet	*cval;
307b5b73dd3Smrg	FcLangSet	*lval;
308b5b73dd3Smrg	FcRange		*rval;
309b5b73dd3Smrg
310b5b73dd3Smrg	FcExprName	name;
311b5b73dd3Smrg	const FcChar8	*constant;
312b5b73dd3Smrg	struct {
313b5b73dd3Smrg	    struct _FcExpr *left, *right;
314b5b73dd3Smrg	} tree;
315b5b73dd3Smrg    } u;
316b5b73dd3Smrg} FcExpr;
317b5b73dd3Smrg
318b5b73dd3Smrgtypedef struct _FcExprPage FcExprPage;
319b5b73dd3Smrg
320b5b73dd3Smrgstruct _FcExprPage {
321b5b73dd3Smrg  FcExprPage *next_page;
322b5b73dd3Smrg  FcExpr *next;
323b5b73dd3Smrg  FcExpr exprs[(1024 - 2/* two pointers */ - 2/* malloc overhead */) * sizeof (void *) / sizeof (FcExpr)];
324b5b73dd3Smrg  FcExpr end[FLEXIBLE_ARRAY_MEMBER];
325b5b73dd3Smrg};
326b5b73dd3Smrg
327b5b73dd3Smrgtypedef enum _FcQual {
328b5b73dd3Smrg    FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
329b5b73dd3Smrg} FcQual;
330b5b73dd3Smrg
331b5b73dd3Smrg#define FcMatchDefault	((FcMatchKind) -1)
332b5b73dd3Smrg
333b5b73dd3Smrgtypedef struct _FcTest {
334b5b73dd3Smrg    FcMatchKind		kind;
335b5b73dd3Smrg    FcQual		qual;
336b5b73dd3Smrg    FcObject		object;
337b5b73dd3Smrg    FcOp		op;
338b5b73dd3Smrg    FcExpr		*expr;
339b5b73dd3Smrg} FcTest;
340b5b73dd3Smrg
341b5b73dd3Smrgtypedef struct _FcEdit {
342b5b73dd3Smrg    FcObject	    object;
343b5b73dd3Smrg    FcOp	    op;
344b5b73dd3Smrg    FcExpr	    *expr;
345b5b73dd3Smrg    FcValueBinding  binding;
346b5b73dd3Smrg} FcEdit;
347b5b73dd3Smrg
348b5b73dd3Smrgtypedef void (* FcDestroyFunc) (void *data);
349b5b73dd3Smrg
350b5b73dd3Smrgtypedef struct _FcPtrList	FcPtrList;
351b5b73dd3Smrg/* need to sync with FcConfigFileInfoIter at fontconfig.h */
352b5b73dd3Smrgtypedef struct _FcPtrListIter {
353b5b73dd3Smrg    void *dummy1;
354b5b73dd3Smrg    void *dummy2;
355b5b73dd3Smrg    void *dummy3;
356b5b73dd3Smrg} FcPtrListIter;
357b5b73dd3Smrg
358b5b73dd3Smrgtypedef enum _FcRuleType {
359b5b73dd3Smrg    FcRuleUnknown, FcRuleTest, FcRuleEdit
360b5b73dd3Smrg} FcRuleType;
361b5b73dd3Smrg
362b5b73dd3Smrgtypedef struct _FcRule {
363b5b73dd3Smrg    struct _FcRule *next;
364b5b73dd3Smrg    FcRuleType      type;
365b5b73dd3Smrg    union {
366b5b73dd3Smrg	FcTest *test;
367b5b73dd3Smrg	FcEdit *edit;
368b5b73dd3Smrg    } u;
369b5b73dd3Smrg} FcRule;
370b5b73dd3Smrg
371b5b73dd3Smrgtypedef struct _FcRuleSet {
372b5b73dd3Smrg    FcRef	ref;
373b5b73dd3Smrg    FcChar8	*name;
374b5b73dd3Smrg    FcChar8	*description;
375b5b73dd3Smrg    FcChar8	*domain;
376b5b73dd3Smrg    FcBool	enabled;
377b5b73dd3Smrg    FcPtrList	*subst[FcMatchKindEnd];
378b5b73dd3Smrg} FcRuleSet;
379b5b73dd3Smrg
380b5b73dd3Smrgtypedef struct _FcCharLeaf {
381b5b73dd3Smrg    FcChar32	map[256/32];
382b5b73dd3Smrg} FcCharLeaf;
383b5b73dd3Smrg
384b5b73dd3Smrgstruct _FcCharSet {
385b5b73dd3Smrg    FcRef	    ref;	/* reference count */
386b5b73dd3Smrg    int		    num;	/* size of leaves and numbers arrays */
387b5b73dd3Smrg    intptr_t	    leaves_offset;
388b5b73dd3Smrg    intptr_t	    numbers_offset;
389b5b73dd3Smrg};
390b5b73dd3Smrg
391b5b73dd3Smrg#define FcCharSetLeaves(c)	FcOffsetMember(c,leaves_offset,intptr_t)
392b5b73dd3Smrg#define FcCharSetLeaf(c,i)	(FcOffsetToPtr(FcCharSetLeaves(c), \
393b5b73dd3Smrg					       FcCharSetLeaves(c)[i], \
394b5b73dd3Smrg					       FcCharLeaf))
395b5b73dd3Smrg#define FcCharSetNumbers(c)	FcOffsetMember(c,numbers_offset,FcChar16)
396b5b73dd3Smrg
397b5b73dd3Smrg#define FCSS_DEFAULT            0 /* default behavior */
398b5b73dd3Smrg#define FCSS_ALLOW_DUPLICATES   1 /* allows for duplicate strings in the set */
399b5b73dd3Smrg#define FCSS_GROW_BY_64         2 /* grows buffer by 64 elements instead of 1 */
400b5b73dd3Smrg
401b5b73dd3Smrg#define FcStrSetHasControlBit(s,c)  (s->control & c)
402b5b73dd3Smrg#define FcStrSetHasControlBits(s,c) ( (c) == (s->control & (c)) )
403b5b73dd3Smrg
404b5b73dd3Smrgstruct _FcStrSet {
405b5b73dd3Smrg    FcRef	    ref;	/* reference count */
406b5b73dd3Smrg    int		    num;
407b5b73dd3Smrg    int		    size;
408b5b73dd3Smrg    FcChar8	    **strs;
409b5b73dd3Smrg    unsigned int    control;    /* control bits for set behavior */
410b5b73dd3Smrg};
411b5b73dd3Smrg
412b5b73dd3Smrgstruct _FcStrList {
413b5b73dd3Smrg    FcStrSet	    *set;
414b5b73dd3Smrg    int		    n;
415b5b73dd3Smrg};
416b5b73dd3Smrg
417b5b73dd3Smrgtypedef struct _FcStrBuf {
418b5b73dd3Smrg    FcChar8 *buf;
419b5b73dd3Smrg    FcBool  allocated;
420b5b73dd3Smrg    FcBool  failed;
421b5b73dd3Smrg    int	    len;
422b5b73dd3Smrg    int	    size;
423b5b73dd3Smrg    FcChar8 buf_static[16 * sizeof (void *)];
424b5b73dd3Smrg} FcStrBuf;
425b5b73dd3Smrg
426b5b73dd3Smrgtypedef struct _FcHashTable	FcHashTable;
427b5b73dd3Smrg
428b5b73dd3Smrgtypedef FcChar32 (* FcHashFunc)	   (const FcChar8 *data);
429b5b73dd3Smrgtypedef int	 (* FcCompareFunc) (const FcChar8 *v1, const FcChar8 *v2);
430b5b73dd3Smrgtypedef FcBool	 (* FcCopyFunc)	   (const void *src, void **dest);
431b5b73dd3Smrg
432b5b73dd3Smrg
433b5b73dd3Smrgstruct _FcCache {
434b5b73dd3Smrg    unsigned int magic;              /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */
435b5b73dd3Smrg    int		version;	    /* FC_CACHE_VERSION_NUMBER */
436b5b73dd3Smrg    intptr_t	size;		    /* size of file */
437b5b73dd3Smrg    intptr_t	dir;		    /* offset to dir name */
438b5b73dd3Smrg    intptr_t	dirs;		    /* offset to subdirs */
439b5b73dd3Smrg    int		dirs_count;	    /* number of subdir strings */
440b5b73dd3Smrg    intptr_t	set;		    /* offset to font set */
441b5b73dd3Smrg    int		checksum;	    /* checksum of directory state */
442b5b73dd3Smrg    int64_t	checksum_nano;	    /* checksum of directory state */
443b5b73dd3Smrg};
444b5b73dd3Smrg
445b5b73dd3Smrg#undef FcCacheDir
446b5b73dd3Smrg#undef FcCacheSubdir
447b5b73dd3Smrg#define FcCacheDir(c)	FcOffsetMember(c,dir,FcChar8)
448b5b73dd3Smrg#define FcCacheDirs(c)	FcOffsetMember(c,dirs,intptr_t)
449b5b73dd3Smrg#define FcCacheSet(c)	FcOffsetMember(c,set,FcFontSet)
450b5b73dd3Smrg#define FcCacheSubdir(c,i)  FcOffsetToPtr (FcCacheDirs(c),\
451b5b73dd3Smrg					   FcCacheDirs(c)[i], \
452b5b73dd3Smrg					   FcChar8)
453b5b73dd3Smrg
454b5b73dd3Smrg/*
455b5b73dd3Smrg * Used while constructing a directory cache object
456b5b73dd3Smrg */
457b5b73dd3Smrg
458b5b73dd3Smrgtypedef union _FcAlign {
459b5b73dd3Smrg    double	d;
460b5b73dd3Smrg    int		i;
461b5b73dd3Smrg    intptr_t	ip;
462b5b73dd3Smrg    FcBool	b;
463b5b73dd3Smrg    void	*p;
464b5b73dd3Smrg} FcAlign;
465b5b73dd3Smrg
466b5b73dd3Smrgtypedef struct _FcSerializeBucket {
467b5b73dd3Smrg    const void	*object; /* key */
468b5b73dd3Smrg    uintptr_t	hash;    /* hash of key */
469b5b73dd3Smrg    intptr_t	offset;  /* value */
470b5b73dd3Smrg} FcSerializeBucket;
471b5b73dd3Smrg
472b5b73dd3Smrgtypedef struct _FcCharSetFreezer FcCharSetFreezer;
473b5b73dd3Smrg
474b5b73dd3Smrgtypedef struct _FcSerialize {
475b5b73dd3Smrg    intptr_t		size;
476b5b73dd3Smrg    FcCharSetFreezer	*cs_freezer;
477b5b73dd3Smrg    void		*linear;
478b5b73dd3Smrg    FcSerializeBucket	*buckets;
479b5b73dd3Smrg    size_t		buckets_count;
480b5b73dd3Smrg    size_t		buckets_used;
481b5b73dd3Smrg    size_t		buckets_used_max;
482b5b73dd3Smrg} FcSerialize;
483b5b73dd3Smrg
484b5b73dd3Smrg/*
485b5b73dd3Smrg * To map adobe glyph names to unicode values, a precomputed hash
486b5b73dd3Smrg * table is used
487b5b73dd3Smrg */
488b5b73dd3Smrg
489b5b73dd3Smrgtypedef struct _FcGlyphName {
490b5b73dd3Smrg    FcChar32	ucs;		/* unicode value */
491b5b73dd3Smrg    FcChar8	name[1];	/* name extends beyond struct */
492b5b73dd3Smrg} FcGlyphName;
493b5b73dd3Smrg
494b5b73dd3Smrg/*
495b5b73dd3Smrg * To perform case-insensitive string comparisons, a table
496b5b73dd3Smrg * is used which holds three different kinds of folding data.
497b5b73dd3Smrg *
498b5b73dd3Smrg * The first is a range of upper case values mapping to a range
499b5b73dd3Smrg * of their lower case equivalents.  Within each range, the offset
500b5b73dd3Smrg * between upper and lower case is constant.
501b5b73dd3Smrg *
502b5b73dd3Smrg * The second is a range of upper case values which are interleaved
503b5b73dd3Smrg * with their lower case equivalents.
504b5b73dd3Smrg *
505b5b73dd3Smrg * The third is a set of raw unicode values mapping to a list
506b5b73dd3Smrg * of unicode values for comparison purposes.  This allows conversion
507b5b73dd3Smrg * of ß to "ss" so that SS, ss and ß all match.  A separate array
508b5b73dd3Smrg * holds the list of unicode values for each entry.
509b5b73dd3Smrg *
510b5b73dd3Smrg * These are packed into a single table.  Using a binary search,
511b5b73dd3Smrg * the appropriate entry can be located.
512b5b73dd3Smrg */
513b5b73dd3Smrg
514b5b73dd3Smrg#define FC_CASE_FOLD_RANGE	    0
515b5b73dd3Smrg#define FC_CASE_FOLD_EVEN_ODD	    1
516b5b73dd3Smrg#define FC_CASE_FOLD_FULL	    2
517b5b73dd3Smrg
518b5b73dd3Smrgtypedef struct _FcCaseFold {
519b5b73dd3Smrg    FcChar32	upper;
520b5b73dd3Smrg    FcChar16	method : 2;
521b5b73dd3Smrg    FcChar16	count : 14;
522b5b73dd3Smrg    short    	offset;	    /* lower - upper for RANGE, table id for FULL */
523b5b73dd3Smrg} FcCaseFold;
524b5b73dd3Smrg
525b5b73dd3Smrg#define FC_MAX_FILE_LEN	    4096
526b5b73dd3Smrg
527b5b73dd3Smrg#define FC_CACHE_MAGIC_MMAP	    0xFC02FC04
528b5b73dd3Smrg#define FC_CACHE_MAGIC_ALLOC	    0xFC02FC05
529b5b73dd3Smrg
530b5b73dd3Smrgstruct _FcAtomic {
531b5b73dd3Smrg    FcChar8	*file;		/* original file name */
532b5b73dd3Smrg    FcChar8	*new;		/* temp file name -- write data here */
533b5b73dd3Smrg    FcChar8	*lck;		/* lockfile name (used for locking) */
534b5b73dd3Smrg    FcChar8	*tmp;		/* tmpfile name (used for locking) */
535b5b73dd3Smrg};
536b5b73dd3Smrg
537b5b73dd3Smrgstruct _FcConfig {
538b5b73dd3Smrg    /*
539b5b73dd3Smrg     * File names loaded from the configuration -- saved here as the
540b5b73dd3Smrg     * cache file must be consulted before the directories are scanned,
541b5b73dd3Smrg     * and those directives may occur in any order
542b5b73dd3Smrg     */
543b5b73dd3Smrg    FcStrSet	*configDirs;	    /* directories to scan for fonts */
544b5b73dd3Smrg    /*
545b5b73dd3Smrg     * List of directories containing fonts,
546b5b73dd3Smrg     * built by recursively scanning the set
547b5b73dd3Smrg     * of configured directories
548b5b73dd3Smrg     */
549b5b73dd3Smrg    FcStrSet	*fontDirs;
550b5b73dd3Smrg    /*
551b5b73dd3Smrg     * List of directories containing cache files.
552b5b73dd3Smrg     */
553b5b73dd3Smrg    FcStrSet	*cacheDirs;
554b5b73dd3Smrg    /*
555b5b73dd3Smrg     * Names of all of the configuration files used
556b5b73dd3Smrg     * to create this configuration
557b5b73dd3Smrg     */
558b5b73dd3Smrg    FcStrSet	*configFiles;	    /* config files loaded */
559b5b73dd3Smrg    /*
560b5b73dd3Smrg     * Substitution instructions for patterns and fonts;
561b5b73dd3Smrg     * maxObjects is used to allocate appropriate intermediate storage
562b5b73dd3Smrg     * while performing a whole set of substitutions
563b5b73dd3Smrg     *
564b5b73dd3Smrg     * 0.. substitutions for patterns
565b5b73dd3Smrg     * 1.. substitutions for fonts
566b5b73dd3Smrg     * 2.. substitutions for scanned fonts
567b5b73dd3Smrg     */
568b5b73dd3Smrg    FcPtrList	*subst[FcMatchKindEnd];
569b5b73dd3Smrg    int		maxObjects;	    /* maximum number of tests in all substs */
570b5b73dd3Smrg    /*
571b5b73dd3Smrg     * List of patterns used to control font file selection
572b5b73dd3Smrg     */
573b5b73dd3Smrg    FcStrSet	*acceptGlobs;
574b5b73dd3Smrg    FcStrSet	*rejectGlobs;
575b5b73dd3Smrg    FcFontSet	*acceptPatterns;
576b5b73dd3Smrg    FcFontSet	*rejectPatterns;
577b5b73dd3Smrg    /*
578b5b73dd3Smrg     * The set of fonts loaded from the listed directories; the
579b5b73dd3Smrg     * order within the set does not determine the font selection,
580b5b73dd3Smrg     * except in the case of identical matches in which case earlier fonts
581b5b73dd3Smrg     * match preferrentially
582b5b73dd3Smrg     */
583b5b73dd3Smrg    FcFontSet	*fonts[FcSetApplication + 1];
584b5b73dd3Smrg    /*
585b5b73dd3Smrg     * Fontconfig can periodically rescan the system configuration
586b5b73dd3Smrg     * and font directories.  This rescanning occurs when font
587b5b73dd3Smrg     * listing requests are made, but no more often than rescanInterval
588b5b73dd3Smrg     * seconds apart.
589b5b73dd3Smrg     */
590b5b73dd3Smrg    time_t	rescanTime;	    /* last time information was scanned */
591b5b73dd3Smrg    int		rescanInterval;	    /* interval between scans */
592b5b73dd3Smrg
593b5b73dd3Smrg    FcRef	ref;                /* reference count */
594b5b73dd3Smrg
595b5b73dd3Smrg    FcExprPage  *expr_pool;	    /* pool of FcExpr's */
596b5b73dd3Smrg
597b5b73dd3Smrg    FcChar8     *sysRoot;	    /* override the system root directory */
598b5b73dd3Smrg    FcStrSet	*availConfigFiles;  /* config files available */
599b5b73dd3Smrg    FcPtrList	*rulesetList;	    /* List of rulesets being installed */
600b5b73dd3Smrg};
601b5b73dd3Smrg
602b5b73dd3Smrgtypedef struct _FcFileTime {
603b5b73dd3Smrg    time_t  time;
604b5b73dd3Smrg    FcBool  set;
605b5b73dd3Smrg} FcFileTime;
606b5b73dd3Smrg
607b5b73dd3Smrgtypedef struct _FcCharMap FcCharMap;
608b5b73dd3Smrg
609b5b73dd3Smrgtypedef struct _FcStatFS    FcStatFS;
610b5b73dd3Smrg
611b5b73dd3Smrgstruct _FcStatFS {
612b5b73dd3Smrg    FcBool is_remote_fs;
613b5b73dd3Smrg    FcBool is_mtime_broken;
614b5b73dd3Smrg};
615b5b73dd3Smrg
616b5b73dd3Smrgtypedef struct _FcValuePromotionBuffer FcValuePromotionBuffer;
617b5b73dd3Smrg
618b5b73dd3Smrgstruct _FcValuePromotionBuffer {
619b5b73dd3Smrg  union {
620b5b73dd3Smrg    double d;
621b5b73dd3Smrg    int i;
622b5b73dd3Smrg    long l;
623b5b73dd3Smrg    char c[256]; /* Enlarge as needed */
624b5b73dd3Smrg  } u;
625b5b73dd3Smrg};
626b5b73dd3Smrg
627b5b73dd3Smrg/* fccache.c */
628b5b73dd3Smrg
629b5b73dd3SmrgFcPrivate FcCache *
630b5b73dd3SmrgFcDirCacheScan (const FcChar8 *dir, FcConfig *config);
631b5b73dd3Smrg
632b5b73dd3SmrgFcPrivate FcCache *
633b5b73dd3SmrgFcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcStrSet *dirs);
634b5b73dd3Smrg
635b5b73dd3SmrgFcPrivate FcCache *
636b5b73dd3SmrgFcDirCacheRebuild (FcCache *cache, struct stat *dir_stat, FcStrSet *dirs);
637b5b73dd3Smrg
638b5b73dd3SmrgFcPrivate FcBool
639b5b73dd3SmrgFcDirCacheWrite (FcCache *cache, FcConfig *config);
640b5b73dd3Smrg
641b5b73dd3SmrgFcPrivate FcBool
642b5b73dd3SmrgFcDirCacheCreateTagFile (const FcChar8 *cache_dir);
643b5b73dd3Smrg
644b5b73dd3SmrgFcPrivate void
645b5b73dd3SmrgFcCacheObjectReference (void *object);
646b5b73dd3Smrg
647b5b73dd3SmrgFcPrivate void
648b5b73dd3SmrgFcCacheObjectDereference (void *object);
649b5b73dd3Smrg
650b5b73dd3SmrgFcPrivate void *
651b5b73dd3SmrgFcCacheAllocate (FcCache *cache, size_t len);
652b5b73dd3Smrg
653b5b73dd3SmrgFcPrivate void
654b5b73dd3SmrgFcCacheFini (void);
655b5b73dd3Smrg
656b5b73dd3Smrg
657b5b73dd3SmrgFcPrivate void
658b5b73dd3SmrgFcDirCacheReference (FcCache *cache, int nref);
659b5b73dd3Smrg
660b5b73dd3SmrgFcPrivate int
661b5b73dd3SmrgFcDirCacheLock (const FcChar8 *dir,
662b5b73dd3Smrg		FcConfig      *config);
663b5b73dd3Smrg
664b5b73dd3SmrgFcPrivate void
665b5b73dd3SmrgFcDirCacheUnlock (int fd);
666b5b73dd3Smrg
667b5b73dd3Smrg/* fccfg.c */
668b5b73dd3Smrg
669b5b73dd3SmrgFcPrivate FcBool
670b5b73dd3SmrgFcConfigInit (void);
671b5b73dd3Smrg
672b5b73dd3SmrgFcPrivate void
673b5b73dd3SmrgFcConfigFini (void);
674b5b73dd3Smrg
675b5b73dd3SmrgFcPrivate FcChar8 *
676b5b73dd3SmrgFcConfigXdgCacheHome (void);
677b5b73dd3Smrg
678b5b73dd3SmrgFcPrivate FcChar8 *
679b5b73dd3SmrgFcConfigXdgConfigHome (void);
680b5b73dd3Smrg
681b5b73dd3SmrgFcPrivate FcChar8 *
682b5b73dd3SmrgFcConfigXdgDataHome (void);
683b5b73dd3Smrg
684b5b73dd3SmrgFcPrivate FcStrSet *
685b5b73dd3SmrgFcConfigXdgDataDirs (void);
686b5b73dd3Smrg
687b5b73dd3SmrgFcPrivate FcExpr *
688b5b73dd3SmrgFcConfigAllocExpr (FcConfig *config);
689b5b73dd3Smrg
690b5b73dd3SmrgFcPrivate FcBool
691b5b73dd3SmrgFcConfigAddConfigDir (FcConfig	    *config,
692b5b73dd3Smrg		      const FcChar8 *d);
693b5b73dd3Smrg
694b5b73dd3SmrgFcPrivate FcBool
695b5b73dd3SmrgFcConfigAddFontDir (FcConfig	    *config,
696b5b73dd3Smrg		    const FcChar8   *d,
697b5b73dd3Smrg		    const FcChar8   *m,
698b5b73dd3Smrg		    const FcChar8   *salt);
699b5b73dd3Smrg
700b5b73dd3SmrgFcPrivate FcBool
701b5b73dd3SmrgFcConfigResetFontDirs (FcConfig *config);
702b5b73dd3Smrg
703b5b73dd3SmrgFcPrivate FcChar8 *
704b5b73dd3SmrgFcConfigMapFontPath(FcConfig		*config,
705b5b73dd3Smrg		    const FcChar8	*path);
706b5b73dd3Smrg
707b5b73dd3SmrgFcPrivate const FcChar8 *
708b5b73dd3SmrgFcConfigMapSalt (FcConfig      *config,
709b5b73dd3Smrg		 const FcChar8 *path);
710b5b73dd3Smrg
711b5b73dd3SmrgFcPrivate FcBool
712b5b73dd3SmrgFcConfigAddCacheDir (FcConfig	    *config,
713b5b73dd3Smrg		     const FcChar8  *d);
714b5b73dd3Smrg
715b5b73dd3SmrgFcPrivate FcBool
716b5b73dd3SmrgFcConfigAddConfigFile (FcConfig		*config,
717b5b73dd3Smrg		       const FcChar8	*f);
718b5b73dd3Smrg
719b5b73dd3SmrgFcPrivate FcBool
720b5b73dd3SmrgFcConfigAddBlank (FcConfig	*config,
721b5b73dd3Smrg		  FcChar32    	blank);
722b5b73dd3Smrg
723b5b73dd3SmrgFcBool
724b5b73dd3SmrgFcConfigAddRule (FcConfig	*config,
725b5b73dd3Smrg		 FcRule		*rule,
726b5b73dd3Smrg		 FcMatchKind	kind);
727b5b73dd3Smrg
728b5b73dd3SmrgFcPrivate void
729b5b73dd3SmrgFcConfigSetFonts (FcConfig	*config,
730b5b73dd3Smrg		  FcFontSet	*fonts,
731b5b73dd3Smrg		  FcSetName	set);
732b5b73dd3Smrg
733b5b73dd3SmrgFcPrivate FcBool
734b5b73dd3SmrgFcConfigCompareValue (const FcValue *m,
735b5b73dd3Smrg		      unsigned int   op_,
736b5b73dd3Smrg		      const FcValue *v);
737b5b73dd3Smrg
738b5b73dd3SmrgFcPrivate FcBool
739b5b73dd3SmrgFcConfigGlobAdd (FcConfig	*config,
740b5b73dd3Smrg		 const FcChar8	*glob,
741b5b73dd3Smrg		 FcBool		accept);
742b5b73dd3Smrg
743b5b73dd3SmrgFcPrivate FcBool
744b5b73dd3SmrgFcConfigAcceptFilename (FcConfig	*config,
745b5b73dd3Smrg			const FcChar8	*filename);
746b5b73dd3Smrg
747b5b73dd3SmrgFcPrivate FcBool
748b5b73dd3SmrgFcConfigPatternsAdd (FcConfig	*config,
749b5b73dd3Smrg		     FcPattern	*pattern,
750b5b73dd3Smrg		     FcBool	accept);
751b5b73dd3Smrg
752b5b73dd3SmrgFcPrivate FcBool
753b5b73dd3SmrgFcConfigAcceptFont (FcConfig	    *config,
754b5b73dd3Smrg		    const FcPattern *font);
755b5b73dd3Smrg
756b5b73dd3SmrgFcPrivate FcFileTime
757b5b73dd3SmrgFcConfigModifiedTime (FcConfig *config);
758b5b73dd3Smrg
759b5b73dd3SmrgFcPrivate FcBool
760b5b73dd3SmrgFcConfigAddCache (FcConfig *config, FcCache *cache,
761b5b73dd3Smrg		  FcSetName set, FcStrSet *dirSet, FcChar8 *forDir);
762b5b73dd3Smrg
763b5b73dd3SmrgFcPrivate FcRuleSet *
764b5b73dd3SmrgFcRuleSetCreate (const FcChar8 *name);
765b5b73dd3Smrg
766b5b73dd3SmrgFcPrivate void
767b5b73dd3SmrgFcRuleSetDestroy (FcRuleSet *rs);
768b5b73dd3Smrg
769b5b73dd3SmrgFcPrivate void
770b5b73dd3SmrgFcRuleSetReference (FcRuleSet *rs);
771b5b73dd3Smrg
772b5b73dd3SmrgFcPrivate void
773b5b73dd3SmrgFcRuleSetEnable (FcRuleSet	*rs,
774b5b73dd3Smrg		 FcBool		flag);
775b5b73dd3Smrg
776b5b73dd3SmrgFcPrivate void
777b5b73dd3SmrgFcRuleSetAddDescription (FcRuleSet	*rs,
778b5b73dd3Smrg			 const FcChar8	*domain,
779b5b73dd3Smrg			 const FcChar8	*description);
780b5b73dd3Smrg
781b5b73dd3SmrgFcPrivate int
782b5b73dd3SmrgFcRuleSetAdd (FcRuleSet		*rs,
783b5b73dd3Smrg	      FcRule		*rule,
784b5b73dd3Smrg	      FcMatchKind	kind);
785b5b73dd3Smrg
786b5b73dd3Smrg/* fcserialize.c */
787b5b73dd3SmrgFcPrivate intptr_t
788b5b73dd3SmrgFcAlignSize (intptr_t size);
789b5b73dd3Smrg
790b5b73dd3SmrgFcPrivate FcSerialize *
791b5b73dd3SmrgFcSerializeCreate (void);
792b5b73dd3Smrg
793b5b73dd3SmrgFcPrivate void
794b5b73dd3SmrgFcSerializeDestroy (FcSerialize *serialize);
795b5b73dd3Smrg
796b5b73dd3SmrgFcPrivate FcBool
797b5b73dd3SmrgFcSerializeAlloc (FcSerialize *serialize, const void *object, int size);
798b5b73dd3Smrg
799b5b73dd3SmrgFcPrivate intptr_t
800b5b73dd3SmrgFcSerializeReserve (FcSerialize *serialize, int size);
801b5b73dd3Smrg
802b5b73dd3SmrgFcPrivate intptr_t
803b5b73dd3SmrgFcSerializeOffset (FcSerialize *serialize, const void *object);
804b5b73dd3Smrg
805b5b73dd3SmrgFcPrivate void *
806b5b73dd3SmrgFcSerializePtr (FcSerialize *serialize, const void *object);
807b5b73dd3Smrg
808b5b73dd3SmrgFcPrivate FcBool
809b5b73dd3SmrgFcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l);
810b5b73dd3Smrg
811b5b73dd3SmrgFcPrivate FcLangSet *
812b5b73dd3SmrgFcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l);
813b5b73dd3Smrg
814b5b73dd3Smrg/* fccharset.c */
815b5b73dd3SmrgFcPrivate FcCharSet *
816b5b73dd3SmrgFcCharSetPromote (FcValuePromotionBuffer *vbuf);
817b5b73dd3Smrg
818b5b73dd3SmrgFcPrivate void
819b5b73dd3SmrgFcLangCharSetPopulate (void);
820b5b73dd3Smrg
821b5b73dd3SmrgFcPrivate FcCharSetFreezer *
822b5b73dd3SmrgFcCharSetFreezerCreate (void);
823b5b73dd3Smrg
824b5b73dd3SmrgFcPrivate const FcCharSet *
825b5b73dd3SmrgFcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs);
826b5b73dd3Smrg
827b5b73dd3SmrgFcPrivate void
828b5b73dd3SmrgFcCharSetFreezerDestroy (FcCharSetFreezer *freezer);
829b5b73dd3Smrg
830b5b73dd3SmrgFcPrivate FcBool
831b5b73dd3SmrgFcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
832b5b73dd3Smrg
833b5b73dd3SmrgFcPrivate FcCharSet *
834b5b73dd3SmrgFcNameParseCharSet (FcChar8 *string);
835b5b73dd3Smrg
836b5b73dd3SmrgFcPrivate FcBool
837b5b73dd3SmrgFcNameUnparseValue (FcStrBuf    *buf,
838b5b73dd3Smrg                    FcValue     *v0,
839b5b73dd3Smrg		    FcChar8     *escape);
840b5b73dd3Smrg
841b5b73dd3SmrgFcPrivate FcBool
842b5b73dd3SmrgFcNameUnparseValueList (FcStrBuf	*buf,
843b5b73dd3Smrg			FcValueListPtr	v,
844b5b73dd3Smrg			FcChar8		*escape);
845b5b73dd3Smrg
846b5b73dd3SmrgFcPrivate FcCharLeaf *
847b5b73dd3SmrgFcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
848b5b73dd3Smrg
849b5b73dd3SmrgFcPrivate FcBool
850b5b73dd3SmrgFcCharSetSerializeAlloc(FcSerialize *serialize, const FcCharSet *cs);
851b5b73dd3Smrg
852b5b73dd3SmrgFcPrivate FcCharSet *
853b5b73dd3SmrgFcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs);
854b5b73dd3Smrg
855b5b73dd3SmrgFcPrivate FcChar16 *
856b5b73dd3SmrgFcCharSetGetNumbers(const FcCharSet *c);
857b5b73dd3Smrg
858b5b73dd3Smrg/* fccompat.c */
859b5b73dd3SmrgFcPrivate int
860b5b73dd3SmrgFcOpen(const char *pathname, int flags, ...);
861b5b73dd3Smrg
862b5b73dd3SmrgFcPrivate int
863b5b73dd3SmrgFcMakeTempfile (char *template);
864b5b73dd3Smrg
865b5b73dd3SmrgFcPrivate int32_t
866b5b73dd3SmrgFcRandom (void);
867b5b73dd3Smrg
868b5b73dd3SmrgFcPrivate FcBool
869b5b73dd3SmrgFcMakeDirectory (const FcChar8 *dir);
870b5b73dd3Smrg
871b5b73dd3SmrgFcPrivate ssize_t
872b5b73dd3SmrgFcReadLink (const FcChar8 *pathname,
873b5b73dd3Smrg	    FcChar8       *buf,
874b5b73dd3Smrg	    size_t         bufsiz);
875b5b73dd3Smrg
876b5b73dd3Smrg/* fcdbg.c */
877b5b73dd3Smrg
878b5b73dd3SmrgFcPrivate void
879b5b73dd3SmrgFcValuePrintFile (FILE *f, const FcValue v);
880b5b73dd3Smrg
881b5b73dd3SmrgFcPrivate void
882b5b73dd3SmrgFcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark);
883b5b73dd3Smrg
884b5b73dd3SmrgFcPrivate void
885b5b73dd3SmrgFcValueListPrintWithPosition (FcValueListPtr l, const FcValueListPtr pos);
886b5b73dd3Smrg
887b5b73dd3SmrgFcPrivate void
888b5b73dd3SmrgFcValueListPrint (FcValueListPtr l);
889b5b73dd3Smrg
890b5b73dd3SmrgFcPrivate void
891b5b73dd3SmrgFcLangSetPrint (const FcLangSet *ls);
892b5b73dd3Smrg
893b5b73dd3SmrgFcPrivate void
894b5b73dd3SmrgFcOpPrint (FcOp op);
895b5b73dd3Smrg
896b5b73dd3SmrgFcPrivate void
897b5b73dd3SmrgFcTestPrint (const FcTest *test);
898b5b73dd3Smrg
899b5b73dd3SmrgFcPrivate void
900b5b73dd3SmrgFcExprPrint (const FcExpr *expr);
901b5b73dd3Smrg
902b5b73dd3SmrgFcPrivate void
903b5b73dd3SmrgFcEditPrint (const FcEdit *edit);
904b5b73dd3Smrg
905b5b73dd3SmrgFcPrivate void
906b5b73dd3SmrgFcRulePrint (const FcRule *rule);
907b5b73dd3Smrg
908b5b73dd3SmrgFcPrivate void
909b5b73dd3SmrgFcCharSetPrint (const FcCharSet *c);
910b5b73dd3Smrg
911b5b73dd3SmrgFcPrivate void
912b5b73dd3SmrgFcPatternPrint2 (FcPattern *p1, FcPattern *p2, const FcObjectSet *os);
913b5b73dd3Smrg
914b5b73dd3Smrgextern FcPrivate int FcDebugVal;
915b5b73dd3Smrg
916b5b73dd3Smrg#define FcDebug() (FcDebugVal)
917b5b73dd3Smrg
918b5b73dd3SmrgFcPrivate void
919b5b73dd3SmrgFcInitDebug (void);
920b5b73dd3Smrg
921b5b73dd3Smrg/* fcdefault.c */
922b5b73dd3SmrgFcPrivate FcChar8 *
923b5b73dd3SmrgFcGetDefaultLang (void);
924b5b73dd3Smrg
925b5b73dd3SmrgFcPrivate FcChar8 *
926b5b73dd3SmrgFcGetPrgname (void);
927b5b73dd3Smrg
928b5b73dd3SmrgFcPrivate FcChar8 *
929b5b73dd3SmrgFcGetDesktopName (void);
930b5b73dd3Smrg
931b5b73dd3SmrgFcPrivate void
932b5b73dd3SmrgFcDefaultFini (void);
933b5b73dd3Smrg
934b5b73dd3Smrg/* fcdir.c */
935b5b73dd3Smrg
936b5b73dd3SmrgFcPrivate FcBool
937b5b73dd3SmrgFcFileIsLink (const FcChar8 *file);
938b5b73dd3Smrg
939b5b73dd3SmrgFcPrivate FcBool
940b5b73dd3SmrgFcFileIsFile (const FcChar8 *file);
941b5b73dd3Smrg
942b5b73dd3SmrgFcPrivate FcBool
943b5b73dd3SmrgFcFileScanConfig (FcFontSet	*set,
944b5b73dd3Smrg		  FcStrSet	*dirs,
945b5b73dd3Smrg		  const FcChar8 *file,
946b5b73dd3Smrg		  FcConfig	*config);
947b5b73dd3Smrg
948b5b73dd3SmrgFcPrivate FcBool
949b5b73dd3SmrgFcDirScanConfig (FcFontSet	*set,
950b5b73dd3Smrg		 FcStrSet	*dirs,
951b5b73dd3Smrg		 const FcChar8	*dir,
952b5b73dd3Smrg		 FcBool		force,
953b5b73dd3Smrg		 FcConfig	*config);
954b5b73dd3Smrg
955b5b73dd3Smrg/* fcfont.c */
956b5b73dd3SmrgFcPrivate int
957b5b73dd3SmrgFcFontDebug (void);
958b5b73dd3Smrg
959b5b73dd3Smrg/* fcfs.c */
960b5b73dd3Smrg
961b5b73dd3SmrgFcPrivate FcBool
962b5b73dd3SmrgFcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s);
963b5b73dd3Smrg
964b5b73dd3SmrgFcPrivate FcFontSet *
965b5b73dd3SmrgFcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
966b5b73dd3Smrg
967b5b73dd3SmrgFcPrivate FcFontSet *
968b5b73dd3SmrgFcFontSetDeserialize (const FcFontSet *set);
969b5b73dd3Smrg
970b5b73dd3Smrg/* fcplist.c */
971b5b73dd3SmrgFcPrivate FcPtrList *
972b5b73dd3SmrgFcPtrListCreate (FcDestroyFunc func);
973b5b73dd3Smrg
974b5b73dd3SmrgFcPrivate void
975b5b73dd3SmrgFcPtrListDestroy (FcPtrList *list);
976b5b73dd3Smrg
977b5b73dd3SmrgFcPrivate void
978b5b73dd3SmrgFcPtrListIterInit (const FcPtrList	*list,
979b5b73dd3Smrg		   FcPtrListIter	*iter);
980b5b73dd3Smrg
981b5b73dd3SmrgFcPrivate void
982b5b73dd3SmrgFcPtrListIterInitAtLast (FcPtrList	*list,
983b5b73dd3Smrg			 FcPtrListIter	*iter);
984b5b73dd3Smrg
985b5b73dd3SmrgFcPrivate FcBool
986b5b73dd3SmrgFcPtrListIterNext (const FcPtrList	*list,
987b5b73dd3Smrg		   FcPtrListIter	*iter);
988b5b73dd3Smrg
989b5b73dd3SmrgFcPrivate FcBool
990b5b73dd3SmrgFcPtrListIterIsValid (const FcPtrList		*list,
991b5b73dd3Smrg		      const FcPtrListIter	*iter);
992b5b73dd3Smrg
993b5b73dd3SmrgFcPrivate void *
994b5b73dd3SmrgFcPtrListIterGetValue (const FcPtrList		*list,
995b5b73dd3Smrg		       const FcPtrListIter	*iter);
996b5b73dd3Smrg
997b5b73dd3SmrgFcPrivate FcBool
998b5b73dd3SmrgFcPtrListIterAdd (FcPtrList	*list,
999b5b73dd3Smrg		  FcPtrListIter	*iter,
1000b5b73dd3Smrg		void		*data);
1001b5b73dd3Smrg
1002b5b73dd3SmrgFcPrivate FcBool
1003b5b73dd3SmrgFcPtrListIterRemove (FcPtrList		*list,
1004b5b73dd3Smrg		     FcPtrListIter	*iter);
1005b5b73dd3Smrg
1006b5b73dd3Smrg/* fcinit.c */
1007b5b73dd3SmrgFcPrivate FcConfig *
1008b5b73dd3SmrgFcInitLoadOwnConfig (FcConfig *config);
1009b5b73dd3Smrg
1010b5b73dd3SmrgFcPrivate FcConfig *
1011b5b73dd3SmrgFcInitLoadOwnConfigAndFonts (FcConfig *config);
1012b5b73dd3Smrg
1013b5b73dd3Smrg/* fcxml.c */
1014b5b73dd3SmrgFcPrivate void
1015b5b73dd3SmrgFcConfigPathFini (void);
1016b5b73dd3Smrg
1017b5b73dd3SmrgFcPrivate void
1018b5b73dd3SmrgFcTestDestroy (FcTest *test);
1019b5b73dd3Smrg
1020b5b73dd3SmrgFcPrivate void
1021b5b73dd3SmrgFcEditDestroy (FcEdit *e);
1022b5b73dd3Smrg
1023b5b73dd3Smrgvoid
1024b5b73dd3SmrgFcRuleDestroy (FcRule *rule);
1025b5b73dd3Smrg
1026b5b73dd3Smrg/* fclang.c */
1027b5b73dd3SmrgFcPrivate FcLangSet *
1028b5b73dd3SmrgFcFreeTypeLangSet (const FcCharSet  *charset,
1029b5b73dd3Smrg		   const FcChar8    *exclusiveLang);
1030b5b73dd3Smrg
1031b5b73dd3SmrgFcPrivate FcLangResult
1032b5b73dd3SmrgFcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
1033b5b73dd3Smrg
1034b5b73dd3SmrgFcPrivate FcLangSet *
1035b5b73dd3SmrgFcLangSetPromote (const FcChar8 *lang, FcValuePromotionBuffer *buf);
1036b5b73dd3Smrg
1037b5b73dd3SmrgFcPrivate FcLangSet *
1038b5b73dd3SmrgFcNameParseLangSet (const FcChar8 *string);
1039b5b73dd3Smrg
1040b5b73dd3SmrgFcPrivate FcBool
1041b5b73dd3SmrgFcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
1042b5b73dd3Smrg
1043b5b73dd3SmrgFcPrivate FcChar8 *
1044b5b73dd3SmrgFcNameUnparseEscaped (FcPattern *pat, FcBool escape);
1045b5b73dd3Smrg
1046b5b73dd3SmrgFcPrivate FcBool
1047b5b73dd3SmrgFcConfigParseOnly (FcConfig		*config,
1048b5b73dd3Smrg		   const FcChar8	*name,
1049b5b73dd3Smrg		   FcBool		complain);
1050b5b73dd3Smrg
1051b5b73dd3SmrgFcPrivate FcChar8 *
1052b5b73dd3SmrgFcConfigRealFilename (FcConfig		*config,
1053b5b73dd3Smrg		      const FcChar8	*url);
1054b5b73dd3Smrg
1055b5b73dd3Smrg/* fclist.c */
1056b5b73dd3Smrg
1057b5b73dd3SmrgFcPrivate FcBool
1058b5b73dd3SmrgFcListPatternMatchAny (const FcPattern *p,
1059b5b73dd3Smrg		       const FcPattern *font);
1060b5b73dd3Smrg
1061b5b73dd3Smrg/* fcmatch.c */
1062b5b73dd3Smrg
1063b5b73dd3Smrg/* fcname.c */
1064b5b73dd3Smrg
1065b5b73dd3Smrgenum {
1066b5b73dd3Smrg  FC_INVALID_OBJECT = 0,
1067b5b73dd3Smrg#define FC_OBJECT(NAME, Type, Cmp) FC_##NAME##_OBJECT,
1068b5b73dd3Smrg#include "fcobjs.h"
1069b5b73dd3Smrg#undef FC_OBJECT
1070b5b73dd3Smrg  FC_ONE_AFTER_MAX_BASE_OBJECT
1071b5b73dd3Smrg#define FC_MAX_BASE_OBJECT (FC_ONE_AFTER_MAX_BASE_OBJECT - 1)
1072b5b73dd3Smrg};
1073b5b73dd3Smrg
1074b5b73dd3SmrgFcPrivate FcBool
1075b5b73dd3SmrgFcNameConstantWithObjectCheck (const FcChar8 *string, const char *object, int *result);
1076b5b73dd3Smrg
1077b5b73dd3SmrgFcPrivate FcBool
1078b5b73dd3SmrgFcNameBool (const FcChar8 *v, FcBool *result);
1079b5b73dd3Smrg
1080b5b73dd3SmrgFcPrivate FcBool
1081b5b73dd3SmrgFcObjectValidType (FcObject object, FcType type);
1082b5b73dd3Smrg
1083b5b73dd3SmrgFcPrivate FcObject
1084b5b73dd3SmrgFcObjectFromName (const char * name);
1085b5b73dd3Smrg
1086b5b73dd3SmrgFcPrivate const char *
1087b5b73dd3SmrgFcObjectName (FcObject object);
1088b5b73dd3Smrg
1089b5b73dd3SmrgFcPrivate FcObjectSet *
1090b5b73dd3SmrgFcObjectGetSet (void);
1091b5b73dd3Smrg
1092b5b73dd3Smrg#define FcObjectCompare(a, b)	((int) a - (int) b)
1093b5b73dd3Smrg
1094b5b73dd3Smrg/* fcpat.c */
1095b5b73dd3Smrg
1096b5b73dd3SmrgFcPrivate FcValue
1097b5b73dd3SmrgFcValueCanonicalize (const FcValue *v);
1098b5b73dd3Smrg
1099b5b73dd3SmrgFcPrivate FcValueListPtr
1100b5b73dd3SmrgFcValueListCreate (void);
1101b5b73dd3Smrg
1102b5b73dd3SmrgFcPrivate void
1103b5b73dd3SmrgFcValueListDestroy (FcValueListPtr l);
1104b5b73dd3Smrg
1105b5b73dd3SmrgFcPrivate FcValueListPtr
1106b5b73dd3SmrgFcValueListPrepend (FcValueListPtr vallist,
1107b5b73dd3Smrg		    FcValue        value,
1108b5b73dd3Smrg		    FcValueBinding binding);
1109b5b73dd3Smrg
1110b5b73dd3SmrgFcPrivate FcValueListPtr
1111b5b73dd3SmrgFcValueListAppend (FcValueListPtr vallist,
1112b5b73dd3Smrg		   FcValue        value,
1113b5b73dd3Smrg		   FcValueBinding binding);
1114b5b73dd3Smrg
1115b5b73dd3SmrgFcPrivate FcValueListPtr
1116b5b73dd3SmrgFcValueListDuplicate(FcValueListPtr orig);
1117b5b73dd3Smrg
1118b5b73dd3SmrgFcPrivate FcPatternElt *
1119b5b73dd3SmrgFcPatternObjectFindElt (const FcPattern *p, FcObject object);
1120b5b73dd3Smrg
1121b5b73dd3SmrgFcPrivate FcPatternElt *
1122b5b73dd3SmrgFcPatternObjectInsertElt (FcPattern *p, FcObject object);
1123b5b73dd3Smrg
1124b5b73dd3SmrgFcPrivate FcBool
1125b5b73dd3SmrgFcPatternObjectListAdd (FcPattern	*p,
1126b5b73dd3Smrg			FcObject	object,
1127b5b73dd3Smrg			FcValueListPtr	list,
1128b5b73dd3Smrg			FcBool		append);
1129b5b73dd3Smrg
1130b5b73dd3SmrgFcPrivate FcBool
1131b5b73dd3SmrgFcPatternObjectAddWithBinding  (FcPattern	*p,
1132b5b73dd3Smrg				FcObject	object,
1133b5b73dd3Smrg				FcValue		value,
1134b5b73dd3Smrg				FcValueBinding  binding,
1135b5b73dd3Smrg				FcBool		append);
1136b5b73dd3Smrg
1137b5b73dd3SmrgFcPrivate FcBool
1138b5b73dd3SmrgFcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append);
1139b5b73dd3Smrg
1140b5b73dd3SmrgFcPrivate FcBool
1141b5b73dd3SmrgFcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
1142b5b73dd3Smrg
1143b5b73dd3SmrgFcPrivate FcResult
1144b5b73dd3SmrgFcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b);
1145b5b73dd3Smrg
1146b5b73dd3SmrgFcPrivate FcResult
1147b5b73dd3SmrgFcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
1148b5b73dd3Smrg
1149b5b73dd3SmrgFcPrivate FcBool
1150b5b73dd3SmrgFcPatternObjectDel (FcPattern *p, FcObject object);
1151b5b73dd3Smrg
1152b5b73dd3SmrgFcPrivate FcBool
1153b5b73dd3SmrgFcPatternObjectRemove (FcPattern *p, FcObject object, int id);
1154b5b73dd3Smrg
1155b5b73dd3SmrgFcPrivate FcBool
1156b5b73dd3SmrgFcPatternObjectAddInteger (FcPattern *p, FcObject object, int i);
1157b5b73dd3Smrg
1158b5b73dd3SmrgFcPrivate FcBool
1159b5b73dd3SmrgFcPatternObjectAddDouble (FcPattern *p, FcObject object, double d);
1160b5b73dd3Smrg
1161b5b73dd3SmrgFcPrivate FcBool
1162b5b73dd3SmrgFcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s);
1163b5b73dd3Smrg
1164b5b73dd3SmrgFcPrivate FcBool
1165b5b73dd3SmrgFcPatternObjectAddMatrix (FcPattern *p, FcObject object, const FcMatrix *s);
1166b5b73dd3Smrg
1167b5b73dd3SmrgFcPrivate FcBool
1168b5b73dd3SmrgFcPatternObjectAddCharSet (FcPattern *p, FcObject object, const FcCharSet *c);
1169b5b73dd3Smrg
1170b5b73dd3SmrgFcPrivate FcBool
1171b5b73dd3SmrgFcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b);
1172b5b73dd3Smrg
1173b5b73dd3SmrgFcPrivate FcBool
1174b5b73dd3SmrgFcPatternObjectAddLangSet (FcPattern *p, FcObject object, const FcLangSet *ls);
1175b5b73dd3Smrg
1176b5b73dd3SmrgFcPrivate FcBool
1177b5b73dd3SmrgFcPatternObjectAddRange (FcPattern *p, FcObject object, const FcRange *r);
1178b5b73dd3Smrg
1179b5b73dd3SmrgFcPrivate FcResult
1180b5b73dd3SmrgFcPatternObjectGetInteger (const FcPattern *p, FcObject object, int n, int *i);
1181b5b73dd3Smrg
1182b5b73dd3SmrgFcPrivate FcResult
1183b5b73dd3SmrgFcPatternObjectGetDouble (const FcPattern *p, FcObject object, int n, double *d);
1184b5b73dd3Smrg
1185b5b73dd3SmrgFcPrivate FcResult
1186b5b73dd3SmrgFcPatternObjectGetString (const FcPattern *p, FcObject object, int n, FcChar8 ** s);
1187b5b73dd3Smrg
1188b5b73dd3SmrgFcPrivate FcResult
1189b5b73dd3SmrgFcPatternObjectGetMatrix (const FcPattern *p, FcObject object, int n, FcMatrix **s);
1190b5b73dd3Smrg
1191b5b73dd3SmrgFcPrivate FcResult
1192b5b73dd3SmrgFcPatternObjectGetCharSet (const FcPattern *p, FcObject object, int n, FcCharSet **c);
1193b5b73dd3Smrg
1194b5b73dd3SmrgFcPrivate FcResult
1195b5b73dd3SmrgFcPatternObjectGetBool (const FcPattern *p, FcObject object, int n, FcBool *b);
1196b5b73dd3Smrg
1197b5b73dd3SmrgFcPrivate FcResult
1198b5b73dd3SmrgFcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet **ls);
1199b5b73dd3Smrg
1200b5b73dd3SmrgFcPrivate FcResult
1201b5b73dd3SmrgFcPatternObjectGetRange (const FcPattern *p, FcObject object, int id, FcRange **r);
1202b5b73dd3Smrg
1203b5b73dd3SmrgFcPrivate FcBool
1204b5b73dd3SmrgFcPatternAppend (FcPattern *p, FcPattern *s);
1205b5b73dd3Smrg
1206b5b73dd3SmrgFcPrivate int
1207b5b73dd3SmrgFcPatternPosition (const FcPattern *p, const char *object);
1208b5b73dd3Smrg
1209b5b73dd3SmrgFcPrivate FcBool
1210b5b73dd3SmrgFcPatternFindObjectIter (const FcPattern *pat, FcPatternIter *iter, FcObject object);
1211b5b73dd3Smrg
1212b5b73dd3SmrgFcPrivate FcObject
1213b5b73dd3SmrgFcPatternIterGetObjectId (const FcPattern *pat, FcPatternIter *iter);
1214b5b73dd3Smrg
1215b5b73dd3SmrgFcPrivate FcValueListPtr
1216b5b73dd3SmrgFcPatternIterGetValues (const FcPattern *pat, FcPatternIter *iter);
1217b5b73dd3Smrg
1218b5b73dd3SmrgFcPrivate FcPattern *
1219b5b73dd3SmrgFcPatternCacheRewriteFile (const FcPattern *pat, FcCache *cache, const FcChar8 *relocated_font_file);
1220b5b73dd3Smrg
1221b5b73dd3SmrgFcPrivate FcChar32
1222b5b73dd3SmrgFcStringHash (const FcChar8 *s);
1223b5b73dd3Smrg
1224b5b73dd3SmrgFcPrivate FcBool
1225b5b73dd3SmrgFcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat);
1226b5b73dd3Smrg
1227b5b73dd3SmrgFcPrivate FcPattern *
1228b5b73dd3SmrgFcPatternSerialize (FcSerialize *serialize, const FcPattern *pat);
1229b5b73dd3Smrg
1230b5b73dd3SmrgFcPrivate FcBool
1231b5b73dd3SmrgFcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *pat);
1232b5b73dd3Smrg
1233b5b73dd3SmrgFcPrivate FcValueList *
1234b5b73dd3SmrgFcValueListSerialize (FcSerialize *serialize, const FcValueList *pat);
1235b5b73dd3Smrg
1236b5b73dd3Smrg/* fcrender.c */
1237b5b73dd3Smrg
1238b5b73dd3Smrg/* fcmatrix.c */
1239b5b73dd3Smrg
1240b5b73dd3Smrgextern FcPrivate const FcMatrix    FcIdentityMatrix;
1241b5b73dd3Smrg
1242b5b73dd3SmrgFcPrivate void
1243b5b73dd3SmrgFcMatrixFree (FcMatrix *mat);
1244b5b73dd3Smrg
1245b5b73dd3Smrg/* fcrange.c */
1246b5b73dd3Smrg
1247b5b73dd3SmrgFcPrivate FcRange *
1248b5b73dd3SmrgFcRangePromote (double v, FcValuePromotionBuffer *vbuf);
1249b5b73dd3Smrg
1250b5b73dd3SmrgFcPrivate FcBool
1251b5b73dd3SmrgFcRangeIsInRange (const FcRange *a, const FcRange *b);
1252b5b73dd3Smrg
1253b5b73dd3SmrgFcPrivate FcBool
1254b5b73dd3SmrgFcRangeCompare (FcOp op, const FcRange *a, const FcRange *b);
1255b5b73dd3Smrg
1256b5b73dd3SmrgFcPrivate FcChar32
1257b5b73dd3SmrgFcRangeHash (const FcRange *r);
1258b5b73dd3Smrg
1259b5b73dd3SmrgFcPrivate FcBool
1260b5b73dd3SmrgFcRangeSerializeAlloc (FcSerialize *serialize, const FcRange *r);
1261b5b73dd3Smrg
1262b5b73dd3SmrgFcPrivate FcRange *
1263b5b73dd3SmrgFcRangeSerialize (FcSerialize *serialize, const FcRange *r);
1264b5b73dd3Smrg
1265b5b73dd3Smrg/* fcstat.c */
1266b5b73dd3Smrg
1267b5b73dd3SmrgFcPrivate int
1268b5b73dd3SmrgFcStat (const FcChar8 *file, struct stat *statb);
1269b5b73dd3Smrg
1270b5b73dd3SmrgFcPrivate int
1271b5b73dd3SmrgFcStatChecksum (const FcChar8 *file, struct stat *statb);
1272b5b73dd3Smrg
1273b5b73dd3SmrgFcPrivate FcBool
1274b5b73dd3SmrgFcIsFsMmapSafe (int fd);
1275b5b73dd3Smrg
1276b5b73dd3SmrgFcPrivate FcBool
1277b5b73dd3SmrgFcIsFsMtimeBroken (const FcChar8 *dir);
1278b5b73dd3Smrg
1279b5b73dd3Smrg/* fcstr.c */
1280b5b73dd3SmrgFcPrivate FcStrSet *
1281b5b73dd3SmrgFcStrSetCreateEx (unsigned int control);
1282b5b73dd3Smrg
1283b5b73dd3SmrgFcPrivate FcBool
1284b5b73dd3SmrgFcStrSetInsert (FcStrSet *set, const FcChar8 *s, int pos);
1285b5b73dd3Smrg
1286b5b73dd3SmrgFcPrivate FcBool
1287b5b73dd3SmrgFcStrSetAddLangs (FcStrSet *strs, const char *languages);
1288b5b73dd3Smrg
1289b5b73dd3SmrgFcPrivate void
1290b5b73dd3SmrgFcStrSetSort (FcStrSet * set);
1291b5b73dd3Smrg
1292b5b73dd3SmrgFcPrivate FcBool
1293b5b73dd3SmrgFcStrSetMemberAB (FcStrSet *set, const FcChar8 *a, FcChar8 *b, FcChar8 **ret);
1294b5b73dd3Smrg
1295b5b73dd3SmrgFcPrivate FcBool
1296b5b73dd3SmrgFcStrSetAddTriple (FcStrSet *set, const FcChar8 *a, const FcChar8 *b, const FcChar8 *c);
1297b5b73dd3Smrg
1298b5b73dd3SmrgFcPrivate const FcChar8 *
1299b5b73dd3SmrgFcStrTripleSecond (FcChar8 *s);
1300b5b73dd3Smrg
1301b5b73dd3SmrgFcPrivate const FcChar8 *
1302b5b73dd3SmrgFcStrTripleThird (FcChar8 *str);
1303b5b73dd3Smrg
1304b5b73dd3SmrgFcPrivate FcBool
1305b5b73dd3SmrgFcStrSetAddFilenamePairWithSalt (FcStrSet *strs, const FcChar8 *d, const FcChar8 *m, const FcChar8 *salt);
1306b5b73dd3Smrg
1307b5b73dd3SmrgFcPrivate FcBool
1308b5b73dd3SmrgFcStrSetDeleteAll (FcStrSet *set);
1309b5b73dd3Smrg
1310b5b73dd3SmrgFcPrivate void
1311b5b73dd3SmrgFcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
1312b5b73dd3Smrg
1313b5b73dd3SmrgFcPrivate void
1314b5b73dd3SmrgFcStrBufDestroy (FcStrBuf *buf);
1315b5b73dd3Smrg
1316b5b73dd3SmrgFcPrivate FcChar8 *
1317b5b73dd3SmrgFcStrBufDone (FcStrBuf *buf);
1318b5b73dd3Smrg
1319b5b73dd3SmrgFcPrivate FcChar8 *
1320b5b73dd3SmrgFcStrBufDoneStatic (FcStrBuf *buf);
1321b5b73dd3Smrg
1322b5b73dd3SmrgFcPrivate FcBool
1323b5b73dd3SmrgFcStrBufChar (FcStrBuf *buf, FcChar8 c);
1324b5b73dd3Smrg
1325b5b73dd3SmrgFcPrivate FcBool
1326b5b73dd3SmrgFcStrBufString (FcStrBuf *buf, const FcChar8 *s);
1327b5b73dd3Smrg
1328b5b73dd3SmrgFcPrivate FcBool
1329b5b73dd3SmrgFcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
1330b5b73dd3Smrg
1331b5b73dd3SmrgFcPrivate int
1332b5b73dd3SmrgFcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
1333b5b73dd3Smrg
1334b5b73dd3SmrgFcPrivate int
1335b5b73dd3SmrgFcStrCmpIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims);
1336b5b73dd3Smrg
1337b5b73dd3SmrgFcPrivate const FcChar8 *
1338b5b73dd3SmrgFcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
1339b5b73dd3Smrg
1340b5b73dd3SmrgFcPrivate const FcChar8 *
1341b5b73dd3SmrgFcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
1342b5b73dd3Smrg
1343b5b73dd3SmrgFcPrivate const FcChar8 *
1344b5b73dd3SmrgFcStrContainsWord (const FcChar8 *s1, const FcChar8 *s2);
1345b5b73dd3Smrg
1346b5b73dd3SmrgFcPrivate int
1347b5b73dd3SmrgFcStrMatchIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims);
1348b5b73dd3Smrg
1349b5b73dd3SmrgFcPrivate FcBool
1350b5b73dd3SmrgFcStrGlobMatch (const FcChar8 *glob,
1351b5b73dd3Smrg		const FcChar8 *string);
1352b5b73dd3Smrg
1353b5b73dd3SmrgFcPrivate FcBool
1354b5b73dd3SmrgFcStrUsesHome (const FcChar8 *s);
1355b5b73dd3Smrg
1356b5b73dd3SmrgFcPrivate FcBool
1357b5b73dd3SmrgFcStrIsAbsoluteFilename (const FcChar8 *s);
1358b5b73dd3Smrg
1359b5b73dd3SmrgFcPrivate FcChar8 *
1360b5b73dd3SmrgFcStrLastSlash (const FcChar8  *path);
1361b5b73dd3Smrg
1362b5b73dd3SmrgFcPrivate FcChar32
1363b5b73dd3SmrgFcStrHashIgnoreCase (const FcChar8 *s);
1364b5b73dd3Smrg
1365b5b73dd3SmrgFcPrivate FcChar32
1366b5b73dd3SmrgFcStrHashIgnoreBlanksAndCase (const FcChar8 *s);
1367b5b73dd3Smrg
1368b5b73dd3SmrgFcPrivate FcChar8 *
1369b5b73dd3SmrgFcStrRealPath (const FcChar8 *path);
1370b5b73dd3Smrg
1371b5b73dd3SmrgFcPrivate FcChar8 *
1372b5b73dd3SmrgFcStrCanonFilename (const FcChar8 *s);
1373b5b73dd3Smrg
1374b5b73dd3SmrgFcPrivate FcBool
1375b5b73dd3SmrgFcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str);
1376b5b73dd3Smrg
1377b5b73dd3SmrgFcPrivate FcChar8 *
1378b5b73dd3SmrgFcStrSerialize (FcSerialize *serialize, const FcChar8 *str);
1379b5b73dd3Smrg
1380b5b73dd3Smrg/* fcobjs.c */
1381b5b73dd3Smrg
1382b5b73dd3SmrgFcPrivate void
1383b5b73dd3SmrgFcObjectFini (void);
1384b5b73dd3Smrg
1385b5b73dd3SmrgFcPrivate FcObject
1386b5b73dd3SmrgFcObjectLookupIdByName (const char *str);
1387b5b73dd3Smrg
1388b5b73dd3SmrgFcPrivate FcObject
1389b5b73dd3SmrgFcObjectLookupBuiltinIdByName (const char *str);
1390b5b73dd3Smrg
1391b5b73dd3SmrgFcPrivate const char *
1392b5b73dd3SmrgFcObjectLookupOtherNameById (FcObject id);
1393b5b73dd3Smrg
1394b5b73dd3SmrgFcPrivate const FcObjectType *
1395b5b73dd3SmrgFcObjectLookupOtherTypeById (FcObject id);
1396b5b73dd3Smrg
1397b5b73dd3SmrgFcPrivate const FcObjectType *
1398b5b73dd3SmrgFcObjectLookupOtherTypeByName (const char *str);
1399b5b73dd3Smrg
1400b5b73dd3Smrg/* fchash.c */
1401b5b73dd3SmrgFcPrivate FcBool
1402b5b73dd3SmrgFcHashStrCopy (const void  *src,
1403b5b73dd3Smrg	       void       **dest);
1404b5b73dd3Smrg
1405b5b73dd3SmrgFcPrivate FcBool
1406b5b73dd3SmrgFcHashUuidCopy (const void  *src,
1407b5b73dd3Smrg		void       **dest);
1408b5b73dd3Smrg
1409b5b73dd3SmrgFcPrivate void
1410b5b73dd3SmrgFcHashUuidFree (void *data);
1411b5b73dd3Smrg
1412b5b73dd3SmrgFcPrivate FcHashTable *
1413b5b73dd3SmrgFcHashTableCreate (FcHashFunc    hash_func,
1414b5b73dd3Smrg		   FcCompareFunc compare_func,
1415b5b73dd3Smrg		   FcCopyFunc    key_copy_func,
1416b5b73dd3Smrg		   FcCopyFunc    value_copy_func,
1417b5b73dd3Smrg		   FcDestroyFunc key_destroy_func,
1418b5b73dd3Smrg		   FcDestroyFunc value_destroy_func);
1419b5b73dd3Smrg
1420b5b73dd3SmrgFcPrivate void
1421b5b73dd3SmrgFcHashTableDestroy (FcHashTable *table);
1422b5b73dd3Smrg
1423b5b73dd3SmrgFcPrivate FcBool
1424b5b73dd3SmrgFcHashTableFind (FcHashTable  *table,
1425b5b73dd3Smrg		 const void   *key,
1426b5b73dd3Smrg		 void        **value);
1427b5b73dd3Smrg
1428b5b73dd3SmrgFcPrivate FcBool
1429b5b73dd3SmrgFcHashTableAdd (FcHashTable *table,
1430b5b73dd3Smrg		void        *key,
1431b5b73dd3Smrg		void        *value);
1432b5b73dd3Smrg
1433b5b73dd3SmrgFcPrivate FcBool
1434b5b73dd3SmrgFcHashTableReplace (FcHashTable *table,
1435b5b73dd3Smrg		    void        *key,
1436b5b73dd3Smrg		    void        *value);
1437b5b73dd3Smrg
1438b5b73dd3SmrgFcPrivate FcBool
1439b5b73dd3SmrgFcHashTableRemove (FcHashTable *table,
1440b5b73dd3Smrg		   void        *key);
1441b5b73dd3Smrg
1442b5b73dd3Smrg#endif /* _FC_INT_H_ */
1443