fcint.h 27.3 KB
Newer Older
Keith Packard's avatar
Keith Packard committed
1
/*
2
 * fontconfig/src/fcint.h
Keith Packard's avatar
Keith Packard committed
3
 *
4
 * Copyright © 2000 Keith Packard
Keith Packard's avatar
Keith Packard committed
5 6 7 8 9
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
10
 * documentation, and that the name of the author(s) not be used in
Keith Packard's avatar
Keith Packard committed
11
 * advertising or publicity pertaining to distribution of the software without
12
 * specific, written prior permission.  The authors make no
Keith Packard's avatar
Keith Packard committed
13 14 15
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 *
16
 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
Keith Packard's avatar
Keith Packard committed
17
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
Keith Packard's avatar
Keith Packard committed
19 20 21 22 23 24 25 26 27
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _FCINT_H_
#define _FCINT_H_

28 29 30 31
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

32 33
#include "fcstdint.h"

Keith Packard's avatar
Keith Packard committed
34 35 36 37
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
38
#include <assert.h>
Keith Packard's avatar
Keith Packard committed
39 40
#include <errno.h>
#include <unistd.h>
41
#include <stddef.h>
Keith Packard's avatar
Keith Packard committed
42 43
#include <sys/types.h>
#include <sys/stat.h>
44
#include <time.h>
Keith Packard's avatar
Keith Packard committed
45
#include <fontconfig/fontconfig.h>
46
#include <fontconfig/fcprivate.h>
47
#include "fcdeprecate.h"
48 49
#include "fcmutex.h"
#include "fcatomic.h"
Keith Packard's avatar
Keith Packard committed
50 51 52 53 54

#ifndef FC_CONFIG_PATH
#define FC_CONFIG_PATH "fonts.conf"
#endif

Tor Lillqvist's avatar
Tor Lillqvist committed
55
#ifdef _WIN32
56
#  include "fcwindows.h"
57 58 59 60 61
typedef UINT (WINAPI *pfnGetSystemWindowsDirectory)(LPSTR, UINT);
typedef HRESULT (WINAPI *pfnSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
extern pfnGetSystemWindowsDirectory pGetSystemWindowsDirectory;
extern pfnSHGetFolderPathA pSHGetFolderPathA;
#  define FC_SEARCH_PATH_SEPARATOR ';'
62
#  define FC_DIR_SEPARATOR         '\\'
63
#  define FC_DIR_SEPARATOR_S       "\\"
Tor Lillqvist's avatar
Tor Lillqvist committed
64
#else
65
#  define FC_SEARCH_PATH_SEPARATOR ':'
66
#  define FC_DIR_SEPARATOR         '/'
67
#  define FC_DIR_SEPARATOR_S       "/"
Tor Lillqvist's avatar
Tor Lillqvist committed
68 69
#endif

70 71 72 73 74 75
#if __GNUC__ >= 4
#define FC_UNUSED	__attribute__((unused))
#else
#define FC_UNUSED
#endif

Keith Packard's avatar
Keith Packard committed
76 77 78 79 80 81 82 83
#define FC_DBG_MATCH	1
#define FC_DBG_MATCHV	2
#define FC_DBG_EDIT	4
#define FC_DBG_FONTSET	8
#define FC_DBG_CACHE	16
#define FC_DBG_CACHEV	32
#define FC_DBG_PARSE	64
#define FC_DBG_SCAN	128
84
#define FC_DBG_SCANV	256
85
#define FC_DBG_CONFIG	1024
86
#define FC_DBG_LANGSET	2048
Keith Packard's avatar
Keith Packard committed
87

88 89 90 91
#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond))

92 93 94 95
#define FC_MIN(a,b) ((a) < (b) ? (a) : (b))
#define FC_MAX(a,b) ((a) > (b) ? (a) : (b))
#define FC_ABS(a)   ((a) < 0 ? -(a) : (a))

96
/* slim_internal.h */
97
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun)
98
#define FcPrivate		__attribute__((__visibility__("hidden")))
99 100
#define HAVE_GNUC_ATTRIBUTE 1
#include "fcalias.h"
101 102 103 104 105 106
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define FcPrivate		__hidden
#else /* not gcc >= 3.3 and not Sun Studio >= 8 */
#define FcPrivate
#endif

107 108
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));

109
typedef enum _FcValueBinding {
110
    FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
111 112
} FcValueBinding;

Behdad Esfahbod's avatar
Behdad Esfahbod committed
113 114 115
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
#define FcFree(s) (free ((FcChar8 *) (s)))

116 117 118 119
/*
 * Serialized data structures use only offsets instead of pointers
 * A low bit of 1 indicates an offset.
 */
120

121 122
/* Is the provided pointer actually an offset? */
#define FcIsEncodedOffset(p)	((((intptr_t) (p)) & 1) != 0)
123

124 125 126 127 128 129 130 131 132 133 134 135 136 137
/* Encode offset in a pointer of type t */
#define FcOffsetEncode(o,t)	((t *) ((o) | 1))

/* Decode a pointer into an offset */
#define FcOffsetDecode(p)	(((intptr_t) (p)) & ~1)

/* Compute pointer offset */
#define FcPtrToOffset(b,p)	((intptr_t) (p) - (intptr_t) (b))

