]>
git.wh0rd.org - fontconfig.git/blob - src/fcint.h
2 * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.13 2002/06/03 08:31:15 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>
39 #include <fontconfig/fcfreetype.h>
44 typedef struct _FcSymbolic
{
49 #ifndef FC_CONFIG_PATH
50 #define FC_CONFIG_PATH "fonts.conf"
53 #define FC_FONT_FILE_INVALID ((FcChar8 *) ".")
54 #define FC_FONT_FILE_DIR ((FcChar8 *) ".dir")
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_SCANV 256
65 #define FC_DBG_MEMORY 512
67 #define FC_MEM_CHARSET 0
68 #define FC_MEM_CHARNODE 1
69 #define FC_MEM_FONTSET 2
70 #define FC_MEM_FONTPTR 3
71 #define FC_MEM_OBJECTSET 4
72 #define FC_MEM_OBJECTPTR 5
73 #define FC_MEM_MATRIX 6
74 #define FC_MEM_PATTERN 7
75 #define FC_MEM_PATELT 8
76 #define FC_MEM_VALLIST 9
77 #define FC_MEM_SUBSTATE 10
78 #define FC_MEM_STRING 11
79 #define FC_MEM_LISTBUCK 12
81 #define FC_MEM_STRSET 14
82 #define FC_MEM_STRLIST 15
83 #define FC_MEM_CONFIG 16
85 typedef enum _FcValueBinding
{
86 FcValueBindingWeak
, FcValueBindingStrong
89 typedef struct _FcValueList
{
90 struct _FcValueList
*next
;
91 FcValueBinding binding
;
95 typedef struct _FcPatternElt
{
108 FcOpInteger
, FcOpDouble
, FcOpString
, FcOpMatrix
, FcOpBool
, FcOpCharSet
,
110 FcOpField
, FcOpConst
,
111 FcOpAssign
, FcOpAssignReplace
,
112 FcOpPrependFirst
, FcOpPrepend
, FcOpAppend
, FcOpAppendLast
,
114 FcOpOr
, FcOpAnd
, FcOpEqual
, FcOpNotEqual
, FcOpContains
,
115 FcOpLess
, FcOpLessEqual
, FcOpMore
, FcOpMoreEqual
,
116 FcOpPlus
, FcOpMinus
, FcOpTimes
, FcOpDivide
,
117 FcOpNot
, FcOpComma
, FcOpInvalid
120 typedef struct _FcExpr
{
132 struct _FcExpr
*left
, *right
;
137 typedef enum _FcQual
{
138 FcQualAny
, FcQualAll
, FcQualFirst
, FcQualNotFirst
141 typedef struct _FcTest
{
142 struct _FcTest
*next
;
149 typedef struct _FcEdit
{
150 struct _FcEdit
*next
;
156 typedef struct _FcSubst
{
157 struct _FcSubst
*next
;
162 typedef struct _FcCharLeaf
{
163 FcChar32 map
[256/32];
167 int ref
; /* reference count */
168 FcBool constant
; /* in hash table constant */
169 int num
; /* size of leaves and numbers arrays */
175 int ref
; /* reference count */
186 typedef struct _FcStrBuf
{
194 typedef struct _FcFileCacheEnt
{
195 struct _FcFileCacheEnt
*next
;
204 #define FC_FILE_CACHE_HASH_SIZE 509
206 struct _FcFileCache
{
207 FcFileCacheEnt
*ents
[FC_FILE_CACHE_HASH_SIZE
];
214 FcChar8
*file
; /* original file name */
215 FcChar8
*new; /* temp file name -- write data here */
216 FcChar8
*lck
; /* lockfile name (used for locking) */
217 FcChar8
*tmp
; /* tmpfile name (used for locking) */
228 * File names loaded from the configuration -- saved here as the
229 * cache file must be consulted before the directories are scanned,
230 * and those directives may occur in any order
232 FcStrSet
*configDirs
; /* directories to scan for fonts */
233 FcChar8
*cache
; /* name of per-user cache file */
235 * Set of allowed blank chars -- used to
236 * trim fonts of bogus glyphs
240 * List of directories containing fonts,
241 * built by recursively scanning the set
242 * of configured directories
246 * Names of all of the configuration files used
247 * to create this configuration
249 FcStrSet
*configFiles
; /* config files loaded */
251 * Substitution instructions for patterns and fonts;
252 * maxObjects is used to allocate appropriate intermediate storage
253 * while performing a whole set of substitutions
255 FcSubst
*substPattern
; /* substitutions for patterns */
256 FcSubst
*substFont
; /* substitutions for fonts */
257 int maxObjects
; /* maximum number of tests in all substs */
259 * The set of fonts loaded from the listed directories; the
260 * order within the set does not determine the font selection,
261 * except in the case of identical matches in which case earlier fonts
262 * match preferrentially
264 FcFontSet
*fonts
[FcSetApplication
+ 1];
266 * Fontconfig can periodically rescan the system configuration
267 * and font directories. This rescanning occurs when font
268 * listing requests are made, but no more often than rescanInterval
271 time_t rescanTime
; /* last time information was scanned */
272 int rescanInterval
; /* interval between scans */
275 extern FcConfig
*_fcConfig
;
282 FcFileCacheCreate (void);
285 FcFileCacheFind (FcFileCache
*cache
,
291 FcFileCacheDestroy (FcFileCache
*cache
);
294 FcFileCacheValid (const FcChar8
*cache_file
);
297 FcFileCacheLoad (FcFileCache
*cache
,
298 const FcChar8
*cache_file
);
301 FcFileCacheUpdate (FcFileCache
*cache
,
304 const FcChar8
*name
);
307 FcFileCacheSave (FcFileCache
*cache
,
308 const FcChar8
*cache_file
);
311 FcFileCacheReadDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
314 FcFileCacheWriteDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
319 FcConfigAddConfigDir (FcConfig
*config
,
323 FcConfigAddFontDir (FcConfig
*config
,
327 FcConfigAddDir (FcConfig
*config
,
331 FcConfigAddConfigFile (FcConfig
*config
,
335 FcConfigSetCache (FcConfig
*config
,
339 FcConfigAddBlank (FcConfig
*config
,
343 FcConfigAddEdit (FcConfig
*config
,
349 FcConfigSetFonts (FcConfig
*config
,
354 FcConfigCompareValue (const FcValue m
,
360 FcCharSetFreeze (FcCharSet
*cs
);
363 FcNameUnparseCharSet (FcStrBuf
*buf
, const FcCharSet
*c
);
366 FcNameParseCharSet (FcChar8
*string
);
370 FcValueListPrint (FcValueList
*l
);
376 FcTestPrint (FcTest
*test
);
379 FcExprPrint (FcExpr
*expr
);
382 FcEditPrint (FcEdit
*edit
);
385 FcSubstPrint (FcSubst
*subst
);
399 FcConfigparse (void);
405 FcConfigerror (char *fmt
, ...);
408 FcConfigSaveField (const char *field
);
411 FcTestCreate (FcQual qual
, const FcChar8
*field
, FcOp compare
, FcExpr
*expr
);
414 FcTestDestroy (FcTest
*test
);
417 FcExprCreateInteger (int i
);
420 FcExprCreateDouble (double d
);
423 FcExprCreateString (const FcChar8
*s
);
426 FcExprCreateMatrix (const FcMatrix
*m
);
429 FcExprCreateBool (FcBool b
);
432 FcExprCreateNil (void);
435 FcExprCreateField (const char *field
);
438 FcExprCreateConst (const FcChar8
*constant
);
441 FcExprCreateOp (FcExpr
*left
, FcOp op
, FcExpr
*right
);
444 FcExprDestroy (FcExpr
*e
);
447 FcEditCreate (const char *field
, FcOp op
, FcExpr
*expr
);
450 FcEditDestroy (FcEdit
*e
);
458 FcMemAlloc (int kind
, int size
);
461 FcMemFree (int kind
, int size
);
470 FcNameBool (FcChar8
*v
, FcBool
*result
);
474 FcValueListDestroy (FcValueList
*l
);
477 FcPatternFindElt (const FcPattern
*p
, const char *object
);
480 FcPatternInsertElt (FcPattern
*p
, const char *object
);
486 FcMatrixFree (FcMatrix
*mat
);
490 FcStrPlus (const FcChar8
*s1
, const FcChar8
*s2
);
493 FcStrFree (FcChar8
*s
);
496 FcStrBufInit (FcStrBuf
*buf
, FcChar8
*init
, int size
);
499 FcStrBufDestroy (FcStrBuf
*buf
);
502 FcStrBufDone (FcStrBuf
*buf
);
505 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
508 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
511 FcStrBufData (FcStrBuf
*buf
, const FcChar8
*s
, int len
);
513 #endif /* _FC_INT_H_ */