2 * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.2 2002/02/15 06:01:28 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
];
211 * File names loaded from the configuration -- saved here as the
212 * cache file must be consulted before the directories are scanned,
213 * and those directives may occur in any order
215 FcChar8
**dirs
; /* directories containing fonts */
216 FcChar8
*cache
; /* name of per-user cache file */
218 * Set of allowed blank chars -- used to
219 * trim fonts of bogus glyphs
223 * Names of all of the configuration files used
224 * to create this configuration
226 FcChar8
**configFiles
; /* config files loaded */
228 * Substitution instructions for patterns and fonts;
229 * maxObjects is used to allocate appropriate intermediate storage
230 * while performing a whole set of substitutions
232 FcSubst
*substPattern
; /* substitutions for patterns */
233 FcSubst
*substFont
; /* substitutions for fonts */
234 int maxObjects
; /* maximum number of tests in all substs */
236 * The set of fonts loaded from the listed directories; the
237 * order within the set does not determine the font selection,
238 * except in the case of identical matches in which case earlier fonts
239 * match preferrentially
241 FcFontSet
*fonts
[FcSetApplication
+ 1];
249 FcFileCacheCreate (void);
252 FcFileCacheFind (FcFileCache
*cache
,
258 FcFileCacheDestroy (FcFileCache
*cache
);
261 FcFileCacheLoad (FcFileCache
*cache
,
262 const FcChar8
*cache_file
);
265 FcFileCacheUpdate (FcFileCache
*cache
,
268 const FcChar8
*name
);
271 FcFileCacheSave (FcFileCache
*cache
,
272 const FcChar8
*cache_file
);
275 FcFileCacheReadDir (FcFontSet
*set
, const FcChar8
*cache_file
);
278 FcFileCacheWriteDir (FcFontSet
*set
, const FcChar8
*cache_file
);
283 FcConfigAddDir (FcConfig
*config
,
287 FcConfigAddConfigFile (FcConfig
*config
,
291 FcConfigSetCache (FcConfig
*config
,
295 FcConfigAddBlank (FcConfig
*config
,
299 FcConfigAddEdit (FcConfig
*config
,
305 FcConfigSetFonts (FcConfig
*config
,
310 FcConfigCompareValue (const FcValue m
,
316 FcNameUnparseCharSet (FcStrBuf
*buf
, const FcCharSet
*c
);
319 FcNameParseCharSet (FcChar8
*string
);
323 FcValuePrint (FcValue v
);
326 FcValueListPrint (FcValueList
*l
);
329 FcPatternPrint (FcPattern
*p
);
335 FcTestPrint (FcTest
*test
);
338 FcExprPrint (FcExpr
*expr
);
341 FcEditPrint (FcEdit
*edit
);
344 FcSubstPrint (FcSubst
*subst
);
347 FcFontSetPrint (FcFontSet
*s
);
361 FcConfigparse (void);
367 FcConfigerror (char *fmt
, ...);
370 FcConfigSaveField (const char *field
);
373 FcTestCreate (FcQual qual
, const FcChar8
*field
, FcOp compare
, FcExpr
*expr
);
376 FcTestDestroy (FcTest
*test
);
379 FcExprCreateInteger (int i
);
382 FcExprCreateDouble (double d
);
385 FcExprCreateString (const FcChar8
*s
);
388 FcExprCreateMatrix (const FcMatrix
*m
);
391 FcExprCreateBool (FcBool b
);
394 FcExprCreateNil (void);
397 FcExprCreateField (const char *field
);
400 FcExprCreateConst (const FcChar8
*constant
);
403 FcExprCreateOp (FcExpr
*left
, FcOp op
, FcExpr
*right
);
406 FcExprDestroy (FcExpr
*e
);
409 FcEditCreate (const char *field
, FcOp op
, FcExpr
*expr
);
412 FcEditDestroy (FcEdit
*e
);
420 FcMemAlloc (int kind
, int size
);
423 FcMemFree (int kind
, int size
);
432 FcNameBool (FcChar8
*v
, FcBool
*result
);
435 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
438 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
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_ */