/* Given base address, offset and type, return a pointer */
#define FcOffsetToPtr(b,o,t)	((t *) ((intptr_t) (b) + (o)))

/* Given base address, encoded offset and type, return a pointer */
#define FcEncodedOffsetToPtr(b,p,t) FcOffsetToPtr(b,FcOffsetDecode(p),t)
138

139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
/* Given base address, pointer and type, return an encoded offset */
#define FcPtrToEncodedOffset(b,p,t) FcOffsetEncode(FcPtrToOffset(b,p),t)

/* Given a structure, offset member and type, return pointer */
#define FcOffsetMember(s,m,t)	    FcOffsetToPtr(s,(s)->m,t)

/* Given a structure, encoded offset member and type, return pointer to member */
#define FcEncodedOffsetMember(s,m,t) FcOffsetToPtr(s,FcOffsetDecode((s)->m), t)

/* Given a structure, member and type, convert the member to a pointer */
#define FcPointerMember(s,m,t)	(FcIsEncodedOffset((s)->m) ? \
				 FcEncodedOffsetMember (s,m,t) : \
				 (s)->m)

/*
 * Serialized values may hold strings, charsets and langsets as pointers,
 * unfortunately FcValue is an exposed type so we can't just always use
 * offsets
 */
#define FcValueString(v)	FcPointerMember(v,u.s,FcChar8)
#define FcValueCharSet(v)	FcPointerMember(v,u.c,const FcCharSet)
#define FcValueLangSet(v)	FcPointerMember(v,u.l,const FcLangSet)

typedef struct _FcValueList *FcValueListPtr;

typedef struct _FcValueList {
    struct _FcValueList	*next;
    FcValue		value;
    FcValueBinding	binding;
Keith Packard's avatar
Keith Packard committed
168 169
} FcValueList;

170
#define FcValueListNext(vl)	FcPointerMember(vl,next,FcValueList)
171
			
172
typedef int FcObject;
173

174
typedef struct _FcPatternElt *FcPatternEltPtr;
175

176
/*
177
 * Pattern elts are stuck in a structure connected to the pattern,
178 179 180
 * so they get moved around when the pattern is resized. Hence, the
 * values field must be a pointer/offset instead of just an offset
 */
Keith Packard's avatar
Keith Packard committed
181
typedef struct _FcPatternElt {
182 183
    FcObject		object;
    FcValueList		*values;
Keith Packard's avatar
Keith Packard committed
184 185
} FcPatternElt;

186 187
#define FcPatternEltValues(pe)	FcPointerMember(pe,values,FcValueList)

Keith Packard's avatar
Keith Packard committed
188 189 190
struct _FcPattern {
    int		    num;
    int		    size;
191
    intptr_t	    elts_offset;
192
    FcRef	    ref;
Keith Packard's avatar
Keith Packard committed
193 194
};

195 196 197
#define FcPatternElts(p)	FcOffsetMember(p,elts_offset,FcPatternElt)

#define FcFontSetFonts(fs)	FcPointerMember(fs,fonts,FcPattern *)
198

199
#define FcFontSetFont(fs,i)	(FcIsEncodedOffset((fs)->fonts) ? \
200
				 FcEncodedOffsetToPtr(fs, \
201 202 203
						      FcFontSetFonts(fs)[i], \
						      FcPattern) : \
				 fs->fonts[i])
204
						
Keith Packard's avatar
Keith Packard committed
205
typedef enum _FcOp {
206
    FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpRange, FcOpBool, FcOpCharSet, FcOpLangSet,
Keith Packard's avatar
Keith Packard committed
207 208
    FcOpNil,
    FcOpField, FcOpConst,
209
    FcOpAssign, FcOpAssignReplace,
Keith Packard's avatar
Keith Packard committed
210
    FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
211
    FcOpDelete, FcOpDeleteAll,
Keith Packard's avatar
Keith Packard committed
212
    FcOpQuest,
213
    FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual,
214
    FcOpContains, FcOpListing, FcOpNotContains,
Keith Packard's avatar
Keith Packard committed
215 216
    FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
    FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
217 218
    FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
    FcOpInvalid
Keith Packard's avatar
Keith Packard committed
219 220
} FcOp;

221 222 223 224 225 226 227 228
typedef enum _FcOpFlags {
	FcOpFlagIgnoreBlanks = 1 << 0
} FcOpFlags;

#define FC_OP_GET_OP(_x_)	((_x_) & 0xffff)
#define FC_OP_GET_FLAGS(_x_)	(((_x_) & 0xffff0000) >> 16)
#define FC_OP(_x_,_f_)		(FC_OP_GET_OP (_x_) | ((_f_) << 16))

229 230 231 232
typedef struct _FcExprMatrix {
  struct _FcExpr *xx, *xy, *yx, *yy;
} FcExprMatrix;

233 234 235 236 237 238
typedef struct _FcExprName {
  FcObject	object;
  FcMatchKind	kind;
} FcExprName;


