]>
git.wh0rd.org - fontconfig.git/blob - src/fcint.h
beaa7c9931633d81bf6727b37bda2530ab4c0c5f
2 * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.11 2002/05/31 04:42:42 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 _FcMatcher
{
46 double (*compare
) (char *object
, FcValue value1
, FcValue value2
);
50 typedef struct _FcSymbolic
{
55 #ifndef FC_CONFIG_PATH
56 #define FC_CONFIG_PATH "fonts.conf"
59 #define FC_FONT_FILE_INVALID ((FcChar8 *) ".")
60 #define FC_FONT_FILE_DIR ((FcChar8 *) ".dir")
62 #define FC_DBG_MATCH 1
63 #define FC_DBG_MATCHV 2
65 #define FC_DBG_FONTSET 8
66 #define FC_DBG_CACHE 16
67 #define FC_DBG_CACHEV 32
68 #define FC_DBG_PARSE 64
69 #define FC_DBG_SCAN 128
70 #define FC_DBG_MEMORY 512
72 #define FC_MEM_CHARSET 0
73 #define FC_MEM_CHARNODE 1
74 #define FC_MEM_FONTSET 2
75 #define FC_MEM_FONTPTR 3
76 #define FC_MEM_OBJECTSET 4
77 #define FC_MEM_OBJECTPTR 5
78 #define FC_MEM_MATRIX 6
79 #define FC_MEM_PATTERN 7
80 #define FC_MEM_PATELT 8
81 #define FC_MEM_VALLIST 9
82 #define FC_MEM_SUBSTATE 10
83 #define FC_MEM_STRING 11
84 #define FC_MEM_LISTBUCK 12
86 #define FC_MEM_STRSET 14
87 #define FC_MEM_STRLIST 15
88 #define FC_MEM_CONFIG 16
90 typedef struct _FcValueList
{
91 struct _FcValueList
*next
;
95 typedef struct _FcPatternElt
{
107 FcOpInteger
, FcOpDouble
, FcOpString
, FcOpMatrix
, FcOpBool
, FcOpCharSet
,
109 FcOpField
, FcOpConst
,
110 FcOpAssign
, FcOpAssignReplace
,
111 FcOpPrependFirst
, FcOpPrepend
, FcOpAppend
, FcOpAppendLast
,
113 FcOpOr
, FcOpAnd
, FcOpEqual
, FcOpNotEqual
, FcOpContains
,
114 FcOpLess
, FcOpLessEqual
, FcOpMore
, FcOpMoreEqual
,
115 FcOpPlus
, FcOpMinus
, FcOpTimes
, FcOpDivide
,
116 FcOpNot
, FcOpComma
, FcOpInvalid
119 typedef struct _FcExpr
{
131 struct _FcExpr
*left
, *right
;
136 typedef enum _FcQual
{
140 typedef struct _FcTest
{
141 struct _FcTest
*next
;
148 typedef struct _FcEdit
{
149 struct _FcEdit
*next
;
155 typedef struct _FcSubst
{
156 struct _FcSubst
*next
;
161 typedef struct _FcCharLeaf
{
162 FcChar32 map
[256/32];
166 int ref
; /* reference count */
167 FcBool constant
; /* in hash table constant */
168 int num
; /* size of leaves and numbers arrays */
174 int ref
; /* reference count */
185 typedef struct _FcStrBuf
{
193 typedef struct _FcFileCacheEnt
{
194 struct _FcFileCacheEnt
*next
;
203 #define FC_FILE_CACHE_HASH_SIZE 509
205 struct _FcFileCache
{
206 FcFileCacheEnt
*ents
[FC_FILE_CACHE_HASH_SIZE
];
213 FcChar8
*file
; /* original file name */
214 FcChar8
*new; /* temp file name -- write data here */
215 FcChar8
*lck
; /* lockfile name (used for locking) */
216 FcChar8
*tmp
; /* tmpfile name (used for locking) */
227 * File names loaded from the configuration -- saved here as the
228 * cache file must be consulted before the directories are scanned,
229 * and those directives may occur in any order
231 FcStrSet
*configDirs
; /* directories to scan for fonts */
232 FcChar8
*cache
; /* name of per-user cache file */
234 * Set of allowed blank chars -- used to
235 * trim fonts of bogus glyphs
239 * List of directories containing fonts,
240 * built by recursively scanning the set
241 * of configured directories
245 * Names of all of the configuration files used
246 * to create this configuration
248 FcStrSet
*configFiles
; /* config files loaded */
250 * Substitution instructions for patterns and fonts;
251 * maxObjects is used to allocate appropriate intermediate storage
252 * while performing a whole set of substitutions
254 FcSubst
*substPattern
; /* substitutions for patterns */
255 FcSubst
*substFont
; /* substitutions for fonts */
256 int maxObjects
; /* maximum number of tests in all substs */
258 * The set of fonts loaded from the listed directories; the
259 * order within the set does not determine the font selection,
260 * except in the case of identical matches in which case earlier fonts
261 * match preferrentially
263 FcFontSet
*fonts
[FcSetApplication
+ 1];
265 * Fontconfig can periodically rescan the system configuration
266 * and font directories. This rescanning occurs when font
267 * listing requests are made, but no more often than rescanInterval
270 time_t rescanTime
; /* last time information was scanned */
271 int rescanInterval
; /* interval between scans */
274 extern FcConfig
*_fcConfig
;
281 FcFileCacheCreate (void);
284 FcFileCacheFind (FcFileCache
*cache
,
290 FcFileCacheDestroy (FcFileCache
*cache
);
293 FcFileCacheValid (const FcChar8
*cache_file
);
296 FcFileCacheLoad (FcFileCache
*cache
,
297 const FcChar8
*cache_file
);
300 FcFileCacheUpdate (FcFileCache
*cache
,
303 const FcChar8
*name
);
306 FcFileCacheSave (FcFileCache
*cache
,
307 const FcChar8
*cache_file
);
310 FcFileCacheReadDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
313 FcFileCacheWriteDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
318 FcConfigAddConfigDir (FcConfig
*config
,
322 FcConfigAddFontDir (FcConfig
*config
,
326 FcConfigAddDir (FcConfig
*config
,
330 FcConfigAddConfigFile (FcConfig
*config
,
334 FcConfigSetCache (FcConfig
*config
,
338 FcConfigAddBlank (FcConfig
*config
,
342 FcConfigAddEdit (FcConfig
*config
,
348 FcConfigSetFonts (FcConfig
*config
,
353 FcConfigCompareValue (const FcValue m
,
359 FcNameUnparseCharSet (FcStrBuf
*buf
, const FcCharSet
*c
);
362 FcNameParseCharSet (FcChar8
*string
);
366 FcValueListPrint (FcValueList
*l
);
372 FcTestPrint (FcTest
*test
);
375 FcExprPrint (FcExpr
*expr
);
378 FcEditPrint (FcEdit
*edit
);
381 FcSubstPrint (FcSubst
*subst
);
395 FcConfigparse (void);
401 FcConfigerror (char *fmt
, ...);
404 FcConfigSaveField (const char *field
);
407 FcTestCreate (FcQual qual
, const FcChar8
*field
, FcOp compare
, FcExpr
*expr
);
410 FcTestDestroy (FcTest
*test
);
413 FcExprCreateInteger (int i
);
416 FcExprCreateDouble (double d
);
419 FcExprCreateString (const FcChar8
*s
);
422 FcExprCreateMatrix (const FcMatrix
*m
);
425 FcExprCreateBool (FcBool b
);
428 FcExprCreateNil (void);
431 FcExprCreateField (const char *field
);
434 FcExprCreateConst (const FcChar8
*constant
);
437 FcExprCreateOp (FcExpr
*left
, FcOp op
, FcExpr
*right
);
440 FcExprDestroy (FcExpr
*e
);
443 FcEditCreate (const char *field
, FcOp op
, FcExpr
*expr
);
446 FcEditDestroy (FcEdit
*e
);
454 FcMemAlloc (int kind
, int size
);
457 FcMemFree (int kind
, int size
);
466 FcNameBool (FcChar8
*v
, FcBool
*result
);
470 FcValueListDestroy (FcValueList
*l
);
473 FcPatternFind (FcPattern
*p
, const char *object
, FcBool insert
);
479 FcMatrixFree (FcMatrix
*mat
);
483 FcStrPlus (const FcChar8
*s1
, const FcChar8
*s2
);
486 FcStrFree (FcChar8
*s
);
489 FcStrBufInit (FcStrBuf
*buf
, FcChar8
*init
, int size
);
492 FcStrBufDestroy (FcStrBuf
*buf
);
495 FcStrBufDone (FcStrBuf
*buf
);
498 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
501 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
504 FcStrBufData (FcStrBuf
*buf
, const FcChar8
*s
, int len
);
506 #endif /* _FC_INT_H_ */