2 * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.16 2002/07/06 23:47:44 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];
166 typedef enum _FcLangResult {
167 FcLangEqual, FcLangDifferentCountry, FcLangDifferentLang
171 int ref; /* reference count */
172 FcBool constant; /* in hash table constant */
173 int num; /* size of leaves and numbers arrays */
179 int ref; /* reference count */
190 typedef struct _FcStrBuf {
198 typedef struct _FcFileCacheEnt {
199 struct _FcFileCacheEnt *next;
208 #define FC_FILE_CACHE_HASH_SIZE 509
210 struct _FcFileCache {
211 FcFileCacheEnt *ents[FC_FILE_CACHE_HASH_SIZE];
218 FcChar8 *file; /* original file name */
219 FcChar8 *new; /* temp file name -- write data here */
220 FcChar8 *lck; /* lockfile name (used for locking) */
221 FcChar8 *tmp; /* tmpfile name (used for locking) */
232 * File names loaded from the configuration -- saved here as the
233 * cache file must be consulted before the directories are scanned,
234 * and those directives may occur in any order
236 FcStrSet *configDirs; /* directories to scan for fonts */
237 FcChar8 *cache; /* name of per-user cache file */
239 * Set of allowed blank chars -- used to
240 * trim fonts of bogus glyphs
244 * List of directories containing fonts,
245 * built by recursively scanning the set
246 * of configured directories
250 * Names of all of the configuration files used
251 * to create this configuration
253 FcStrSet *configFiles; /* config files loaded */
255 * Substitution instructions for patterns and fonts;
256 * maxObjects is used to allocate appropriate intermediate storage
257 * while performing a whole set of substitutions
259 FcSubst *substPattern; /* substitutions for patterns */
260 FcSubst *substFont; /* substitutions for fonts */
261 int maxObjects; /* maximum number of tests in all substs */
263 * The set of fonts loaded from the listed directories; the
264 * order within the set does not determine the font selection,
265 * except in the case of identical matches in which case earlier fonts
266 * match preferrentially
268 FcFontSet *fonts[FcSetApplication + 1];
270 * Fontconfig can periodically rescan the system configuration
271 * and font directories. This rescanning occurs when font
272 * listing requests are made, but no more often than rescanInterval
275 time_t rescanTime; /* last time information was scanned */
276 int rescanInterval; /* interval between scans */
279 extern FcConfig *_fcConfig;
286 FcFileCacheCreate (void);
289 FcFileCacheFind (FcFileCache *cache,
295 FcFileCacheDestroy (FcFileCache *cache);
298 FcFileCacheValid (const FcChar8 *cache_file);
301 FcFileCacheLoad (FcFileCache *cache,
302 const FcChar8 *cache_file);
305 FcFileCacheUpdate (FcFileCache *cache,
308 const FcChar8 *name);
311 FcFileCacheSave (FcFileCache *cache,
312 const FcChar8 *cache_file);
315 FcFileCacheReadDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *cache_file);
318 FcFileCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *cache_file);
323 FcConfigAddConfigDir (FcConfig *config,
327 FcConfigAddFontDir (FcConfig *config,
331 FcConfigAddDir (FcConfig *config,
335 FcConfigAddConfigFile (FcConfig *config,
339 FcConfigSetCache (FcConfig *config,
343 FcConfigAddBlank (FcConfig *config,
347 FcConfigAddEdit (FcConfig *config,
353 FcConfigSetFonts (FcConfig *config,
358 FcConfigCompareValue (const FcValue m,
364 FcCharSetFreeze (FcCharSet *cs);
367 FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
370 FcNameParseCharSet (FcChar8 *string);
374 FcValueListPrint (FcValueList *l);
380 FcTestPrint (FcTest *test);
383 FcExprPrint (FcExpr *expr);
386 FcEditPrint (FcEdit *edit);
389 FcSubstPrint (FcSubst *subst);
402 FcFreeTypeIsExclusiveLang (const FcChar8 *lang);
405 FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang);
410 FcConfigparse (void);
416 FcConfigerror (char *fmt, ...);
419 FcConfigSaveField (const char *field);
422 FcTestCreate (FcQual qual, const FcChar8 *field, FcOp compare, FcExpr *expr);
425 FcTestDestroy (FcTest *test);
428 FcExprCreateInteger (int i);
431 FcExprCreateDouble (double d);
434 FcExprCreateString (const FcChar8 *s);
437 FcExprCreateMatrix (const FcMatrix *m);
440 FcExprCreateBool (FcBool b);
443 FcExprCreateNil (void);
446 FcExprCreateField (const char *field);
449 FcExprCreateConst (const FcChar8 *constant);
452 FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
455 FcExprDestroy (FcExpr *e);
458 FcEditCreate (const char *field, FcOp op, FcExpr *expr);
461 FcEditDestroy (FcEdit *e);
469 FcMemAlloc (int kind, int size);
472 FcMemFree (int kind, int size);
476 FcFreeTypeSetLang (FcPattern *pattern,
478 const FcChar8 *exclusiveLang);
481 FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
484 FcCharSetForLang (const FcChar8 *lang);
493 FcNameBool (FcChar8 *v, FcBool *result);
497 FcValueListDestroy (FcValueList *l);
500 FcPatternFindElt (const FcPattern *p, const char *object);
503 FcPatternInsertElt (FcPattern *p, const char *object);
506 FcPatternAddWithBinding (FcPattern *p,
509 FcValueBinding binding,
516 FcMatrixFree (FcMatrix *mat);
520 FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
523 FcStrFree (FcChar8 *s);
526 FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
529 FcStrBufDestroy (FcStrBuf *buf);
532 FcStrBufDone (FcStrBuf *buf);
535 FcStrBufChar (FcStrBuf *buf, FcChar8 c);
538 FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
541 FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
544 FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
546 #endif /* _FC_INT_H_ */