Keith Packard's avatar
Keith Packard committed
239 240 241 242 243
typedef struct _FcExpr {
    FcOp   op;
    union {
	int	    ival;
	double	    dval;
244
	const FcChar8	    *sval;
245
	FcExprMatrix *mexpr;
Keith Packard's avatar
Keith Packard committed
246 247
	FcBool	    bval;
	FcCharSet   *cval;
248
	FcLangSet   *lval;
249 250

	FcExprName  name;
251
	const FcChar8	    *constant;
Keith Packard's avatar
Keith Packard committed
252 253 254 255 256 257
	struct {
	    struct _FcExpr *left, *right;
	} tree;
    } u;
} FcExpr;

258 259 260 261 262 263
typedef struct _FcExprPage FcExprPage;

struct _FcExprPage {
  FcExprPage *next_page;
  FcExpr *next;
  FcExpr exprs[(1024 - 2/* two pointers */ - 2/* malloc overhead */) * sizeof (void *) / sizeof (FcExpr)];
264
  FcExpr end[FLEXIBLE_ARRAY_MEMBER];
265 266
};

Keith Packard's avatar
Keith Packard committed
267
typedef enum _FcQual {
268
    FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
Keith Packard's avatar
Keith Packard committed
269 270
} FcQual;

271 272
#define FcMatchDefault	((FcMatchKind) -1)

Keith Packard's avatar
Keith Packard committed
273 274
typedef struct _FcTest {
    struct _FcTest	*next;
275
    FcMatchKind		kind;
Keith Packard's avatar
Keith Packard committed
276
    FcQual		qual;
277
    FcObject		object;
Keith Packard's avatar
Keith Packard committed
278 279 280 281 282 283
    FcOp		op;
    FcExpr		*expr;
} FcTest;

typedef struct _FcEdit {
    struct _FcEdit *next;
284
    FcObject	    object;
Keith Packard's avatar
Keith Packard committed
285 286
    FcOp	    op;
    FcExpr	    *expr;
287
    FcValueBinding  binding;
Keith Packard's avatar
Keith Packard committed
288 289 290 291 292 293 294 295
} FcEdit;

typedef struct _FcSubst {
    struct _FcSubst	*next;
    FcTest		*test;
    FcEdit		*edit;
} FcSubst;

296
typedef struct _FcCharLeaf {
Keith Packard's avatar
Keith Packard committed
297
    FcChar32	map[256/32];
298
} FcCharLeaf;
Keith Packard's avatar
Keith Packard committed
299 300

struct _FcCharSet {
301
    FcRef	    ref;	/* reference count */
302
    int		    num;	/* size of leaves and numbers arrays */
303 304
    intptr_t	    leaves_offset;
    intptr_t	    numbers_offset;
Keith Packard's avatar
Keith Packard committed
305 306
};

307 308 309 310 311 312
#define FcCharSetLeaves(c)	FcOffsetMember(c,leaves_offset,intptr_t)
#define FcCharSetLeaf(c,i)	(FcOffsetToPtr(FcCharSetLeaves(c), \
					       FcCharSetLeaves(c)[i], \
					       FcCharLeaf))
#define FcCharSetNumbers(c)	FcOffsetMember(c,numbers_offset,FcChar16)

313
struct _FcStrSet {
314
    FcRef	    ref;	/* reference count */
315 316
    int		    num;
    int		    size;
317
    FcChar8	    **strs;
318 319 320 321 322 323 324
};

struct _FcStrList {
    FcStrSet	    *set;
    int		    n;
};

325
typedef struct _FcStrBuf {
Keith Packard's avatar
Keith Packard committed
326 327 328 329 330
    FcChar8 *buf;
    FcBool  allocated;
    FcBool  failed;
    int	    len;
    int	    size;
331
    FcChar8 buf_static[16 * sizeof (void *)];
332
} FcStrBuf;
Keith Packard's avatar
Keith Packard committed
333

334
struct _FcCache {
335
    unsigned int magic;              /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */
336
    int		version;	    /* FC_CACHE_CONTENT_VERSION */
337
    intptr_t	size;		    /* size of file */
338 339 340 341
    intptr_t	dir;		    /* offset to dir name */
    intptr_t	dirs;		    /* offset to subdirs */
    int		dirs_count;	    /* number of subdir strings */
    intptr_t	set;		    /* offset to font set */
342
    int		checksum;	    /* checksum of directory state */
343
};
344

345 346
#undef FcCacheDir
#undef FcCacheSubdir
347 348 349
#define FcCacheDir(c)	FcOffsetMember(c,dir,FcChar8)
#define FcCacheDirs(c)	FcOffsetMember(c,dirs,intptr_t)
#define FcCacheSet(c)	FcOffsetMember(c,set,FcFontSet)
350 351
#define FcCacheSubdir(c,i)  FcOffsetToPtr (FcCacheDirs(c),\
					   FcCacheDirs(c)[i], \
352
					   FcChar8)
353 354 355 356 357 358 359

/*
 * Used while constructing a directory cache object
 */

#define FC_SERIALIZE_HASH_SIZE	8191

360 361 362 363 364 365 366 367
typedef union _FcAlign {
    double	d;
    int		i;
    intptr_t	ip;
    FcBool	b;
    void	*p;
} FcAlign;

368 369 370 371 372 373
typedef struct _FcSerializeBucket {
    struct _FcSerializeBucket *next;
    const void	*object;
    intptr_t	offset;
} FcSerializeBucket;

