2 * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.4 2002/02/19 08:33:23 keithp Exp $
4 * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
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.
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.
34 #include <sys/types.h>
36 #include <fontconfig/fontconfig.h>
37 #include <fontconfig/fcprivate.h>
42 typedef struct _FcMatcher
{
44 double (*compare
) (char *object
, FcValue value1
, FcValue value2
);
47 typedef struct _FcSymbolic
{
52 #ifndef FC_CONFIG_PATH
53 #define FC_CONFIG_PATH "fonts.conf"
56 #define FC_DBG_MATCH 1
57 #define FC_DBG_MATCHV 2
59 #define FC_DBG_FONTSET 8
60 #define FC_DBG_CACHE 16
61 #define FC_DBG_CACHEV 32
62 #define FC_DBG_PARSE 64
63 #define FC_DBG_SCAN 128
64 #define FC_DBG_MEMORY 512
66 #define FC_MEM_CHARSET 0
67 #define FC_MEM_CHARNODE 1
68 #define FC_MEM_FONTSET 2
69 #define FC_MEM_FONTPTR 3
70 #define FC_MEM_OBJECTSET 4
71 #define FC_MEM_OBJECTPTR 5
72 #define FC_MEM_MATRIX 6
73 #define FC_MEM_PATTERN 7
74 #define FC_MEM_PATELT 8
75 #define FC_MEM_VALLIST 9
76 #define FC_MEM_SUBSTATE 10
77 #define FC_MEM_STRING 11
78 #define FC_MEM_LISTBUCK 12
81 typedef struct _FcValueList
{
82 struct _FcValueList
*next
;
86 typedef struct _FcPatternElt
{
98 FcOpInteger
, FcOpDouble
, FcOpString
, FcOpMatrix
, FcOpBool
, FcOpCharSet
,
100 FcOpField
, FcOpConst
,
101 FcOpAssign
, FcOpAssignReplace
,
102 FcOpPrependFirst
, FcOpPrepend
, FcOpAppend
, FcOpAppendLast
,
104 FcOpOr
, FcOpAnd
, FcOpEqual
, FcOpNotEqual
, FcOpContains
,
105 FcOpLess
, FcOpLessEqual
, FcOpMore
, FcOpMoreEqual
,
106 FcOpPlus
, FcOpMinus
, FcOpTimes
, FcOpDivide
,
107 FcOpNot
, FcOpComma
, FcOpInvalid
110 typedef struct _FcExpr
{
122 struct _FcExpr
*left
, *right
;
127 typedef enum _FcQual
{
131 typedef struct _FcTest
{
132 struct _FcTest
*next
;
139 typedef struct _FcEdit
{
140 struct _FcEdit
*next
;
146 typedef struct _FcSubst
{
147 struct _FcSubst
*next
;
152 typedef struct _FcCharLeaf FcCharLeaf
;
153 typedef struct _FcCharBranch FcCharBranch
;
154 typedef union _FcCharNode FcCharNode
;
157 FcChar32 map
[256/32];
161 FcCharBranch
*branch
;
165 struct _FcCharBranch
{
166 FcCharNode nodes
[256];
171 int ref
; /* reference count */
172 FcBool constant
; /* shared constant */
176 typedef struct _FcStrBuf
{
184 typedef struct _FcFileCacheEnt
{
185 struct _FcFileCacheEnt
*next
;
194 #define FC_FILE_CACHE_HASH_SIZE 509
196 struct _FcFileCache
{
197 FcFileCacheEnt
*ents
[FC_FILE_CACHE_HASH_SIZE
];
204 FcChar8
*file
; /* original file name */
205 FcChar8
*new; /* temp file name -- write data here */
206 FcChar8
*lck
; /* lockfile name (used for locking) */
207 FcChar8
*tmp
; /* tmpfile name (used for locking) */
218 * File names loaded from the configuration -- saved here as the
219 * cache file must be consulted before the directories are scanned,
220 * and those directives may occur in any order
222 FcChar8
**dirs
; /* directories containing fonts */
223 FcChar8
*cache
; /* name of per-user cache file */
225 * Set of allowed blank chars -- used to
226 * trim fonts of bogus glyphs
230 * Names of all of the configuration files used
231 * to create this configuration
233 FcChar8
**configFiles
; /* config files loaded */
235 * Substitution instructions for patterns and fonts;
236 * maxObjects is used to allocate appropriate intermediate storage
237 * while performing a whole set of substitutions
239 FcSubst
*substPattern
; /* substitutions for patterns */
240 FcSubst
*substFont
; /* substitutions for fonts */
241 int maxObjects
; /* maximum number of tests in all substs */
243 * The set of fonts loaded from the listed directories; the
244 * order within the set does not determine the font selection,
245 * except in the case of identical matches in which case earlier fonts
246 * match preferrentially
248 FcFontSet
*fonts
[FcSetApplication
+ 1];
251 extern FcConfig
*_fcConfig
;
258 FcFileCacheCreate (void);
261 FcFileCacheFind (FcFileCache
*cache
,
267 FcFileCacheDestroy (FcFileCache
*cache
);
270 FcFileCacheLoad (FcFileCache
*cache
,
271 const FcChar8
*cache_file
);
274 FcFileCacheUpdate (FcFileCache
*cache
,
277 const FcChar8
*name
);
280 FcFileCacheSave (FcFileCache
*cache
,
281 const FcChar8
*cache_file
);
284 FcFileCacheReadDir (FcFontSet
*set
, const FcChar8
*cache_file
);
287 FcFileCacheWriteDir (FcFontSet
*set
, const FcChar8
*cache_file
);
292 FcConfigAddDir (FcConfig
*config
,
296 FcConfigAddConfigFile (FcConfig
*config
,
300 FcConfigSetCache (FcConfig
*config
,
304 FcConfigAddBlank (FcConfig
*config
,
308 FcConfigAddEdit (FcConfig
*config
,
314 FcConfigSetFonts (FcConfig
*config
,
319 FcConfigCompareValue (const FcValue m
,
325 FcNameUnparseCharSet (FcStrBuf
*buf
, const FcCharSet
*c
);
328 FcNameParseCharSet (FcChar8
*string
);
332 FcValuePrint (FcValue v
);
335 FcValueListPrint (FcValueList
*l
);
341 FcTestPrint (FcTest
*test
);
344 FcExprPrint (FcExpr
*expr
);
347 FcEditPrint (FcEdit
*edit
);
350 FcSubstPrint (FcSubst
*subst
);
353 FcFontSetPrint (FcFontSet
*s
);
367 FcConfigparse (void);
373 FcConfigerror (char *fmt
, ...);
376 FcConfigSaveField (const char *field
);
379 FcTestCreate (FcQual qual
, const FcChar8
*field
, FcOp compare
, FcExpr
*expr
);
382 FcTestDestroy (FcTest
*test
);
385 FcExprCreateInteger (int i
);
388 FcExprCreateDouble (double d
);
391 FcExprCreateString (const FcChar8
*s
);
394 FcExprCreateMatrix (const FcMatrix
*m
);
397 FcExprCreateBool (FcBool b
);
400 FcExprCreateNil (void);
403 FcExprCreateField (const char *field
);
406 FcExprCreateConst (const FcChar8
*constant
);
409 FcExprCreateOp (FcExpr
*left
, FcOp op
, FcExpr
*right
);
412 FcExprDestroy (FcExpr
*e
);
415 FcEditCreate (const char *field
, FcOp op
, FcExpr
*expr
);
418 FcEditDestroy (FcEdit
*e
);
426 FcMemAlloc (int kind
, int size
);
429 FcMemFree (int kind
, int size
);
438 FcNameBool (FcChar8
*v
, FcBool
*result
);
442 FcValueListDestroy (FcValueList
*l
);
445 FcPatternFind (FcPattern
*p
, const char *object
, FcBool insert
);
451 FcMatrixFree (FcMatrix
*mat
);
455 FcStrPlus (const FcChar8
*s1
, const FcChar8
*s2
);
458 FcStrFree (FcChar8
*s
);
461 FcStrBufInit (FcStrBuf
*buf
, FcChar8
*init
, int size
);
464 FcStrBufDestroy (FcStrBuf
*buf
);
467 FcStrBufDone (FcStrBuf
*buf
);
470 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
473 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
476 FcStrBufData (FcStrBuf
*buf
, const FcChar8
*s
, int len
);
478 #endif /* _FC_INT_H_ */