]>
git.wh0rd.org - fontconfig.git/blob - src/fcint.h
d9a870319fb22efe0dde8535d4cf32fe7edd8a5c
2 * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.10 2002/05/29 22:07:33 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
{
161 FcChar32 map
[256/32];
165 int ref
; /* reference count */
166 FcBool constant
; /* in hash table constant */
167 int num
; /* size of leaves and numbers arrays */
173 int ref
; /* reference count */
184 typedef struct _FcStrBuf
{
192 typedef struct _FcFileCacheEnt
{
193 struct _FcFileCacheEnt
*next
;
202 #define FC_FILE_CACHE_HASH_SIZE 509
204 struct _FcFileCache
{
205 FcFileCacheEnt
*ents
[FC_FILE_CACHE_HASH_SIZE
];
212 FcChar8
*file
; /* original file name */
213 FcChar8
*new; /* temp file name -- write data here */
214 FcChar8
*lck
; /* lockfile name (used for locking) */
215 FcChar8
*tmp
; /* tmpfile name (used for locking) */
226 * File names loaded from the configuration -- saved here as the
227 * cache file must be consulted before the directories are scanned,
228 * and those directives may occur in any order
230 FcStrSet
*configDirs
; /* directories to scan for fonts */
231 FcChar8
*cache
; /* name of per-user cache file */
233 * Set of allowed blank chars -- used to
234 * trim fonts of bogus glyphs
238 * List of directories containing fonts,
239 * built by recursively scanning the set
240 * of configured directories
244 * Names of all of the configuration files used
245 * to create this configuration
247 FcStrSet
*configFiles
; /* config files loaded */
249 * Substitution instructions for patterns and fonts;
250 * maxObjects is used to allocate appropriate intermediate storage
251 * while performing a whole set of substitutions
253 FcSubst
*substPattern
; /* substitutions for patterns */
254 FcSubst
*substFont
; /* substitutions for fonts */
255 int maxObjects
; /* maximum number of tests in all substs */
257 * The set of fonts loaded from the listed directories; the
258 * order within the set does not determine the font selection,
259 * except in the case of identical matches in which case earlier fonts
260 * match preferrentially
262 FcFontSet
*fonts
[FcSetApplication
+ 1];
264 * Fontconfig can periodically rescan the system configuration
265 * and font directories. This rescanning occurs when font
266 * listing requests are made, but no more often than rescanInterval
269 time_t rescanTime
; /* last time information was scanned */
270 int rescanInterval
; /* interval between scans */
273 extern FcConfig
*_fcConfig
;
280 FcFileCacheCreate (void);
283 FcFileCacheFind (FcFileCache
*cache
,
289 FcFileCacheDestroy (FcFileCache
*cache
);
292 FcFileCacheValid (const FcChar8
*cache_file
);
295 FcFileCacheLoad (FcFileCache
*cache
,
296 const FcChar8
*cache_file
);
299 FcFileCacheUpdate (FcFileCache
*cache
,
302 const FcChar8
*name
);
305 FcFileCacheSave (FcFileCache
*cache
,
306 const FcChar8
*cache_file
);
309 FcFileCacheReadDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
312 FcFileCacheWriteDir (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*cache_file
);
317 FcConfigAddConfigDir (FcConfig
*config
,
321 FcConfigAddFontDir (FcConfig
*config
,
325 FcConfigAddDir (FcConfig
*config
,
329 FcConfigAddConfigFile (FcConfig
*config
,
333 FcConfigSetCache (FcConfig
*config
,
337 FcConfigAddBlank (FcConfig
*config
,
341 FcConfigAddEdit (FcConfig
*config
,
347 FcConfigSetFonts (FcConfig
*config
,
352 FcConfigCompareValue (const FcValue m
,
358 FcNameUnparseCharSet (FcStrBuf
*buf
, const FcCharSet
*c
);
361 FcNameParseCharSet (FcChar8
*string
);
365 FcValueListPrint (FcValueList
*l
);
371 FcTestPrint (FcTest
*test
);
374 FcExprPrint (FcExpr
*expr
);
377 FcEditPrint (FcEdit
*edit
);
380 FcSubstPrint (FcSubst
*subst
);
394 FcConfigparse (void);
400 FcConfigerror (char *fmt
, ...);
403 FcConfigSaveField (const char *field
);
406 FcTestCreate (FcQual qual
, const FcChar8
*field
, FcOp compare
, FcExpr
*expr
);
409 FcTestDestroy (FcTest
*test
);
412 FcExprCreateInteger (int i
);
415 FcExprCreateDouble (double d
);
418 FcExprCreateString (const FcChar8
*s
);
421 FcExprCreateMatrix (const FcMatrix
*m
);
424 FcExprCreateBool (FcBool b
);
427 FcExprCreateNil (void);
430 FcExprCreateField (const char *field
);
433 FcExprCreateConst (const FcChar8
*constant
);
436 FcExprCreateOp (FcExpr
*left
, FcOp op
, FcExpr
*right
);
439 FcExprDestroy (FcExpr
*e
);
442 FcEditCreate (const char *field
, FcOp op
, FcExpr
*expr
);
445 FcEditDestroy (FcEdit
*e
);
453 FcMemAlloc (int kind
, int size
);
456 FcMemFree (int kind
, int size
);
465 FcNameBool (FcChar8
*v
, FcBool
*result
);
469 FcValueListDestroy (FcValueList
*l
);
472 FcPatternFind (FcPattern
*p
, const char *object
, FcBool insert
);
478 FcMatrixFree (FcMatrix
*mat
);
482 FcStrPlus (const FcChar8
*s1
, const FcChar8
*s2
);
485 FcStrFree (FcChar8
*s
);
488 FcStrBufInit (FcStrBuf
*buf
, FcChar8
*init
, int size
);
491 FcStrBufDestroy (FcStrBuf
*buf
);
494 FcStrBufDone (FcStrBuf
*buf
);
497 FcStrBufChar (FcStrBuf
*buf
, FcChar8 c
);
500 FcStrBufString (FcStrBuf
*buf
, const FcChar8
*s
);
503 FcStrBufData (FcStrBuf
*buf
, const FcChar8
*s
, int len
);
505 #endif /* _FC_INT_H_ */