374 375
typedef struct _FcCharSetFreezer FcCharSetFreezer;

376 377
typedef struct _FcSerialize {
    intptr_t		size;
378
    FcCharSetFreezer	*cs_freezer;
379 380 381
    void		*linear;
    FcSerializeBucket	*buckets[FC_SERIALIZE_HASH_SIZE];
} FcSerialize;
382

383 384 385 386 387 388 389 390 391 392
/*
 * To map adobe glyph names to unicode values, a precomputed hash
 * table is used
 */

typedef struct _FcGlyphName {
    FcChar32	ucs;		/* unicode value */
    FcChar8	name[1];	/* name extends beyond struct */
} FcGlyphName;

393 394 395
/*
 * To perform case-insensitive string comparisons, a table
 * is used which holds three different kinds of folding data.
396
 *
397 398 399 400 401 402
 * The first is a range of upper case values mapping to a range
 * of their lower case equivalents.  Within each range, the offset
 * between upper and lower case is constant.
 *
 * The second is a range of upper case values which are interleaved
 * with their lower case equivalents.
403
 *
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
 * The third is a set of raw unicode values mapping to a list
 * of unicode values for comparison purposes.  This allows conversion
 * of ß to "ss" so that SS, ss and ß all match.  A separate array
 * holds the list of unicode values for each entry.
 *
 * These are packed into a single table.  Using a binary search,
 * the appropriate entry can be located.
 */

#define FC_CASE_FOLD_RANGE	    0
#define FC_CASE_FOLD_EVEN_ODD	    1
#define FC_CASE_FOLD_FULL	    2

typedef struct _FcCaseFold {
    FcChar32	upper;
    FcChar16	method : 2;
    FcChar16	count : 14;
    short    	offset;	    /* lower - upper for RANGE, table id for FULL */
} FcCaseFold;

424 425
#define FC_MAX_FILE_LEN	    4096

426 427
#define FC_CACHE_MAGIC_MMAP	    0xFC02FC04
#define FC_CACHE_MAGIC_ALLOC	    0xFC02FC05
428
#define FC_CACHE_CONTENT_VERSION    3
429

430 431 432 433 434 435 436
struct _FcAtomic {
    FcChar8	*file;		/* original file name */
    FcChar8	*new;		/* temp file name -- write data here */
    FcChar8	*lck;		/* lockfile name (used for locking) */
    FcChar8	*tmp;		/* tmpfile name (used for locking) */
};

Keith Packard's avatar
Keith Packard committed
437 438 439 440 441 442 443 444 445 446 447 448
struct _FcBlanks {
    int		nblank;
    int		sblank;
    FcChar32	*blanks;
};

struct _FcConfig {
    /*
     * File names loaded from the configuration -- saved here as the
     * cache file must be consulted before the directories are scanned,
     * and those directives may occur in any order
     */
449
    FcStrSet	*configDirs;	    /* directories to scan for fonts */
Keith Packard's avatar
Keith Packard committed
450 451 452 453 454
    /*
     * Set of allowed blank chars -- used to
     * trim fonts of bogus glyphs
     */
    FcBlanks	*blanks;
455 456
    /*
     * List of directories containing fonts,
457
     * built by recursively scanning the set
458 459 460
     * of configured directories
     */
    FcStrSet	*fontDirs;
461 462 463 464
    /*
     * List of directories containing cache files.
     */
    FcStrSet	*cacheDirs;
Keith Packard's avatar
Keith Packard committed
465 466 467 468
    /*
     * Names of all of the configuration files used
     * to create this configuration
     */
469
    FcStrSet	*configFiles;	    /* config files loaded */
Keith Packard's avatar
Keith Packard committed
470 471 472 473 474 475 476
    /*
     * Substitution instructions for patterns and fonts;
     * maxObjects is used to allocate appropriate intermediate storage
     * while performing a whole set of substitutions
     */
    FcSubst	*substPattern;	    /* substitutions for patterns */
    FcSubst	*substFont;	    /* substitutions for fonts */
477
    FcSubst	*substScan;	    /* substitutions for scanned fonts */
Keith Packard's avatar
Keith Packard committed
478
    int		maxObjects;	    /* maximum number of tests in all substs */
479 480 481 482 483
    /*
     * List of patterns used to control font file selection
     */
    FcStrSet	*acceptGlobs;
    FcStrSet	*rejectGlobs;
484 485
    FcFontSet	*acceptPatterns;
    FcFontSet	*rejectPatterns;
Keith Packard's avatar
Keith Packard committed
486 487 488 489 490 491 492
    /*
     * The set of fonts loaded from the listed directories; the
     * order within the set does not determine the font selection,
     * except in the case of identical matches in which case earlier fonts
     * match preferrentially
     */
    FcFontSet	*fonts[FcSetApplication + 1];
493 494 495 496 497 498 499 500
    /*
     * Fontconfig can periodically rescan the system configuration
     * and font directories.  This rescanning occurs when font
     * listing requests are made, but no more often than rescanInterval
     * seconds apart.
     */
    time_t	rescanTime;	    /* last time information was scanned */
    int		rescanInterval;	    /* interval between scans */
501

502
    FcRef	ref;                /* reference count */
503 504

