2 * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.3 2002/02/18 22:29: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];
244 extern FcConfig
*_fcConfig
;
251 FcFileCacheCreate (void);
254 FcFileCacheFind (FcFileCache
*cache
,
260 FcFileCacheDestroy (FcFileCache
*cache
);
263 FcFileCacheLoad (FcFileCache
*cache
,
264 const FcChar8
*cache_file
);
267 FcFileCacheUpdate (FcFileCache
*cache
,
270 const FcChar8
*name
);
273 FcFileCacheSave (FcFileCache
*cache
,
274 const FcChar8
*cache_file
);
277 FcFileCacheReadDir (FcFontSet
*set
, const FcChar8
*cache_file
);
280 FcFileCacheWriteDir (FcFontSet
*set
, const FcChar8
*cache_file
);
285 FcConfigAddDir (FcConfig
*config
,
289 FcConfigAddConfigFile (FcConfig
*config
,
293 FcConfigSetCache (FcConfig
*config
,
297 FcConfigAddBlank (FcConfig
*config
,
301 FcConfigAddEdit (FcConfig
*config
,
307 FcConfigSetFonts (FcConfig
*config
,
312 FcConfigCompareValue (const FcValue m
,
318 FcNameUnparseCharSet (FcStrBuf
*buf
, const FcCharSet
*c
);
321 FcNameParseCharSet (FcChar8
*string
);
325 FcValuePrint (FcValue v
);
328 FcValueListPrint (FcValueList
*l
);
331 FcPatternPrint (FcPattern
*p
);
337 FcTestPrint (FcTest
*test
);
340 FcExprPrint (FcExpr
*expr
);
343 FcEditPrint (FcEdit
*edit
);
346 FcSubstPrint (FcSubst
*subst
);
349 FcFontSetPrint (FcFontSet
*s
);
363 FcConfigparse (void);
369 FcConfigerror (char *fmt
, ...);
372 FcConfigSaveField (const char *field
);
375 FcTestCreate (FcQual qual
, const FcChar8
*field
, FcOp compare
, FcExpr
*expr
);
378 FcTestDestroy (FcTest
*test
);
381 FcExprCreateInteger (int i
);
384 FcExprCreateDouble (double d
);
387 FcExprCreateString (const FcChar8
*s
);
390 FcExprCreateMatrix (const FcMatrix
*m
);
393 FcExprCreateBool (FcBool b
);
396 FcExprCreateNil (void);
399 FcExprCreateField (const char *field
);
402 FcExprCreateConst (const FcChar8
*constant
);
405 FcExprCreateOp (FcExpr
*left
, FcOp op
, FcExpr
*right
);
408 FcExprDestroy (FcExpr
*e
);
411 FcEditCreate (const char *field
, FcOp op
, FcExpr
*expr
);
414 FcEditDestroy (FcEdit
*e
);
422 FcMemAlloc (int kind
, int size
);
425 FcMemFree (int kind
, int size
);
434 FcNameBool (FcChar8
*v
, FcBool
*result
);
437 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
440 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
444 FcValueListDestroy (FcValueList
*l
);
447 FcPatternFind (FcPattern
*p
, const char *object
, FcBool insert
);
453 FcMatrixFree (FcMatrix
*mat
);
457 FcStrPlus (const FcChar8
*s1
, const FcChar8
*s2
);
460 FcStrFree (FcChar8
*s
);
463 FcStrBufInit (FcStrBuf
*buf
, FcChar8
*init
, int size
);
466 FcStrBufDestroy (FcStrBuf
*buf
);
469 FcStrBufDone (FcStrBuf
*buf
);
472 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
475 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
478 FcStrBufData (FcStrBuf
*buf
, const FcChar8
*s
, int len
);
480 #endif /* _FC_INT_H_ */