2 * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.8 2002/05/21 17:06:22 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>
37 #include <fontconfig/fontconfig.h>
38 #include <fontconfig/fcprivate.h>
43 typedef struct _FcMatcher
{
45 double (*compare
) (char *object
, FcValue value1
, FcValue value2
);
49 typedef struct _FcSymbolic
{
54 #ifndef FC_CONFIG_PATH
55 #define FC_CONFIG_PATH "fonts.conf"
58 #define FC_FONT_FILE_INVALID ((FcChar8 *) ".")
59 #define FC_FONT_FILE_DIR ((FcChar8 *) ".dir")
61 #define FC_DBG_MATCH 1
62 #define FC_DBG_MATCHV 2
64 #define FC_DBG_FONTSET 8
65 #define FC_DBG_CACHE 16
66 #define FC_DBG_CACHEV 32
67 #define FC_DBG_PARSE 64
68 #define FC_DBG_SCAN 128
69 #define FC_DBG_MEMORY 512
71 #define FC_MEM_CHARSET 0
72 #define FC_MEM_CHARNODE 1
73 #define FC_MEM_FONTSET 2
74 #define FC_MEM_FONTPTR 3
75 #define FC_MEM_OBJECTSET 4
76 #define FC_MEM_OBJECTPTR 5
77 #define FC_MEM_MATRIX 6
78 #define FC_MEM_PATTERN 7
79 #define FC_MEM_PATELT 8
80 #define FC_MEM_VALLIST 9
81 #define FC_MEM_SUBSTATE 10
82 #define FC_MEM_STRING 11
83 #define FC_MEM_LISTBUCK 12
85 #define FC_MEM_STRSET 14
86 #define FC_MEM_STRLIST 15
87 #define FC_MEM_CONFIG 16
89 typedef struct _FcValueList
{
90 struct _FcValueList
*next
;
94 typedef struct _FcPatternElt
{
106 FcOpInteger
, FcOpDouble
, FcOpString
, FcOpMatrix
, FcOpBool
, FcOpCharSet
,
108 FcOpField
, FcOpConst
,
109 FcOpAssign
, FcOpAssignReplace
,
110 FcOpPrependFirst
, FcOpPrepend
, FcOpAppend
, FcOpAppendLast
,
112 FcOpOr
, FcOpAnd
, FcOpEqual
, FcOpNotEqual
, FcOpContains
,
113 FcOpLess
, FcOpLessEqual
, FcOpMore
, FcOpMoreEqual
,
114 FcOpPlus
, FcOpMinus
, FcOpTimes
, FcOpDivide
,
115 FcOpNot
, FcOpComma
, FcOpInvalid
118 typedef struct _FcExpr
{
130 struct _FcExpr
*left
, *right
;
135 typedef enum _FcQual
{
139 typedef struct _FcTest
{
140 struct _FcTest
*next
;
147 typedef struct _FcEdit
{
148 struct _FcEdit
*next
;
154 typedef struct _FcSubst
{
155 struct _FcSubst
*next
;
160 typedef struct _FcCharLeaf FcCharLeaf
;
161 typedef struct _FcCharBranch FcCharBranch
;
162 typedef union _FcCharNode FcCharNode
;
165 FcChar32 map
[256/32];
169 FcCharBranch
*branch
;
173 struct _FcCharBranch
{
174 FcCharNode nodes
[256];
180 int ref
; /* reference count */
181 FcBool constant
; /* shared constant */
186 int ref
; /* reference count */
197 typedef struct _FcStrBuf
{
205 typedef struct _FcFileCacheEnt
{
206 struct _FcFileCacheEnt
*next
;
215 #define FC_FILE_CACHE_HASH_SIZE 509
217 struct _FcFileCache
{
218 FcFileCacheEnt
*ents
[FC_FILE_CACHE_HASH_SIZE
];
225 FcChar8
*file
; /* original file name */
226 FcChar8
*new; /* temp file name -- write data here */
227 FcChar8
*lck
; /* lockfile name (used for locking) */
228 FcChar8
*tmp
; /* tmpfile name (used for locking) */
239 * File names loaded from the configuration -- saved here as the
240 * cache file must be consulted before the directories are scanned,
241 * and those directives may occur in any order
243 FcStrSet
*configDirs
; /* directories to scan for fonts */
244 FcChar8
*cache
; /* name of per-user cache file */
246 * Set of allowed blank chars -- used to
247 * trim fonts of bogus glyphs
251 * List of directories containing fonts,
252 * built by recursively scanning the set
253 * of configured directories
257 * Names of all of the configuration files used
258 * to create this configuration
260 FcStrSet
*configFiles
; /* config files loaded */
262 * Substitution instructions for patterns and fonts;
263 * maxObjects is used to allocate appropriate intermediate storage
264 * while performing a whole set of substitutions
266 FcSubst
*substPattern
; /* substitutions for patterns */
267 FcSubst
*substFont
; /* substitutions for fonts */
268 int maxObjects
; /* maximum number of tests in all substs */
270 * The set of fonts loaded from the listed directories; the
271 * order within the set does not determine the font selection,
272 * except in the case of identical matches in which case earlier fonts
273 * match preferrentially
275 FcFontSet
*fonts
[FcSetApplication
+ 1];
277 * Fontconfig can periodically rescan the system configuration
278 * and font directories. This rescanning occurs when font
279 * listing requests are made, but no more often than rescanInterval
282 time_t rescanTime
; /* last time information was scanned */
283 int rescanInterval
; /* interval between scans */
286 extern FcConfig
*_fcConfig
;
293 FcFileCacheCreate (void);
296 FcFileCacheFind (FcFileCache
*cache
,
302 FcFileCacheDestroy (FcFileCache
*cache
);
305 FcFileCacheValid (const FcChar8
*cache_file
);
308 FcFileCacheLoad (FcFileCache
*cache
,
309 const FcChar8
*cache_file
);
312 FcFileCacheUpdate (FcFileCache
*cache
,
315 const FcChar8
*name
);
318 FcFileCacheSave (FcFileCache
*cache
,
319 const FcChar8
*cache_file
);
322 FcFileCacheReadDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
325 FcFileCacheWriteDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
330 FcConfigAddConfigDir (FcConfig
*config
,
334 FcConfigAddFontDir (FcConfig
*config
,
338 FcConfigAddDir (FcConfig
*config
,
342 FcConfigAddConfigFile (FcConfig
*config
,
346 FcConfigSetCache (FcConfig
*config
,
350 FcConfigAddBlank (FcConfig
*config
,
354 FcConfigAddEdit (FcConfig
*config
,
360 FcConfigSetFonts (FcConfig
*config
,
365 FcConfigCompareValue (const FcValue m
,
371 FcNameUnparseCharSet (FcStrBuf
*buf
, const FcCharSet
*c
);
374 FcNameParseCharSet (FcChar8
*string
);
378 FcValueListPrint (FcValueList
*l
);
384 FcTestPrint (FcTest
*test
);
387 FcExprPrint (FcExpr
*expr
);
390 FcEditPrint (FcEdit
*edit
);
393 FcSubstPrint (FcSubst
*subst
);
407 FcConfigparse (void);
413 FcConfigerror (char *fmt
, ...);
416 FcConfigSaveField (const char *field
);
419 FcTestCreate (FcQual qual
, const FcChar8
*field
, FcOp compare
, FcExpr
*expr
);
422 FcTestDestroy (FcTest
*test
);
425 FcExprCreateInteger (int i
);
428 FcExprCreateDouble (double d
);
431 FcExprCreateString (const FcChar8
*s
);
434 FcExprCreateMatrix (const FcMatrix
*m
);
437 FcExprCreateBool (FcBool b
);
440 FcExprCreateNil (void);
443 FcExprCreateField (const char *field
);
446 FcExprCreateConst (const FcChar8
*constant
);
449 FcExprCreateOp (FcExpr
*left
, FcOp op
, FcExpr
*right
);
452 FcExprDestroy (FcExpr
*e
);
455 FcEditCreate (const char *field
, FcOp op
, FcExpr
*expr
);
458 FcEditDestroy (FcEdit
*e
);
466 FcMemAlloc (int kind
, int size
);
469 FcMemFree (int kind
, int size
);
478 FcNameBool (FcChar8
*v
, FcBool
*result
);
482 FcValueListDestroy (FcValueList
*l
);
485 FcPatternFind (FcPattern
*p
, const char *object
, FcBool insert
);
491 FcMatrixFree (FcMatrix
*mat
);
495 FcStrPlus (const FcChar8
*s1
, const FcChar8
*s2
);
498 FcStrFree (FcChar8
*s
);
501 FcStrBufInit (FcStrBuf
*buf
, FcChar8
*init
, int size
);
504 FcStrBufDestroy (FcStrBuf
*buf
);
507 FcStrBufDone (FcStrBuf
*buf
);
510 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
513 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
516 FcStrBufData (FcStrBuf
*buf
, const FcChar8
*s
, int len
);
518 #endif /* _FC_INT_H_ */