    FcExprPage *expr_pool;	    /* pool of FcExpr's */
Keith Packard's avatar
Keith Packard committed
505
};
506

507 508 509 510 511
typedef struct _FcFileTime {
    time_t  time;
    FcBool  set;
} FcFileTime;

512 513
typedef struct _FcCharMap FcCharMap;

514 515 516 517 518 519 520
typedef struct _FcRange	    FcRange;

struct _FcRange {
    FcChar32 begin;
    FcChar32 end;
};

521 522 523 524 525 526 527
typedef struct _FcStatFS    FcStatFS;

struct _FcStatFS {
    FcBool is_remote_fs;
    FcBool is_mtime_broken;
};

528 529 530 531 532 533 534 535 536 537 538
typedef struct _FcValuePromotionBuffer FcValuePromotionBuffer;

struct _FcValuePromotionBuffer {
  union {
    double d;
    int i;
    long l;
    char c[256]; /* Enlarge as needed */
  } u;
};

Keith Packard's avatar
Keith Packard committed
539 540 541 542
/* fcblanks.c */

/* fccache.c */

543
FcPrivate FcCache *
544 545
FcDirCacheScan (const FcChar8 *dir, FcConfig *config);

546
FcPrivate FcCache *
547
FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcStrSet *dirs);
548

549
FcPrivate FcBool
550
FcDirCacheWrite (FcCache *cache, FcConfig *config);
551

552 553 554
FcPrivate FcBool
FcDirCacheCreateTagFile (const FcChar8 *cache_dir);

555 556 557 558 559 560
FcPrivate void
FcCacheObjectReference (void *object);

FcPrivate void
FcCacheObjectDereference (void *object);

561 562
FcPrivate void
FcCacheFini (void);
563

564
FcPrivate void
565 566
FcDirCacheReference (FcCache *cache, int nref);

Keith Packard's avatar
Keith Packard committed
567 568
/* fccfg.c */

569 570 571 572 573 574
FcPrivate FcBool
FcConfigInit (void);

FcPrivate void
FcConfigFini (void);

575 576 577 578 579 580 581 582 583
FcPrivate FcChar8 *
FcConfigXdgCacheHome (void);

FcPrivate FcChar8 *
FcConfigXdgConfigHome (void);

FcPrivate FcChar8 *
FcConfigXdgDataHome (void);

584 585 586
FcPrivate FcExpr *
FcConfigAllocExpr (FcConfig *config);

587
FcPrivate FcBool
588 589 590
FcConfigAddConfigDir (FcConfig	    *config,
		      const FcChar8 *d);

591
FcPrivate FcBool
592 593 594
FcConfigAddFontDir (FcConfig	    *config,
		    const FcChar8   *d);

595
FcPrivate FcBool
596 597
FcConfigAddDir (FcConfig	*config,
		const FcChar8	*d);
Keith Packard's avatar
Keith Packard committed
598

599
FcPrivate FcBool
600 601 602
FcConfigAddCacheDir (FcConfig	    *config,
		     const FcChar8  *d);

603
FcPrivate FcBool
604 605
FcConfigAddConfigFile (FcConfig		*config,
		       const FcChar8	*f);
Keith Packard's avatar
Keith Packard committed
606

607
FcPrivate FcBool
Keith Packard's avatar
Keith Packard committed
608 609 610
FcConfigAddBlank (FcConfig	*config,
		  FcChar32    	blank);

611
FcPrivate FcBool
Keith Packard's avatar
Keith Packard committed
612 613 614 615 616
FcConfigAddEdit (FcConfig	*config,
		 FcTest		*test,
		 FcEdit		*edit,
		 FcMatchKind	kind);

617
FcPrivate void
Keith Packard's avatar
Keith Packard committed
618 619 620 621
FcConfigSetFonts (FcConfig	*config,
		  FcFontSet	*fonts,
		  FcSetName	set);

622
FcPrivate FcBool
623
FcConfigCompareValue (const FcValue *m,
Keith Packard's avatar
Keith Packard committed
624
		      FcOp	    op,
625
		      const FcValue *v);
Keith Packard's avatar
Keith Packard committed
626

627
FcPrivate FcBool
628 629 630 631
FcConfigGlobAdd (FcConfig	*config,
		 const FcChar8	*glob,
		 FcBool		accept);

632
FcPrivate FcBool
633 634 635
FcConfigAcceptFilename (FcConfig	*config,
			const FcChar8	*filename);

636
FcPrivate FcBool
637 638 639 640
FcConfigPatternsAdd (FcConfig	*config,
		     FcPattern	*pattern,
		     FcBool	accept);

641
FcPrivate FcBool
642 643 644
FcConfigAcceptFont (FcConfig	    *config,
		    const FcPattern *font);

645
FcPrivate FcFileTime
646 647
FcConfigModifiedTime (FcConfig *config);

648
FcPrivate FcBool
649
FcConfigAddCache (FcConfig *config, FcCache *cache,
650
		  FcSetName set, FcStrSet *dirSet);
651 652

/* fcserialize.c */
653
FcPrivate intptr_t
654
FcAlignSize (intptr_t size);
655

