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>
37 #include <fontconfig/fontconfig.h>
38 #include <fontconfig/fcprivate.h>
43 typedef struct _FcMatcher
{
45 double (*compare
) (char *object
, FcValue value1
, FcValue value2
);
48 typedef struct _FcSymbolic
{
53 #ifndef FC_CONFIG_PATH
54 #define FC_CONFIG_PATH "fonts.conf"
57 #define FC_FONT_FILE_INVALID ((FcChar8 *) ".")
58 #define FC_FONT_FILE_DIR ((FcChar8 *) ".dir")
60 #define FC_DBG_MATCH 1
61 #define FC_DBG_MATCHV 2
63 #define FC_DBG_FONTSET 8
64 #define FC_DBG_CACHE 16
65 #define FC_DBG_CACHEV 32
66 #define FC_DBG_PARSE 64
67 #define FC_DBG_SCAN 128
68 #define FC_DBG_MEMORY 512
70 #define FC_MEM_CHARSET 0
71 #define FC_MEM_CHARNODE 1
72 #define FC_MEM_FONTSET 2
73 #define FC_MEM_FONTPTR 3
74 #define FC_MEM_OBJECTSET 4
75 #define FC_MEM_OBJECTPTR 5
76 #define FC_MEM_MATRIX 6
77 #define FC_MEM_PATTERN 7
78 #define FC_MEM_PATELT 8
79 #define FC_MEM_VALLIST 9
80 #define FC_MEM_SUBSTATE 10
81 #define FC_MEM_STRING 11
82 #define FC_MEM_LISTBUCK 12
84 #define FC_MEM_STRSET 14
85 #define FC_MEM_STRLIST 15
86 #define FC_MEM_CONFIG 16
88 typedef struct _FcValueList
{
89 struct _FcValueList
*next
;
93 typedef struct _FcPatternElt
{
105 FcOpInteger
, FcOpDouble
, FcOpString
, FcOpMatrix
, FcOpBool
, FcOpCharSet
,
107 FcOpField
, FcOpConst
,
108 FcOpAssign
, FcOpAssignReplace
,
109 FcOpPrependFirst
, FcOpPrepend
, FcOpAppend
, FcOpAppendLast
,
111 FcOpOr
, FcOpAnd
, FcOpEqual
, FcOpNotEqual
, FcOpContains
,
112 FcOpLess
, FcOpLessEqual
, FcOpMore
, FcOpMoreEqual
,
113 FcOpPlus
, FcOpMinus
, FcOpTimes
, FcOpDivide
,
114 FcOpNot
, FcOpComma
, FcOpInvalid
117 typedef struct _FcExpr
{
129 struct _FcExpr
*left
, *right
;
134 typedef enum _FcQual
{
138 typedef struct _FcTest
{
139 struct _FcTest
*next
;
146 typedef struct _FcEdit
{
147 struct _FcEdit
*next
;
153 typedef struct _FcSubst
{
154 struct _FcSubst
*next
;
159 typedef struct _FcCharLeaf FcCharLeaf
;
160 typedef struct _FcCharBranch FcCharBranch
;
161 typedef union _FcCharNode FcCharNode
;
164 FcChar32 map
[256/32];
168 FcCharBranch
*branch
;
172 struct _FcCharBranch
{
173 FcCharNode nodes
[256];
178 int ref
; /* reference count */
179 FcBool constant
; /* shared constant */
184 int ref
; /* reference count */
195 typedef struct _FcStrBuf
{
203 typedef struct _FcFileCacheEnt
{
204 struct _FcFileCacheEnt
*next
;
213 #define FC_FILE_CACHE_HASH_SIZE 509
215 struct _FcFileCache
{
216 FcFileCacheEnt
*ents
[FC_FILE_CACHE_HASH_SIZE
];
223 FcChar8
*file
; /* original file name */
224 FcChar8
*new; /* temp file name -- write data here */
225 FcChar8
*lck
; /* lockfile name (used for locking) */
226 FcChar8
*tmp
; /* tmpfile name (used for locking) */
237 * File names loaded from the configuration -- saved here as the
238 * cache file must be consulted before the directories are scanned,
239 * and those directives may occur in any order
241 FcStrSet
*configDirs
; /* directories to scan for fonts */
242 FcChar8
*cache
; /* name of per-user cache file */
244 * Set of allowed blank chars -- used to
245 * trim fonts of bogus glyphs
249 * List of directories containing fonts,
250 * built by recursively scanning the set
251 * of configured directories
255 * Names of all of the configuration files used
256 * to create this configuration
258 FcStrSet
*configFiles
; /* config files loaded */
260 * Substitution instructions for patterns and fonts;
261 * maxObjects is used to allocate appropriate intermediate storage
262 * while performing a whole set of substitutions
264 FcSubst
*substPattern
; /* substitutions for patterns */
265 FcSubst
*substFont
; /* substitutions for fonts */
266 int maxObjects
; /* maximum number of tests in all substs */
268 * The set of fonts loaded from the listed directories; the
269 * order within the set does not determine the font selection,
270 * except in the case of identical matches in which case earlier fonts
271 * match preferrentially
273 FcFontSet
*fonts
[FcSetApplication
+ 1];
275 * Fontconfig can periodically rescan the system configuration
276 * and font directories. This rescanning occurs when font
277 * listing requests are made, but no more often than rescanInterval
280 time_t rescanTime
; /* last time information was scanned */
281 int rescanInterval
; /* interval between scans */
284 extern FcConfig
*_fcConfig
;
291 FcFileCacheCreate (void);
294 FcFileCacheFind (FcFileCache
*cache
,
300 FcFileCacheDestroy (FcFileCache
*cache
);
303 FcFileCacheValid (const FcChar8
*cache_file
);
306 FcFileCacheLoad (FcFileCache
*cache
,
307 const FcChar8
*cache_file
);
310 FcFileCacheUpdate (FcFileCache
*cache
,
313 const FcChar8
*name
);
316 FcFileCacheSave (FcFileCache
*cache
,
317 const FcChar8
*cache_file
);
320 FcFileCacheReadDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
323 FcFileCacheWriteDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
328 FcConfigAddConfigDir (FcConfig
*config
,
332 FcConfigAddFontDir (FcConfig
*config
,
336 FcConfigAddDir (FcConfig
*config
,
340 FcConfigAddConfigFile (FcConfig
*config
,
344 FcConfigSetCache (FcConfig
*config
,
348 FcConfigAddBlank (FcConfig
*config
,
352 FcConfigAddEdit (FcConfig
*config
,
358 FcConfigSetFonts (FcConfig
*config
,
363 FcConfigCompareValue (const FcValue m
,
369 FcNameUnparseCharSet (FcStrBuf
*buf
, const FcCharSet
*c
);
372 FcNameParseCharSet (FcChar8
*string
);
376 FcValueListPrint (FcValueList
*l
);
382 FcTestPrint (FcTest
*test
);
385 FcExprPrint (FcExpr
*expr
);
388 FcEditPrint (FcEdit
*edit
);
391 FcSubstPrint (FcSubst
*subst
);
405 FcConfigparse (void);
411 FcConfigerror (char *fmt
, ...);
414 FcConfigSaveField (const char *field
);
417 FcTestCreate (FcQual qual
, const FcChar8
*field
, FcOp compare
, FcExpr
*expr
);
420 FcTestDestroy (FcTest
*test
);
423 FcExprCreateInteger (int i
);
426 FcExprCreateDouble (double d
);
429 FcExprCreateString (const FcChar8
*s
);
432 FcExprCreateMatrix (const FcMatrix
*m
);
435 FcExprCreateBool (FcBool b
);
438 FcExprCreateNil (void);
441 FcExprCreateField (const char *field
);
444 FcExprCreateConst (const FcChar8
*constant
);
447 FcExprCreateOp (FcExpr
*left
, FcOp op
, FcExpr
*right
);
450 FcExprDestroy (FcExpr
*e
);
453 FcEditCreate (const char *field
, FcOp op
, FcExpr
*expr
);
456 FcEditDestroy (FcEdit
*e
);
464 FcMemAlloc (int kind
, int size
);
467 FcMemFree (int kind
, int size
);
476 FcNameBool (FcChar8
*v
, FcBool
*result
);
480 FcValueListDestroy (FcValueList
*l
);
483 FcPatternFind (FcPattern
*p
, const char *object
, FcBool insert
);
489 FcMatrixFree (FcMatrix
*mat
);
493 FcStrPlus (const FcChar8
*s1
, const FcChar8
*s2
);
496 FcStrFree (FcChar8
*s
);
499 FcStrBufInit (FcStrBuf
*buf
, FcChar8
*init
, int size
);
502 FcStrBufDestroy (FcStrBuf
*buf
);
505 FcStrBufDone (FcStrBuf
*buf
);
508 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
511 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
514 FcStrBufData (FcStrBuf
*buf
, const FcChar8
*s
, int len
);
516 #endif /* _FC_INT_H_ */