656
FcPrivate FcSerialize *
657 658
FcSerializeCreate (void);

659
FcPrivate void
660 661
FcSerializeDestroy (FcSerialize *serialize);

662
FcPrivate FcBool
663 664
FcSerializeAlloc (FcSerialize *serialize, const void *object, int size);

665
FcPrivate intptr_t
666 667
FcSerializeReserve (FcSerialize *serialize, int size);

668
FcPrivate intptr_t
669 670
FcSerializeOffset (FcSerialize *serialize, const void *object);

671
FcPrivate void *
672 673
FcSerializePtr (FcSerialize *serialize, const void *object);

674
FcPrivate FcBool
675 676
FcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l);

677
FcPrivate FcLangSet *
678 679
FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l);

Keith Packard's avatar
Keith Packard committed
680
/* fccharset.c */
681
FcPrivate void
682 683
FcLangCharSetPopulate (void);

684
FcPrivate FcCharSetFreezer *
685 686
FcCharSetFreezerCreate (void);

687
FcPrivate const FcCharSet *
688 689
FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs);

690
FcPrivate void
691
FcCharSetFreezerDestroy (FcCharSetFreezer *freezer);
692

693
FcPrivate FcBool
694
FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
Keith Packard's avatar
Keith Packard committed
695

696
FcPrivate FcCharSet *
Keith Packard's avatar
Keith Packard committed
697
FcNameParseCharSet (FcChar8 *string);
698

699 700 701 702 703
FcPrivate FcBool
FcNameUnparseValue (FcStrBuf    *buf,
                    FcValue     *v0,
		    FcChar8     *escape);

704 705 706 707
FcPrivate FcBool
FcNameUnparseValueList (FcStrBuf	*buf,
			FcValueListPtr	v,
			FcChar8		*escape);
Keith Packard's avatar
Keith Packard committed
708

709
FcPrivate FcCharLeaf *
710
FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
711

712
FcPrivate FcBool
713
FcCharSetSerializeAlloc(FcSerialize *serialize, const FcCharSet *cs);
714

715
FcPrivate FcCharSet *
716
FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs);
717

718
FcPrivate FcChar16 *
719 720
FcCharSetGetNumbers(const FcCharSet *c);

721 722 723 724 725 726 727
/* fccompat.c */
FcPrivate int
FcOpen(const char *pathname, int flags, ...);

FcPrivate int
FcMakeTempfile (char *template);

728 729 730
FcPrivate int32_t
FcRandom (void);

Keith Packard's avatar
Keith Packard committed
731
/* fcdbg.c */
732 733 734 735

FcPrivate void
FcValuePrintFile (FILE *f, const FcValue v);

736
FcPrivate void
737 738 739 740 741 742 743
FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark);

FcPrivate void
FcValueListPrintWithPosition (FcValueListPtr l, const FcValueListPtr pos);

FcPrivate void
FcValueListPrint (FcValueListPtr l);
Keith Packard's avatar
Keith Packard committed
744

745
FcPrivate void
746 747
FcLangSetPrint (const FcLangSet *ls);

748
FcPrivate void
Keith Packard's avatar
Keith Packard committed
749 750
FcOpPrint (FcOp op);

751
FcPrivate void
752
FcTestPrint (const FcTest *test);
Keith Packard's avatar
Keith Packard committed
753

754
FcPrivate void
755
FcExprPrint (const FcExpr *expr);
Keith Packard's avatar
Keith Packard committed
756

757
FcPrivate void
758
FcEditPrint (const FcEdit *edit);
Keith Packard's avatar
Keith Packard committed
759

760
FcPrivate void
761
FcSubstPrint (const FcSubst *subst);
Keith Packard's avatar
Keith Packard committed
762

763
FcPrivate void
764
FcCharSetPrint (const FcCharSet *c);
765

766
extern FcPrivate int FcDebugVal;
767

768
#define FcDebug() (FcDebugVal)
769

770
FcPrivate void
771
FcInitDebug (void);
Keith Packard's avatar
Keith Packard committed
772

773
/* fcdefault.c */
774
FcPrivate FcChar8 *
775 776
FcGetDefaultLang (void);

Behdad Esfahbod's avatar
Behdad Esfahbod committed
777 778 779
FcPrivate FcChar8 *
FcGetPrgname (void);

780 781 782
FcPrivate void
FcDefaultFini (void);

Keith Packard's avatar
Keith Packard committed
783 784
/* fcdir.c */

785 786 787
FcPrivate FcBool
FcFileIsLink (const FcChar8 *file);

788
FcPrivate FcBool
789 790 791 792 793 794
FcFileScanConfig (FcFontSet	*set,
		  FcStrSet	*dirs,
		  FcBlanks	*blanks,
		  const FcChar8 *file,
		  FcConfig	*config);

795
FcPrivate FcBool
796 797 798
FcDirScanConfig (FcFontSet	*set,
		 FcStrSet	*dirs,
		 FcBlanks	*blanks,
799
		 const FcChar8	*dir,
800 801 802
		 FcBool		force,
		 FcConfig	*config);

Keith Packard's avatar
Keith Packard committed
803
/* fcfont.c */
804
FcPrivate int
Keith Packard's avatar
Keith Packard committed
805
FcFontDebug (void);
806

Keith Packard's avatar
Keith Packard committed
807
/* fcfs.c */
808

809
FcPrivate FcBool
810
FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s);
811

812
FcPrivate FcFontSet *
813
FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
Keith Packard's avatar
Keith Packard committed
814

815 816 817 818 819 820 821
/* fchash.c */
FcPrivate FcChar8 *
FcHashGetSHA256Digest (const FcChar8 *input_strings,
		       size_t         len);
FcPrivate FcChar8 *
FcHashGetSHA256DigestFromFile (const FcChar8 *filename);

822
/* fcxml.c */
823
FcPrivate void
Keith Packard's avatar
Keith Packard committed
824 825
FcTestDestroy (FcTest *test);

826
FcPrivate void
Keith Packard's avatar
Keith Packard committed
827 828
FcEditDestroy (FcEdit *e);

829
/* fclang.c */
830
FcPrivate FcLangSet *
831
FcFreeTypeLangSet (const FcCharSet  *charset,
832
		   const FcChar8    *exclusiveLang);
833

834
FcPrivate FcLangResult
835
FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
836

837
FcPrivate FcLangSet *
838
FcLangSetPromote (const FcChar8 *lang, FcValuePromotionBuffer *buf);
839

840
FcPrivate FcLangSet *
841 842
FcNameParseLangSet (const FcChar8 *string);

843
FcPrivate FcBool
844 845
FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);

846
FcPrivate FcChar8 *
847 848
FcNameUnparseEscaped (FcPattern *pat, FcBool escape);

Keith Packard's avatar
Keith Packard committed
849 850
/* fclist.c */

851
FcPrivate FcBool
852 853 854
FcListPatternMatchAny (const FcPattern *p,
		       const FcPattern *font);

Keith Packard's avatar
Keith Packard committed
855 856 857 858
/* fcmatch.c */

/* fcname.c */

859 860 861 862 863 864 865 866
enum {
  FC_INVALID_OBJECT = 0,
#define FC_OBJECT(NAME, Type) FC_##NAME##_OBJECT,
#include "fcobjs.h"
#undef FC_OBJECT
  FC_ONE_AFTER_MAX_BASE_OBJECT
#define FC_MAX_BASE_OBJECT (FC_ONE_AFTER_MAX_BASE_OBJECT - 1)
};
867

868
FcPrivate FcBool
869
FcNameBool (const FcChar8 *v, FcBool *result);
870

871
FcPrivate FcBool
872
FcObjectValidType (FcObject object, FcType type);
873

874
FcPrivate FcObject
875
FcObjectFromName (const char * name);
876

877
FcPrivate const char *
878
FcObjectName (FcObject object);
879

880 881 882
FcPrivate FcObjectSet *
FcObjectGetSet (void);

883
#define FcObjectCompare(a, b)	((int) a - (int) b)
884

Keith Packard's avatar
Keith Packard committed
885
/* fcpat.c */
886

887
FcPrivate FcValue
888 889
FcValueCanonicalize (const FcValue *v);

890 891 892
FcPrivate FcValueListPtr
FcValueListCreate (void);

893
FcPrivate void
894 895
FcValueListDestroy (FcValueListPtr l);

896 897 898 899 900 901 902 903 904 905 906 907 908
FcPrivate FcValueListPtr
FcValueListPrepend (FcValueListPtr vallist,
		    FcValue        value,
		    FcValueBinding binding);

FcPrivate FcValueListPtr
FcValueListAppend (FcValueListPtr vallist,
		   FcValue        value,
		   FcValueBinding binding);

FcPrivate FcValueListPtr
FcValueListDuplicate(FcValueListPtr orig);

909
FcPrivate FcPatternElt *
910
FcPatternObjectFindElt (const FcPattern *p, FcObject object);
911

912
FcPrivate FcPatternElt *
913
FcPatternObjectInsertElt (FcPattern *p, FcObject object);
Keith Packard's avatar
Keith Packard committed
914

915 916 917 918 919 920
FcPrivate FcBool
FcPatternObjectListAdd (FcPattern	*p,
			FcObject	object,
			FcValueListPtr	list,
			FcBool		append);

921
FcPrivate FcBool
922 923 924 925 926
FcPatternObjectAddWithBinding  (FcPattern	*p,
				FcObject	object,
				FcValue		value,
				FcValueBinding  binding,
				FcBool		append);
927

928
FcPrivate FcBool
929
FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append);
930

931
FcPrivate FcBool
932
FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
933

934
FcPrivate FcResult
935
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
936

937
FcPrivate FcBool
938
FcPatternObjectDel (FcPattern *p, FcObject object);
939

940
FcPrivate FcBool
941
FcPatternObjectRemove (FcPattern *p, FcObject object, int id);
942

943
FcPrivate FcBool
944
FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i);
945

946
FcPrivate FcBool
947
FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d);
948

949
FcPrivate FcBool
950
FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s);
951

952
FcPrivate FcBool
953
FcPatternObjectAddMatrix (FcPattern *p, FcObject object, const FcMatrix *s);
954

955
FcPrivate FcBool
956
FcPatternObjectAddCharSet (FcPattern *p, FcObject object, const FcCharSet *c);
957

958
FcPrivate FcBool
959
FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b);
960

961
FcPrivate FcBool
962 963
FcPatternObjectAddLangSet (FcPattern *p, FcObject object, const FcLangSet *ls);

964
FcPrivate FcResult
965 966
FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int n, int *i);

967
FcPrivate FcResult
968
FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int n, double *d);
969

970
FcPrivate FcResult
971
FcPatternObjectGetString (const FcPattern *p, FcObject object, int n, FcChar8 ** s);
972

973
FcPrivate FcResult
974
FcPatternObjectGetMatrix (const FcPattern *p, FcObject object, int n, FcMatrix **s);
975

976
FcPrivate FcResult
977
FcPatternObjectGetCharSet (const FcPattern *p, FcObject object, int n, FcCharSet **c);
978

979
FcPrivate FcResult
980
FcPatternObjectGetBool (const FcPattern *p, FcObject object, int n, FcBool *b);
981

982
FcPrivate FcResult
983 984
FcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet **ls);

985
FcPrivate FcBool
986 987
FcPatternAppend (FcPattern *p, FcPattern *s);

988
FcPrivate FcChar32
989 990
FcStringHash (const FcChar8 *s);

991
FcPrivate FcBool
992
FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat);
993

994
FcPrivate FcPattern *
995
FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat);
996

997
FcPrivate FcBool
998 999
FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *pat);

1000
FcPrivate FcValueList *
1001
FcValueListSerialize (FcSerialize *serialize, const FcValueList *pat);
1002

Keith Packard's avatar
Keith Packard committed
1003 1004 1005
/* fcrender.c */

/* fcmatrix.c */
1006

1007
extern FcPrivate const FcMatrix    FcIdentityMatrix;
1008

1009
FcPrivate void
Keith Packard's avatar
Keith Packard committed
1010 1011
FcMatrixFree (FcMatrix *mat);

1012 1013 1014 1015 1016
/* fcstat.c */

FcPrivate int
FcStat (const FcChar8 *file, struct stat *statb);

1017 1018 1019
FcPrivate int
FcStatChecksum (const FcChar8 *file, struct stat *statb);

1020 1021 1022 1023 1024 1025
FcPrivate FcBool
FcIsFsMmapSafe (int fd);

FcPrivate FcBool
FcIsFsMtimeBroken (const FcChar8 *dir);

Keith Packard's avatar
Keith Packard committed
1026
/* fcstr.c */
1027 1028 1029
FcPrivate FcBool
FcStrSetAddLangs (FcStrSet *strs, const char *languages);

1030
FcPrivate void
1031 1032
FcStrSetSort (FcStrSet * set);

1033
FcPrivate void
1034 1035
FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);

1036
FcPrivate void
1037 1038
FcStrBufDestroy (FcStrBuf *buf);

1039
FcPrivate FcChar8 *
1040 1041
FcStrBufDone (FcStrBuf *buf);

1042 1043 1044
FcPrivate FcChar8 *
FcStrBufDoneStatic (FcStrBuf *buf);

1045
FcPrivate FcBool
1046 1047
FcStrBufChar (FcStrBuf *buf, FcChar8 c);

1048
FcPrivate FcBool
1049 1050
FcStrBufString (FcStrBuf *buf, const FcChar8 *s);

1051
FcPrivate FcBool
1052 1053
FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);

1054
FcPrivate int
1055 1056
FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);

1057 1058 1059 1060 1061 1062
FcPrivate FcBool
FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex);

FcPrivate FcBool
FcStrRegexCmpIgnoreCase (const FcChar8 *s, const FcChar8 *regex);

1063
FcPrivate const FcChar8 *
1064 1065
FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);

1066
FcPrivate const FcChar8 *
1067 1068
FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);

1069 1070 1071
FcPrivate const FcChar8 *
FcStrContainsWord (const FcChar8 *s1, const FcChar8 *s2);

1072
FcPrivate FcBool
1073 1074
FcStrUsesHome (const FcChar8 *s);

1075
FcPrivate FcChar8 *
Tor Lillqvist's avatar
Tor Lillqvist committed
1076 1077
FcStrLastSlash (const FcChar8  *path);

1078
FcPrivate FcChar32
1079 1080
FcStrHashIgnoreCase (const FcChar8 *s);

1081
FcPrivate FcChar8 *
1082 1083
FcStrCanonFilename (const FcChar8 *s);

1084
FcPrivate FcBool
1085 1086
FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str);

1087
FcPrivate FcChar8 *
1088 1089
FcStrSerialize (FcSerialize *serialize, const FcChar8 *str);

1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106
/* fcobjs.c */

FcPrivate FcObject
FcObjectLookupIdByName (const char *str);

FcPrivate FcObject
FcObjectLookupBuiltinIdByName (const char *str);

FcPrivate const char *
FcObjectLookupOtherNameById (FcObject id);

FcPrivate const FcObjectType *
FcObjectLookupOtherTypeById (FcObject id);

FcPrivate const FcObjectType *
FcObjectLookupOtherTypeByName (const char *str);

Keith Packard's avatar
Keith Packard committed
1107
#endif /* _FC_INT_H_ */