| 1 |
/* |
| 2 |
* fontconfig/src/fcint.h |
| 3 |
* |
| 4 |
* Copyright © 2000 Keith Packard |
| 5 |
* |
| 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 the author(s) not be used in |
| 11 |
* advertising or publicity pertaining to distribution of the software without |
| 12 |
* specific, written prior permission. The authors make no |
| 13 |
* representations about the suitability of this software for any purpose. It |
| 14 |
* is provided "as is" without express or implied warranty. |
| 15 |
* |
| 16 |
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 17 |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 18 |
* EVENT SHALL THE AUTHOR(S) 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. |
| 23 |
*/ |
| 24 |
|
| 25 |
#ifndef _FCINT_H_ |
| 26 |
#define _FCINT_H_ |
| 27 |
|
| 28 |
#ifdef HAVE_CONFIG_H |
| 29 |
# include <config.h> |
| 30 |
#endif |
| 31 |
|
| 32 |
#include "fcstdint.h" |
| 33 |
|
| 34 |
#include <assert.h> |
| 35 |
#include <ctype.h> |
| 36 |
#include <errno.h> |
| 37 |
#include <float.h> |
| 38 |
#include <limits.h> |
| 39 |
#include <math.h> |
| 40 |
#include <stdio.h> |
| 41 |
#include <stdlib.h> |
| 42 |
#include <string.h> |
| 43 |
#ifdef HAVE_UNISTD_H |
| 44 |
# include <unistd.h> |
| 45 |
#endif |
| 46 |
#include <fontconfig/fontconfig.h> |
| 47 |
#include <fontconfig/fcprivate.h> |
| 48 |
|
| 49 |
#if ENABLE_FONTATIONS |
| 50 |
# include <fontconfig/fcfontations.h> |
| 51 |
#endif |
| 52 |
|
| 53 |
#include <stddef.h> |
| 54 |
#include <sys/stat.h> |
| 55 |
#include <sys/types.h> |
| 56 |
#include <time.h> |
| 57 |
|
| 58 |
#include "fcatomic.h" |
| 59 |
#include "fcdeprecate.h" |
| 60 |
#include "fcmutex.h" |
| 61 |
|
| 62 |
#ifndef FC_CONFIG_PATH |
| 63 |
# define FC_CONFIG_PATH "fonts.conf" |
| 64 |
#endif |
| 65 |
|
| 66 |
#ifdef _WIN32 |
| 67 |
# define FC_LIKELY(expr) (expr) |
| 68 |
# define FC_UNLIKELY(expr) (expr) |
| 69 |
#else |
| 70 |
# define FC_LIKELY(expr) (__builtin_expect (((expr) ? 1 : 0), 1)) |
| 71 |
# define FC_UNLIKELY(expr) (__builtin_expect (((expr) ? 1 : 0), 0)) |
| 72 |
#endif |
| 73 |
|
| 74 |
#ifdef _WIN32 |
| 75 |
# include "fcwindows.h" |
| 76 |
typedef UINT (WINAPI *pfnGetSystemWindowsDirectory) (LPSTR, UINT); |
| 77 |
typedef HRESULT (WINAPI *pfnSHGetFolderPathA) (HWND, int, HANDLE, DWORD, LPSTR); |
| 78 |
extern pfnGetSystemWindowsDirectory pGetSystemWindowsDirectory; |
| 79 |
extern pfnSHGetFolderPathA pSHGetFolderPathA; |
| 80 |
# define FC_SEARCH_PATH_SEPARATOR ';' |
| 81 |
# define FC_DIR_SEPARATOR '\\' |
| 82 |
# define FC_DIR_SEPARATOR_S "\\" |
| 83 |
#else |
| 84 |
# define FC_SEARCH_PATH_SEPARATOR ':' |
| 85 |
# define FC_DIR_SEPARATOR '/' |
| 86 |
# define FC_DIR_SEPARATOR_S "/" |
| 87 |
#endif |
| 88 |
|
| 89 |
#ifdef PATH_MAX |
| 90 |
# define FC_PATH_MAX PATH_MAX |
| 91 |
#else |
| 92 |
# define FC_PATH_MAX 128 |
| 93 |
#endif |
| 94 |
|
| 95 |
#if __GNUC__ >= 4 |
| 96 |
# define FC_UNUSED __attribute__ ((unused)) |
| 97 |
#else |
| 98 |
# define FC_UNUSED |
| 99 |
#endif |
| 100 |
|
| 101 |
#ifndef FC_UINT64_FORMAT |
| 102 |
# define FC_UINT64_FORMAT "llu" |
| 103 |
#endif |
| 104 |
|
| 105 |
#define FC_DBG_MATCH 1 |
| 106 |
#define FC_DBG_MATCHV 2 |
| 107 |
#define FC_DBG_EDIT 4 |
| 108 |
#define FC_DBG_FONTSET 8 |
| 109 |
#define FC_DBG_CACHE 16 |
| 110 |
#define FC_DBG_CACHEV 32 |
| 111 |
#define FC_DBG_PARSE 64 |
| 112 |
#define FC_DBG_SCAN 128 |
| 113 |
#define FC_DBG_SCANV 256 |
| 114 |
#define FC_DBG_CONFIG 1024 |
| 115 |
#define FC_DBG_LANGSET 2048 |
| 116 |
#define FC_DBG_MATCH2 4096 |
| 117 |
|
| 118 |
#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond) ? 1 : -1] FC_UNUSED |
| 119 |
#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond)) |
| 120 |
#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond)) |
| 121 |
|
| 122 |
#define FC_MIN(a, b) ((a) < (b) ? (a) : (b)) |
| 123 |
#define FC_MAX(a, b) ((a) > (b) ? (a) : (b)) |
| 124 |
|
| 125 |
/* slim_internal.h */ |
| 126 |
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun) && !defined(BINDGEN_IGNORE_VISIBILITY) |
| 127 |
# define FcPrivate __attribute__ ((__visibility__ ("hidden"))) |
| 128 |
# define HAVE_GNUC_ATTRIBUTE 1 |
| 129 |
# include "fcalias.h" |
| 130 |
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) |
| 131 |
# define FcPrivate __hidden |
| 132 |
#else /* not gcc >= 3.3 and not Sun Studio >= 8 */ |
| 133 |
# define FcPrivate |
| 134 |
#endif |
| 135 |
|
| 136 |
/* NLS */ |
| 137 |
#ifdef ENABLE_NLS |
| 138 |
# include <libintl.h> |
| 139 |
# define _(x) (dgettext (GETTEXT_PACKAGE, x)) |
| 140 |
#else |
| 141 |
/* dgettext macro must be defined after existing declarations */ |
| 142 |
# include <locale.h> |
| 143 |
# define dgettext(d, s) (s) |
| 144 |
# define _(x) (x) |
| 145 |
#endif |
| 146 |
|
| 147 |
#define N_(x) x |
| 148 |
|
| 149 |
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int)); |
| 150 |
|
| 151 |
#define FcStrdup(s) ((FcChar8 *)strdup ((const char *)(s))) |
| 152 |
#define FcFree(s) (free ((FcChar8 *)(s))) |
| 153 |
|
| 154 |
/* |
| 155 |
* Serialized data structures use only offsets instead of pointers |
| 156 |
* A low bit of 1 indicates an offset. |
| 157 |
*/ |
| 158 |
|
| 159 |
/* Is the provided pointer actually an offset? */ |
| 160 |
#define FcIsEncodedOffset(p) ((((intptr_t)(p)) & 1) != 0) |
| 161 |
|
| 162 |
/* Encode offset in a pointer of type t */ |
| 163 |
#define FcOffsetEncode(o, t) ((t *)(intptr_t)((o) | 1)) |
| 164 |
|
| 165 |
/* Decode a pointer into an offset */ |
| 166 |
#define FcOffsetDecode(p) (((intptr_t)(p)) & ~1) |
| 167 |
|
| 168 |
/* Compute pointer offset */ |
| 169 |
#define FcPtrToOffset(b, p) ((ptrdiff_t)((intptr_t)(p) - (intptr_t)(b))) |
| 170 |
|
| 171 |
/* Given base address, offset and type, return a pointer */ |
| 172 |
#define FcOffsetToPtr(b, o, t) ((t *)((intptr_t)(b) + (ptrdiff_t)(o))) |
| 173 |
|
| 174 |
/* Given base address, encoded offset and type, return a pointer */ |
| 175 |
#define FcEncodedOffsetToPtr(b, p, t) FcOffsetToPtr (b, FcOffsetDecode (p), t) |
| 176 |
|
| 177 |
/* Given base address, pointer and type, return an encoded offset */ |
| 178 |
#define FcPtrToEncodedOffset(b, p, t) FcOffsetEncode (FcPtrToOffset (b, p), t) |
| 179 |
|
| 180 |
/* Given a structure, offset member and type, return pointer */ |
| 181 |
#define FcOffsetMember(s, m, t) FcOffsetToPtr (s, (s)->m, t) |
| 182 |
|
| 183 |
/* Given a structure, encoded offset member and type, return pointer to member */ |
| 184 |
#define FcEncodedOffsetMember(s, m, t) FcOffsetToPtr (s, FcOffsetDecode ((s)->m), t) |
| 185 |
|
| 186 |
/* Given a structure, member and type, convert the member to a pointer */ |
| 187 |
#define FcPointerMember(s, m, t) (FcIsEncodedOffset ((s)->m) ? FcEncodedOffsetMember (s, m, t) : (s)->m) |
| 188 |
|
| 189 |
/* |
| 190 |
* Serialized values may hold strings, charsets and langsets as pointers, |
| 191 |
* unfortunately FcValue is an exposed type so we can't just always use |
| 192 |
* offsets |
| 193 |
*/ |
| 194 |
#define FcValueString(v) FcPointerMember (v, u.s, FcChar8) |
| 195 |
#define FcValueCharSet(v) FcPointerMember (v, u.c, const FcCharSet) |
| 196 |
#define FcValueLangSet(v) FcPointerMember (v, u.l, const FcLangSet) |
| 197 |
#define FcValueRange(v) FcPointerMember (v, u.r, const FcRange) |
| 198 |
|
| 199 |
typedef struct _FcValueList *FcValueListPtr; |
| 200 |
|
| 201 |
typedef struct _FcValueList { |
| 202 |
struct _FcValueList *next; |
| 203 |
FcValue value; |
| 204 |
FcValueBinding binding; |
| 205 |
} FcValueList; |
| 206 |
|
| 207 |
#define FcValueListNext(vl) FcPointerMember (vl, next, FcValueList) |
| 208 |
|
| 209 |
typedef int FcObject; |
| 210 |
|
| 211 |
/* The 1024 is to leave some room for future added internal objects, such |
| 212 |
* that caches from newer fontconfig can still be used with older fontconfig |
| 213 |
* without getting confused. */ |
| 214 |
#define FC_EXT_OBJ_INDEX 1024 |
| 215 |
#define FC_OBJ_ID(_n_) ((_n_) & (~FC_EXT_OBJ_INDEX)) |
| 216 |
|
| 217 |
typedef struct _FcPatternElt *FcPatternEltPtr; |
| 218 |
|
| 219 |
/* |
| 220 |
* Pattern elts are stuck in a structure connected to the pattern, |
| 221 |
* so they get moved around when the pattern is resized. Hence, the |
| 222 |
* values field must be a pointer/offset instead of just an offset |
| 223 |
*/ |
| 224 |
typedef struct _FcPatternElt { |
| 225 |
FcObject object; |
| 226 |
FcValueList *values; |
| 227 |
} FcPatternElt; |
| 228 |
|
| 229 |
#define FcPatternEltValues(pe) FcPointerMember (pe, values, FcValueList) |
| 230 |
|
| 231 |
struct _FcPattern { |
| 232 |
int num; |
| 233 |
int size; |
| 234 |
intptr_t elts_offset; |
| 235 |
FcRef ref; |
| 236 |
}; |
| 237 |
|
| 238 |
#define FcPatternElts(p) FcOffsetMember (p, elts_offset, FcPatternElt) |
| 239 |
|
| 240 |
#define FcFontSetFonts(fs) FcPointerMember (fs, fonts, FcPattern *) |
| 241 |
|
| 242 |
#define FcFontSetFont(fs, i) (FcIsEncodedOffset ((fs)->fonts) ? FcEncodedOffsetToPtr (fs, \ |
| 243 |
FcFontSetFonts (fs)[i], \ |
| 244 |
FcPattern) \ |
| 245 |
: fs->fonts[i]) |
| 246 |
|
| 247 |
typedef enum _FcOp { |
| 248 |
FcOpInteger, |
| 249 |
FcOpDouble, |
| 250 |
FcOpString, |
| 251 |
FcOpMatrix, |
| 252 |
FcOpRange, |
| 253 |
FcOpBool, |
| 254 |
FcOpCharSet, |
| 255 |
FcOpLangSet, |
| 256 |
FcOpNil, |
| 257 |
FcOpField, |
| 258 |
FcOpConst, |
| 259 |
FcOpAssign, |
| 260 |
FcOpAssignReplace, |
| 261 |
FcOpPrependFirst, |
| 262 |
FcOpPrepend, |
| 263 |
FcOpAppend, |
| 264 |
FcOpAppendLast, |
| 265 |
FcOpDelete, |
| 266 |
FcOpDeleteAll, |
| 267 |
FcOpQuest, |
| 268 |
FcOpOr, |
| 269 |
FcOpAnd, |
| 270 |
FcOpEqual, |
| 271 |
FcOpNotEqual, |
| 272 |
FcOpContains, |
| 273 |
FcOpListing, |
| 274 |
FcOpNotContains, |
| 275 |
FcOpLess, |
| 276 |
FcOpLessEqual, |
| 277 |
FcOpMore, |
| 278 |
FcOpMoreEqual, |
| 279 |
FcOpPlus, |
| 280 |
FcOpMinus, |
| 281 |
FcOpTimes, |
| 282 |
FcOpDivide, |
| 283 |
FcOpNot, |
| 284 |
FcOpComma, |
| 285 |
FcOpFloor, |
| 286 |
FcOpCeil, |
| 287 |
FcOpRound, |
| 288 |
FcOpTrunc, |
| 289 |
FcOpInvalid |
| 290 |
} FcOp; |
| 291 |
|
| 292 |
typedef enum _FcOpFlags { |
| 293 |
FcOpFlagIgnoreBlanks = 1U << 0 |
| 294 |
} FcOpFlags; |
| 295 |
|
| 296 |
#define FC_OP_GET_OP(_x_) ((_x_) & 0xffff) |
| 297 |
#define FC_OP_GET_FLAGS(_x_) (((_x_) & 0xffff0000) >> 16) |
| 298 |
#define FC_OP(_x_, _f_) (FC_OP_GET_OP (_x_) | ((_f_) << 16)) |
| 299 |
|
| 300 |
typedef struct _FcExprMatrix { |
| 301 |
struct _FcExpr *xx, *xy, *yx, *yy; |
| 302 |
} FcExprMatrix; |
| 303 |
|
| 304 |
typedef struct _FcExprName { |
| 305 |
FcObject object; |
| 306 |
FcMatchKind kind; |
| 307 |
} FcExprName; |
| 308 |
|
| 309 |
struct _FcRange { |
| 310 |
double begin; |
| 311 |
double end; |
| 312 |
}; |
| 313 |
|
| 314 |
typedef struct _FcExpr { |
| 315 |
FcOp op; |
| 316 |
union { |
| 317 |
int ival; |
| 318 |
double dval; |
| 319 |
const FcChar8 *sval; |
| 320 |
FcExprMatrix *mexpr; |
| 321 |
FcBool bval; |
| 322 |
FcCharSet *cval; |
| 323 |
FcLangSet *lval; |
| 324 |
FcRange *rval; |
| 325 |
|
| 326 |
FcExprName name; |
| 327 |
const FcChar8 *constant; |
| 328 |
struct { |
| 329 |
struct _FcExpr *left, *right; |
| 330 |
} tree; |
| 331 |
} u; |
| 332 |
} FcExpr; |
| 333 |
|
| 334 |
typedef struct _FcExprPage FcExprPage; |
| 335 |
|
| 336 |
struct _FcExprPage { |
| 337 |
FcExprPage *next_page; |
| 338 |
FcExpr *next; |
| 339 |
FcExpr exprs[(1024 - 2 /* two pointers */ - 2 /* malloc overhead */) * sizeof (void *) / sizeof (FcExpr)]; |
| 340 |
FcExpr end[FLEXIBLE_ARRAY_MEMBER]; |
| 341 |
}; |
| 342 |
|
| 343 |
typedef enum _FcQual { |
| 344 |
FcQualAny, |
| 345 |
FcQualAll, |
| 346 |
FcQualFirst, |
| 347 |
FcQualNotFirst |
| 348 |
} FcQual; |
| 349 |
|
| 350 |
#define FcMatchDefault ((FcMatchKind) - 1) |
| 351 |
|
| 352 |
typedef struct _FcTest { |
| 353 |
FcMatchKind kind; |
| 354 |
FcQual qual; |
| 355 |
FcObject object; |
| 356 |
FcOp op; |
| 357 |
FcExpr *expr; |
| 358 |
} FcTest; |
| 359 |
|
| 360 |
typedef struct _FcEdit { |
| 361 |
FcObject object; |
| 362 |
FcOp op; |
| 363 |
FcExpr *expr; |
| 364 |
FcValueBinding binding; |
| 365 |
} FcEdit; |
| 366 |
|
| 367 |
typedef struct _FcPtrList FcPtrList; |
| 368 |
/* need to sync with FcConfigFileInfoIter at fontconfig.h */ |
| 369 |
typedef struct _FcPtrListIter { |
| 370 |
void *dummy1; |
| 371 |
void *dummy2; |
| 372 |
void *dummy3; |
| 373 |
} FcPtrListIter; |
| 374 |
|
| 375 |
typedef enum _FcRuleType { |
| 376 |
FcRuleUnknown, |
| 377 |
FcRuleTest, |
| 378 |
FcRuleEdit |
| 379 |
} FcRuleType; |
| 380 |
|
| 381 |
typedef struct _FcRule { |
| 382 |
struct _FcRule *next; |
| 383 |
FcRuleType type; |
| 384 |
union { |
| 385 |
FcTest *test; |
| 386 |
FcEdit *edit; |
| 387 |
} u; |
| 388 |
} FcRule; |
| 389 |
|
| 390 |
typedef struct _FcRuleSet { |
| 391 |
FcRef ref; |
| 392 |
FcChar8 *name; |
| 393 |
FcChar8 *description; |
| 394 |
FcChar8 *domain; |
| 395 |
FcBool enabled; |
| 396 |
FcPtrList *subst[FcMatchKindEnd]; |
| 397 |
} FcRuleSet; |
| 398 |
|
| 399 |
typedef struct _FcCharLeaf { |
| 400 |
FcChar32 map[256 / 32]; |
| 401 |
} FcCharLeaf; |
| 402 |
|
| 403 |
struct _FcCharSet { |
| 404 |
FcRef ref; /* reference count */ |
| 405 |
int num; /* size of leaves and numbers arrays */ |
| 406 |
intptr_t leaves_offset; |
| 407 |
intptr_t numbers_offset; |
| 408 |
}; |
| 409 |
|
| 410 |
#define FcCharSetLeaves(c) FcOffsetMember (c, leaves_offset, intptr_t) |
| 411 |
#define FcCharSetLeaf(c, i) (FcOffsetToPtr (FcCharSetLeaves (c), \ |
| 412 |
FcCharSetLeaves (c)[i], \ |
| 413 |
FcCharLeaf)) |
| 414 |
#define FcCharSetNumbers(c) FcOffsetMember (c, numbers_offset, FcChar16) |
| 415 |
|
| 416 |
#define FCSS_DEFAULT 0 /* default behavior */ |
| 417 |
#define FCSS_ALLOW_DUPLICATES 1 /* allows for duplicate strings in the set */ |
| 418 |
#define FCSS_GROW_BY_64 2 /* grows buffer by 64 elements instead of 1 */ |
| 419 |
|
| 420 |
#define FcStrSetHasControlBit(s, c) (s->control & c) |
| 421 |
#define FcStrSetHasControlBits(s, c) ((c) == (s->control & (c))) |
| 422 |
|
| 423 |
struct _FcStrSet { |
| 424 |
FcRef ref; /* reference count */ |
| 425 |
int num; |
| 426 |
int size; |
| 427 |
FcChar8 **strs; |
| 428 |
unsigned int control; /* control bits for set behavior */ |
| 429 |
}; |
| 430 |
|
| 431 |
struct _FcStrList { |
| 432 |
FcStrSet *set; |
| 433 |
int n; |
| 434 |
}; |
| 435 |
|
| 436 |
typedef struct _FcStrBuf { |
| 437 |
FcChar8 *buf; |
| 438 |
FcBool allocated; |
| 439 |
FcBool failed; |
| 440 |
int len; |
| 441 |
int size; |
| 442 |
FcChar8 buf_static[16 * sizeof (void *)]; |
| 443 |
} FcStrBuf; |
| 444 |
|
| 445 |
typedef struct _FcHashTable FcHashTable; |
| 446 |
|
| 447 |
typedef FcChar32 (*FcHashFunc) (const FcChar8 *data); |
| 448 |
typedef int (*FcCompareFunc) (const FcChar8 *v1, const FcChar8 *v2); |
| 449 |
typedef FcBool (*FcCopyFunc) (const void *src, void **dest); |
| 450 |
|
| 451 |
struct _FcCache { |
| 452 |
unsigned int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */ |
| 453 |
int version; /* FC_CACHE_VERSION_NUMBER */ |
| 454 |
intptr_t size; /* size of file */ |
| 455 |
intptr_t dir; /* offset to dir name */ |
| 456 |
intptr_t dirs; /* offset to subdirs */ |
| 457 |
int dirs_count; /* number of subdir strings */ |
| 458 |
intptr_t set; /* offset to font set */ |
| 459 |
int checksum; /* checksum of directory state */ |
| 460 |
int64_t checksum_nano; /* checksum of directory state */ |
| 461 |
}; |
| 462 |
|
| 463 |
#undef FcCacheDir |
| 464 |
#undef FcCacheSubdir |
| 465 |
#define FcCacheDir(c) FcOffsetMember (c, dir, FcChar8) |
| 466 |
#define FcCacheDirs(c) FcOffsetMember (c, dirs, intptr_t) |
| 467 |
#define FcCacheSet(c) FcOffsetMember (c, set, FcFontSet) |
| 468 |
#define FcCacheSubdir(c, i) FcOffsetToPtr (FcCacheDirs (c), \ |
| 469 |
FcCacheDirs (c)[i], \ |
| 470 |
FcChar8) |
| 471 |
|
| 472 |
/* |
| 473 |
* Used while constructing a directory cache object |
| 474 |
*/ |
| 475 |
|
| 476 |
typedef union _FcAlign { |
| 477 |
double d; |
| 478 |
int i; |
| 479 |
intptr_t ip; |
| 480 |
FcBool b; |
| 481 |
void *p; |
| 482 |
} FcAlign; |
| 483 |
|
| 484 |
typedef struct _FcSerializeBucket { |
| 485 |
const void *object; /* key */ |
| 486 |
uintptr_t hash; /* hash of key */ |
| 487 |
intptr_t offset; /* value */ |
| 488 |
} FcSerializeBucket; |
| 489 |
|
| 490 |
typedef struct _FcCharSetFreezer FcCharSetFreezer; |
| 491 |
|
| 492 |
typedef struct _FcSerialize { |
| 493 |
intptr_t size; |
| 494 |
FcCharSetFreezer *cs_freezer; |
| 495 |
void *linear; |
| 496 |
FcSerializeBucket *buckets; |
| 497 |
size_t buckets_count; |
| 498 |
size_t buckets_used; |
| 499 |
size_t buckets_used_max; |
| 500 |
} FcSerialize; |
| 501 |
|
| 502 |
/* |
| 503 |
* To map adobe glyph names to unicode values, a precomputed hash |
| 504 |
* table is used |
| 505 |
*/ |
| 506 |
|
| 507 |
typedef struct _FcGlyphName { |
| 508 |
FcChar32 ucs; /* unicode value */ |
| 509 |
FcChar8 name[1]; /* name extends beyond struct */ |
| 510 |
} FcGlyphName; |
| 511 |
|
| 512 |
/* |
| 513 |
* To perform case-insensitive string comparisons, a table |
| 514 |
* is used which holds three different kinds of folding data. |
| 515 |
* |
| 516 |
* The first is a range of upper case values mapping to a range |
| 517 |
* of their lower case equivalents. Within each range, the offset |
| 518 |
* between upper and lower case is constant. |
| 519 |
* |
| 520 |
* The second is a range of upper case values which are interleaved |
| 521 |
* with their lower case equivalents. |
| 522 |
* |
| 523 |
* The third is a set of raw unicode values mapping to a list |
| 524 |
* of unicode values for comparison purposes. This allows conversion |
| 525 |
* of ß to "ss" so that SS, ss and ß all match. A separate array |
| 526 |
* holds the list of unicode values for each entry. |
| 527 |
* |
| 528 |
* These are packed into a single table. Using a binary search, |
| 529 |
* the appropriate entry can be located. |
| 530 |
*/ |
| 531 |
|
| 532 |
#define FC_CASE_FOLD_RANGE 0 |
| 533 |
#define FC_CASE_FOLD_EVEN_ODD 1 |
| 534 |
#define FC_CASE_FOLD_FULL 2 |
| 535 |
|
| 536 |
typedef struct _FcCaseFold { |
| 537 |
FcChar32 upper; |
| 538 |
FcChar16 method : 2; |
| 539 |
FcChar16 count : 14; |
| 540 |
short offset; /* lower - upper for RANGE, table id for FULL */ |
| 541 |
} FcCaseFold; |
| 542 |
|
| 543 |
#define FC_MAX_FILE_LEN 4096 |
| 544 |
|
| 545 |
#define FC_CACHE_MAGIC_MMAP 0xFC02FC04 |
| 546 |
#define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 |
| 547 |
|
| 548 |
struct _FcAtomic { |
| 549 |
FcChar8 *file; /* original file name */ |
| 550 |
FcChar8 *new; /* temp file name -- write data here */ |
| 551 |
FcChar8 *lck; /* lockfile name (used for locking) */ |
| 552 |
FcChar8 *tmp; /* tmpfile name (used for locking) */ |
| 553 |
}; |
| 554 |
|
| 555 |
struct _FcConfig { |
| 556 |
/* |
| 557 |
* File names loaded from the configuration -- saved here as the |
| 558 |
* cache file must be consulted before the directories are scanned, |
| 559 |
* and those directives may occur in any order |
| 560 |
*/ |
| 561 |
FcStrSet *configDirs; /* directories to scan for fonts */ |
| 562 |
/* |
| 563 |
* List of directories containing fonts, |
| 564 |
* built by recursively scanning the set |
| 565 |
* of configured directories |
| 566 |
*/ |
| 567 |
FcStrSet *fontDirs; |
| 568 |
/* |
| 569 |
* List of directories containing cache files. |
| 570 |
*/ |
| 571 |
FcStrSet *cacheDirs; |
| 572 |
/* |
| 573 |
* Names of all of the configuration files used |
| 574 |
* to create this configuration |
| 575 |
*/ |
| 576 |
FcStrSet *configFiles; /* config files loaded */ |
| 577 |
/* |
| 578 |
* Substitution instructions for patterns and fonts; |
| 579 |
* maxObjects is used to allocate appropriate intermediate storage |
| 580 |
* while performing a whole set of substitutions |
| 581 |
* |
| 582 |
* 0.. substitutions for patterns |
| 583 |
* 1.. substitutions for fonts |
| 584 |
* 2.. substitutions for scanned fonts |
| 585 |
*/ |
| 586 |
FcPtrList *subst[FcMatchKindEnd]; |
| 587 |
int maxObjects; /* maximum number of tests in all substs */ |
| 588 |
/* |
| 589 |
* List of patterns used to control font file selection |
| 590 |
*/ |
| 591 |
FcStrSet *acceptGlobs; |
| 592 |
FcStrSet *rejectGlobs; |
| 593 |
FcFontSet *acceptPatterns; |
| 594 |
FcFontSet *rejectPatterns; |
| 595 |
/* |
| 596 |
* The set of fonts loaded from the listed directories; the |
| 597 |
* order within the set does not determine the font selection, |
| 598 |
* except in the case of identical matches in which case earlier fonts |
| 599 |
* match preferrentially |
| 600 |
*/ |
| 601 |
FcFontSet *fonts[FcSetApplication + 1]; |
| 602 |
/* |
| 603 |
* Fontconfig can periodically rescan the system configuration |
| 604 |
* and font directories. This rescanning occurs when font |
| 605 |
* listing requests are made, but no more often than rescanInterval |
| 606 |
* seconds apart. |
| 607 |
*/ |
| 608 |
time_t rescanTime; /* last time information was scanned */ |
| 609 |
int rescanInterval; /* interval between scans */ |
| 610 |
|
| 611 |
FcRef ref; /* reference count */ |
| 612 |
|
| 613 |
FcExprPage *expr_pool; /* pool of FcExpr's */ |
| 614 |
|
| 615 |
FcChar8 *sysRoot; /* override the system root directory */ |
| 616 |
FcStrSet *availConfigFiles; /* config files available */ |
| 617 |
FcPtrList *rulesetList; /* List of rulesets being installed */ |
| 618 |
|
| 619 |
FcFilterFontSetFunc filter_func; /* A predicate function to filter out config->fonts */ |
| 620 |
FcDestroyFunc destroy_data_func; /* A callback function to destroy config->filter_data */ |
| 621 |
void *filter_data; /* An user data to be used for filter_func */ |
| 622 |
|
| 623 |
FcBool prefer_app_fonts; /* Whether FcSetApplication has a priority than |
| 624 |
FcSetSystem for lookup */ |
| 625 |
|
| 626 |
FcChar8 *default_lang; /* Primary language in default_langs */ |
| 627 |
FcStrSet *default_langs; /* String sets of the default languages */ |
| 628 |
FcChar8 *prgname; /* Program name of current process */ |
| 629 |
FcChar8 *desktop_name; /* Current desktop name */ |
| 630 |
}; |
| 631 |
|
| 632 |
typedef struct _FcFileTime { |
| 633 |
time_t time; |
| 634 |
FcBool set; |
| 635 |
} FcFileTime; |
| 636 |
|
| 637 |
typedef struct _FcCharMap FcCharMap; |
| 638 |
|
| 639 |
typedef struct _FcStatFS FcStatFS; |
| 640 |
|
| 641 |
struct _FcStatFS { |
| 642 |
FcBool is_remote_fs; |
| 643 |
FcBool is_mtime_broken; |
| 644 |
}; |
| 645 |
|
| 646 |
typedef struct _FcValuePromotionBuffer FcValuePromotionBuffer; |
| 647 |
|
| 648 |
struct _FcValuePromotionBuffer { |
| 649 |
union { |
| 650 |
double d; |
| 651 |
int i; |
| 652 |
long l; |
| 653 |
char c[256]; /* Enlarge as needed */ |
| 654 |
} u; |
| 655 |
}; |
| 656 |
|
| 657 |
/* fccache.c */ |
| 658 |
|
| 659 |
FcPrivate FcCache * |
| 660 |
FcDirCacheScan (const FcChar8 *dir, FcConfig *config); |
| 661 |
|
| 662 |
FcPrivate FcCache * |
| 663 |
FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcStrSet *dirs); |
| 664 |
|
| 665 |
FcPrivate FcCache * |
| 666 |
FcDirCacheRebuild (FcCache *cache, struct stat *dir_stat, FcStrSet *dirs); |
| 667 |
|
| 668 |
FcPrivate FcBool |
| 669 |
FcDirCacheWrite (FcCache *cache, FcConfig *config); |
| 670 |
|
| 671 |
FcPrivate FcBool |
| 672 |
FcDirCacheCreateTagFile (const FcChar8 *cache_dir); |
| 673 |
|
| 674 |
FcPrivate void |
| 675 |
FcCacheObjectReference (void *object); |
| 676 |
|
| 677 |
FcPrivate void |
| 678 |
FcCacheObjectDereference (void *object); |
| 679 |
|
| 680 |
FcPrivate void * |
| 681 |
FcCacheAllocate (FcCache *cache, size_t len); |
| 682 |
|
| 683 |
FcPrivate void |
| 684 |
FcCacheFini (void); |
| 685 |
|
| 686 |
FcPrivate void |
| 687 |
FcDirCacheReference (FcCache *cache, int nref); |
| 688 |
|
| 689 |
FcPrivate int |
| 690 |
FcDirCacheLock (const FcChar8 *dir, |
| 691 |
FcConfig *config); |
| 692 |
|
| 693 |
FcPrivate void |
| 694 |
FcDirCacheUnlock (int fd); |
| 695 |
|
| 696 |
/* fccfg.c */ |
| 697 |
|
| 698 |
FcPrivate FcBool |
| 699 |
FcConfigInit (void); |
| 700 |
|
| 701 |
FcPrivate void |
| 702 |
FcConfigFini (void); |
| 703 |
|
| 704 |
FcPrivate FcChar8 * |
| 705 |
FcConfigXdgCacheHome (void); |
| 706 |
|
| 707 |
FcPrivate FcChar8 * |
| 708 |
FcConfigXdgConfigHome (void); |
| 709 |
|
| 710 |
FcPrivate FcChar8 * |
| 711 |
FcConfigXdgDataHome (void); |
| 712 |
|
| 713 |
FcPrivate FcStrSet * |
| 714 |
FcConfigXdgDataDirs (void); |
| 715 |
|
| 716 |
FcPrivate FcExpr * |
| 717 |
FcConfigAllocExpr (FcConfig *config); |
| 718 |
|
| 719 |
FcPrivate FcBool |
| 720 |
FcConfigAddConfigDir (FcConfig *config, |
| 721 |
const FcChar8 *d); |
| 722 |
|
| 723 |
FcPrivate FcBool |
| 724 |
FcConfigAddFontDir (FcConfig *config, |
| 725 |
const FcChar8 *d, |
| 726 |
const FcChar8 *m, |
| 727 |
const FcChar8 *salt); |
| 728 |
|
| 729 |
FcPrivate FcBool |
| 730 |
FcConfigResetFontDirs (FcConfig *config); |
| 731 |
|
| 732 |
FcPrivate FcChar8 * |
| 733 |
FcConfigMapFontPath (FcConfig *config, |
| 734 |
const FcChar8 *path); |
| 735 |
|
| 736 |
FcPrivate const FcChar8 * |
| 737 |
FcConfigMapSalt (FcConfig *config, |
| 738 |
const FcChar8 *path); |
| 739 |
|
| 740 |
FcPrivate FcBool |
| 741 |
FcConfigAddCacheDir (FcConfig *config, |
| 742 |
const FcChar8 *d); |
| 743 |
|
| 744 |
FcPrivate FcBool |
| 745 |
FcConfigAddConfigFile (FcConfig *config, |
| 746 |
const FcChar8 *f); |
| 747 |
|
| 748 |
FcPrivate FcBool |
| 749 |
FcConfigAddBlank (FcConfig *config, |
| 750 |
FcChar32 blank); |
| 751 |
|
| 752 |
FcBool |
| 753 |
FcConfigAddRule (FcConfig *config, |
| 754 |
FcRule *rule, |
| 755 |
FcMatchKind kind); |
| 756 |
|
| 757 |
FcPrivate void |
| 758 |
FcConfigSetFonts (FcConfig *config, |
| 759 |
FcFontSet *fonts, |
| 760 |
FcSetName set); |
| 761 |
|
| 762 |
FcPrivate FcBool |
| 763 |
FcConfigCompareValue (const FcValue *m, |
| 764 |
unsigned int op_, |
| 765 |
const FcValue *v); |
| 766 |
|
| 767 |
FcPrivate FcBool |
| 768 |
FcConfigGlobAdd (FcConfig *config, |
| 769 |
const FcChar8 *glob, |
| 770 |
FcBool accept); |
| 771 |
|
| 772 |
FcPrivate FcBool |
| 773 |
FcConfigAcceptFilename (FcConfig *config, |
| 774 |
const FcChar8 *filename); |
| 775 |
|
| 776 |
FcPrivate FcBool |
| 777 |
FcConfigPatternsAdd (FcConfig *config, |
| 778 |
FcPattern *pattern, |
| 779 |
FcBool accept); |
| 780 |
|
| 781 |
FcPrivate FcFileTime |
| 782 |
FcConfigModifiedTime (FcConfig *config); |
| 783 |
|
| 784 |
FcPrivate FcBool |
| 785 |
FcConfigAddCache (FcConfig *config, FcCache *cache, |
| 786 |
FcSetName set, FcStrSet *dirSet, FcChar8 *forDir); |
| 787 |
|
| 788 |
FcPrivate FcRuleSet * |
| 789 |
FcRuleSetCreate (const FcChar8 *name); |
| 790 |
|
| 791 |
FcPrivate void |
| 792 |
FcRuleSetDestroy (FcRuleSet *rs); |
| 793 |
|
| 794 |
FcPrivate void |
| 795 |
FcRuleSetReference (FcRuleSet *rs); |
| 796 |
|
| 797 |
FcPrivate void |
| 798 |
FcRuleSetEnable (FcRuleSet *rs, |
| 799 |
FcBool flag); |
| 800 |
|
| 801 |
FcPrivate void |
| 802 |
FcRuleSetAddDescription (FcRuleSet *rs, |
| 803 |
const FcChar8 *domain, |
| 804 |
const FcChar8 *description); |
| 805 |
|
| 806 |
FcPrivate int |
| 807 |
FcRuleSetAdd (FcRuleSet *rs, |
| 808 |
FcRule *rule, |
| 809 |
FcMatchKind kind); |
| 810 |
|
| 811 |
/* fcserialize.c */ |
| 812 |
FcPrivate intptr_t |
| 813 |
FcAlignSize (intptr_t size); |
| 814 |
|
| 815 |
FcPrivate FcSerialize * |
| 816 |
FcSerializeCreate (void); |
| 817 |
|
| 818 |
FcPrivate void |
| 819 |
FcSerializeDestroy (FcSerialize *serialize); |
| 820 |
|
| 821 |
FcPrivate FcBool |
| 822 |
FcSerializeAlloc (FcSerialize *serialize, const void *object, int size); |
| 823 |
|
| 824 |
FcPrivate intptr_t |
| 825 |
FcSerializeReserve (FcSerialize *serialize, int size); |
| 826 |
|
| 827 |
FcPrivate intptr_t |
| 828 |
FcSerializeOffset (FcSerialize *serialize, const void *object); |
| 829 |
|
| 830 |
FcPrivate void * |
| 831 |
FcSerializePtr (FcSerialize *serialize, const void *object); |
| 832 |
|
| 833 |
FcPrivate FcBool |
| 834 |
FcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l); |
| 835 |
|
| 836 |
FcPrivate FcLangSet * |
| 837 |
FcLangSetSerialize (FcSerialize *serialize, const FcLangSet *l); |
| 838 |
|
| 839 |
/* fccharset.c */ |
| 840 |
FcPrivate FcCharSet * |
| 841 |
FcCharSetPromote (FcValuePromotionBuffer *vbuf); |
| 842 |
|
| 843 |
FcPrivate void |
| 844 |
FcLangCharSetPopulate (void); |
| 845 |
|
| 846 |
FcPrivate FcBool |
| 847 |
FcLangIsExclusive (const FcChar8 *lang); |
| 848 |
|
| 849 |
FcPrivate const FcChar8 * |
| 850 |
FcLangIsExclusiveFromOs2 (unsigned long os2ulUnicodeRange1, unsigned long os2ulUnicodeRange2); |
| 851 |
|
| 852 |
FcPrivate FcCharSetFreezer * |
| 853 |
FcCharSetFreezerCreate (void); |
| 854 |
|
| 855 |
FcPrivate const FcCharSet * |
| 856 |
FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs); |
| 857 |
|
| 858 |
FcPrivate void |
| 859 |
FcCharSetFreezerDestroy (FcCharSetFreezer *freezer); |
| 860 |
|
| 861 |
FcPrivate FcBool |
| 862 |
FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c); |
| 863 |
|
| 864 |
FcPrivate FcCharSet * |
| 865 |
FcNameParseCharSet (FcChar8 *string); |
| 866 |
|
| 867 |
FcPrivate FcBool |
| 868 |
FcNameUnparseValue (FcStrBuf *buf, |
| 869 |
FcValue *v0, |
| 870 |
FcChar8 *escape); |
| 871 |
|
| 872 |
FcPrivate FcBool |
| 873 |
FcNameUnparseValueList (FcStrBuf *buf, |
| 874 |
FcValueListPtr v, |
| 875 |
FcChar8 *escape); |
| 876 |
|
| 877 |
FcPrivate FcCharLeaf * |
| 878 |
FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4); |
| 879 |
|
| 880 |
FcPrivate FcBool |
| 881 |
FcCharSetSerializeAlloc (FcSerialize *serialize, const FcCharSet *cs); |
| 882 |
|
| 883 |
FcPrivate FcCharSet * |
| 884 |
FcCharSetSerialize (FcSerialize *serialize, const FcCharSet *cs); |
| 885 |
|
| 886 |
FcPrivate FcChar16 * |
| 887 |
FcCharSetGetNumbers (const FcCharSet *c); |
| 888 |
|
| 889 |
/* fccompat.c */ |
| 890 |
FcPrivate int |
| 891 |
FcOpen (const char *pathname, int flags, ...); |
| 892 |
|
| 893 |
FcPrivate int |
| 894 |
FcMakeTempfile (char *template); |
| 895 |
|
| 896 |
FcPrivate int32_t |
| 897 |
FcRandom (void); |
| 898 |
|
| 899 |
FcPrivate FcBool |
| 900 |
FcMakeDirectory (const FcChar8 *dir); |
| 901 |
|
| 902 |
FcPrivate ssize_t |
| 903 |
FcReadLink (const FcChar8 *pathname, |
| 904 |
FcChar8 *buf, |
| 905 |
size_t bufsiz); |
| 906 |
|
| 907 |
/* fcdbg.c */ |
| 908 |
|
| 909 |
FcPrivate void |
| 910 |
FcValuePrintFile (FILE *f, const FcValue v); |
| 911 |
|
| 912 |
FcPrivate void |
| 913 |
FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark); |
| 914 |
|
| 915 |
FcPrivate void |
| 916 |
FcValueListPrintWithPosition (FcValueListPtr l, const FcValueListPtr pos); |
| 917 |
|
| 918 |
FcPrivate void |
| 919 |
FcValueListPrint (FcValueListPtr l); |
| 920 |
|
| 921 |
FcPrivate void |
| 922 |
FcLangSetPrint (const FcLangSet *ls); |
| 923 |
|
| 924 |
FcPrivate void |
| 925 |
FcOpPrint (FcOp op); |
| 926 |
|
| 927 |
FcPrivate void |
| 928 |
FcTestPrint (const FcTest *test); |
| 929 |
|
| 930 |
FcPrivate void |
| 931 |
FcExprPrint (const FcExpr *expr); |
| 932 |
|
| 933 |
FcPrivate void |
| 934 |
FcEditPrint (const FcEdit *edit); |
| 935 |
|
| 936 |
FcPrivate void |
| 937 |
FcRulePrint (const FcRule *rule); |
| 938 |
|
| 939 |
FcPrivate void |
| 940 |
FcCharSetPrint (const FcCharSet *c); |
| 941 |
|
| 942 |
FcPrivate void |
| 943 |
FcPatternPrint2 (FcPattern *p1, FcPattern *p2, const FcObjectSet *os); |
| 944 |
|
| 945 |
extern FcPrivate int FcDebugVal; |
| 946 |
|
| 947 |
#define FcDebug() (FcDebugVal) |
| 948 |
|
| 949 |
FcPrivate void |
| 950 |
FcInitDebug (void); |
| 951 |
|
| 952 |
/* fcdefault.c */ |
| 953 |
FcPrivate FcChar8 * |
| 954 |
FcConfigGetDefaultLang (FcConfig *config); |
| 955 |
|
| 956 |
FcPrivate FcChar8 * |
| 957 |
FcGetDefaultLang (void); |
| 958 |
|
| 959 |
FcPrivate FcChar8 * |
| 960 |
FcConfigGetPrgname (FcConfig *config); |
| 961 |
|
| 962 |
FcPrivate FcChar8 * |
| 963 |
FcGetPrgname (void); |
| 964 |
|
| 965 |
FcPrivate FcChar8 * |
| 966 |
FcConfigGetDesktopName (FcConfig *config); |
| 967 |
|
| 968 |
FcPrivate FcChar8 * |
| 969 |
FcGetDesktopName (void); |
| 970 |
|
| 971 |
/* fcdir.c */ |
| 972 |
|
| 973 |
FcPrivate FcBool |
| 974 |
FcFileIsLink (const FcChar8 *file); |
| 975 |
|
| 976 |
FcPrivate FcBool |
| 977 |
FcFileIsFile (const FcChar8 *file); |
| 978 |
|
| 979 |
FcPrivate FcBool |
| 980 |
FcFileScanConfig (FcFontSet *set, |
| 981 |
FcStrSet *dirs, |
| 982 |
const FcChar8 *file, |
| 983 |
FcConfig *config); |
| 984 |
|
| 985 |
FcPrivate FcBool |
| 986 |
FcDirScanConfig (FcFontSet *set, |
| 987 |
FcStrSet *dirs, |
| 988 |
const FcChar8 *dir, |
| 989 |
FcBool force, |
| 990 |
FcConfig *config); |
| 991 |
|
| 992 |
/* fcfont.c */ |
| 993 |
FcPrivate int |
| 994 |
FcFontDebug (void); |
| 995 |
|
| 996 |
/* fcfs.c */ |
| 997 |
|
| 998 |
FcPrivate FcBool |
| 999 |
FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s); |
| 1000 |
|
| 1001 |
FcPrivate FcFontSet * |
| 1002 |
FcFontSetSerialize (FcSerialize *serialize, const FcFontSet *s); |
| 1003 |
|
| 1004 |
FcPrivate FcFontSet * |
| 1005 |
FcFontSetDeserialize (const FcFontSet *set); |
| 1006 |
|
| 1007 |
/* fcplist.c */ |
| 1008 |
FcPrivate FcPtrList * |
| 1009 |
FcPtrListCreate (FcDestroyFunc func); |
| 1010 |
|
| 1011 |
FcPrivate void |
| 1012 |
FcPtrListDestroy (FcPtrList *list); |
| 1013 |
|
| 1014 |
FcPrivate void |
| 1015 |
FcPtrListIterInit (const FcPtrList *list, |
| 1016 |
FcPtrListIter *iter); |
| 1017 |
|
| 1018 |
FcPrivate void |
| 1019 |
FcPtrListIterInitAtLast (FcPtrList *list, |
| 1020 |
FcPtrListIter *iter); |
| 1021 |
|
| 1022 |
FcPrivate FcBool |
| 1023 |
FcPtrListIterNext (const FcPtrList *list, |
| 1024 |
FcPtrListIter *iter); |
| 1025 |
|
| 1026 |
FcPrivate FcBool |
| 1027 |
FcPtrListIterIsValid (const FcPtrList *list, |
| 1028 |
const FcPtrListIter *iter); |
| 1029 |
|
| 1030 |
FcPrivate void * |
| 1031 |
FcPtrListIterGetValue (const FcPtrList *list, |
| 1032 |
const FcPtrListIter *iter); |
| 1033 |
|
| 1034 |
FcPrivate FcBool |
| 1035 |
FcPtrListIterAdd (FcPtrList *list, |
| 1036 |
FcPtrListIter *iter, |
| 1037 |
void *data); |
| 1038 |
|
| 1039 |
FcPrivate FcBool |
| 1040 |
FcPtrListIterRemove (FcPtrList *list, |
| 1041 |
FcPtrListIter *iter); |
| 1042 |
|
| 1043 |
/* fcinit.c */ |
| 1044 |
FcPrivate FcConfig * |
| 1045 |
FcInitLoadOwnConfig (FcConfig *config); |
| 1046 |
|
| 1047 |
FcPrivate FcConfig * |
| 1048 |
FcInitLoadOwnConfigAndFonts (FcConfig *config); |
| 1049 |
|
| 1050 |
/* fcxml.c */ |
| 1051 |
FcPrivate void |
| 1052 |
FcConfigPathFini (void); |
| 1053 |
|
| 1054 |
FcPrivate void |
| 1055 |
FcTestDestroy (FcTest *test); |
| 1056 |
|
| 1057 |
FcPrivate void |
| 1058 |
FcEditDestroy (FcEdit *e); |
| 1059 |
|
| 1060 |
void |
| 1061 |
FcRuleDestroy (FcRule *rule); |
| 1062 |
|
| 1063 |
/* fclang.c */ |
| 1064 |
typedef struct { |
| 1065 |
const FcChar8 lang[16]; |
| 1066 |
const FcCharSet charset; |
| 1067 |
} FcLangCharSet; |
| 1068 |
|
| 1069 |
typedef struct { |
| 1070 |
int begin; |
| 1071 |
int end; |
| 1072 |
} FcLangCharSetRange; |
| 1073 |
|
| 1074 |
#include "fclang.h" |
| 1075 |
|
| 1076 |
struct _FcLangSet { |
| 1077 |
FcStrSet *extra; |
| 1078 |
FcChar32 map_size; |
| 1079 |
FcChar32 map[NUM_LANG_SET_MAP]; |
| 1080 |
}; |
| 1081 |
|
| 1082 |
FcPrivate FcLangSet * |
| 1083 |
FcLangSetFromCharSet (const FcCharSet *charset, |
| 1084 |
const FcChar8 *exclusiveLang); |
| 1085 |
|
| 1086 |
FcPrivate FcLangResult |
| 1087 |
FcLangCompare (const FcChar8 *s1, const FcChar8 *s2); |
| 1088 |
|
| 1089 |
FcPrivate FcLangSet * |
| 1090 |
FcLangSetPromote (const FcChar8 *lang, FcValuePromotionBuffer *buf); |
| 1091 |
|
| 1092 |
FcPrivate FcLangSet * |
| 1093 |
FcNameParseLangSet (const FcChar8 *string); |
| 1094 |
|
| 1095 |
FcPrivate FcBool |
| 1096 |
FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls); |
| 1097 |
|
| 1098 |
FcPrivate FcChar8 * |
| 1099 |
FcNameUnparseEscaped (FcPattern *pat, FcBool escape); |
| 1100 |
|
| 1101 |
FcPrivate FcBool |
| 1102 |
FcConfigParseOnly (FcConfig *config, |
| 1103 |
const FcChar8 *name, |
| 1104 |
FcBool complain); |
| 1105 |
|
| 1106 |
FcPrivate FcChar8 * |
| 1107 |
FcConfigRealFilename (FcConfig *config, |
| 1108 |
const FcChar8 *url); |
| 1109 |
|
| 1110 |
/* fclist.c */ |
| 1111 |
|
| 1112 |
FcPrivate FcBool |
| 1113 |
FcListPatternMatchAny (const FcPattern *p, |
| 1114 |
const FcPattern *font); |
| 1115 |
|
| 1116 |
/* fcmatch.c */ |
| 1117 |
|
| 1118 |
/* fcname.c */ |
| 1119 |
|
| 1120 |
enum { |
| 1121 |
FC_INVALID_OBJECT = 0, |
| 1122 |
#define FC_OBJECT(NAME, Type, Cmp) FC_##NAME##_OBJECT, |
| 1123 |
#include "fcobjs.h" |
| 1124 |
#undef FC_OBJECT |
| 1125 |
FC_ONE_AFTER_MAX_BASE_OBJECT |
| 1126 |
#define FC_MAX_BASE_OBJECT (FC_ONE_AFTER_MAX_BASE_OBJECT - 1) |
| 1127 |
}; |
| 1128 |
|
| 1129 |
FcPrivate FcBool |
| 1130 |
FcNameConstantWithObjectCheck (const FcChar8 *string, const char *object, int *result); |
| 1131 |
|
| 1132 |
FcPrivate FcBool |
| 1133 |
FcNameBool (const FcChar8 *v, FcBool *result); |
| 1134 |
|
| 1135 |
FcPrivate FcBool |
| 1136 |
FcObjectValidType (FcObject object, FcType type); |
| 1137 |
|
| 1138 |
FcPrivate FcObject |
| 1139 |
FcObjectFromName (const char *name); |
| 1140 |
|
| 1141 |
FcPrivate const char * |
| 1142 |
FcObjectName (FcObject object); |
| 1143 |
|
| 1144 |
FcPrivate FcObjectSet * |
| 1145 |
FcObjectGetSet (void); |
| 1146 |
|
| 1147 |
#define FcObjectCompare(a, b) ((int)a - (int)b) |
| 1148 |
|
| 1149 |
/* fcpat.c */ |
| 1150 |
|
| 1151 |
FcPrivate FcValue |
| 1152 |
FcValueCanonicalize (const FcValue *v); |
| 1153 |
|
| 1154 |
FcPrivate FcValueListPtr |
| 1155 |
FcValueListCreate (void); |
| 1156 |
|
| 1157 |
FcPrivate void |
| 1158 |
FcValueListDestroy (FcValueListPtr l); |
| 1159 |
|
| 1160 |
FcPrivate FcValueListPtr |
| 1161 |
FcValueListPrepend (FcValueListPtr vallist, |
| 1162 |
FcValue value, |
| 1163 |
FcValueBinding binding); |
| 1164 |
|
| 1165 |
FcPrivate FcValueListPtr |
| 1166 |
FcValueListAppend (FcValueListPtr vallist, |
| 1167 |
FcValue value, |
| 1168 |
FcValueBinding binding); |
| 1169 |
|
| 1170 |
FcPrivate FcValueListPtr |
| 1171 |
FcValueListDuplicate (FcValueListPtr orig); |
| 1172 |
|
| 1173 |
FcPrivate FcPatternElt * |
| 1174 |
FcPatternObjectFindElt (const FcPattern *p, FcObject object); |
| 1175 |
|
| 1176 |
FcPrivate FcPatternElt * |
| 1177 |
FcPatternObjectInsertElt (FcPattern *p, FcObject object); |
| 1178 |
|
| 1179 |
FcPrivate FcBool |
| 1180 |
FcPatternObjectListAdd (FcPattern *p, |
| 1181 |
FcObject object, |
| 1182 |
FcValueListPtr list, |
| 1183 |
FcBool append); |
| 1184 |
|
| 1185 |
FcPrivate FcBool |
| 1186 |
FcPatternObjectAddWithBinding (FcPattern *p, |
| 1187 |
FcObject object, |
| 1188 |
FcValue value, |
| 1189 |
FcValueBinding binding, |
| 1190 |
FcBool append); |
| 1191 |
|
| 1192 |
FcPrivate FcBool |
| 1193 |
FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append); |
| 1194 |
|
| 1195 |
FcPrivate FcBool |
| 1196 |
FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append); |
| 1197 |
|
| 1198 |
FcPrivate FcResult |
| 1199 |
FcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b); |
| 1200 |
|
| 1201 |
FcPrivate FcResult |
| 1202 |
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v); |
| 1203 |
|
| 1204 |
FcPrivate FcBool |
| 1205 |
FcPatternObjectDel (FcPattern *p, FcObject object); |
| 1206 |
|
| 1207 |
FcPrivate FcBool |
| 1208 |
FcPatternObjectRemove (FcPattern *p, FcObject object, int id); |
| 1209 |
|
| 1210 |
FcPrivate FcBool |
| 1211 |
FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i); |
| 1212 |
|
| 1213 |
FcPrivate FcBool |
| 1214 |
FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d); |
| 1215 |
|
| 1216 |
FcPrivate FcBool |
| 1217 |
FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s); |
| 1218 |
|
| 1219 |
FcPrivate FcBool |
| 1220 |
FcPatternObjectAddMatrix (FcPattern *p, FcObject object, const FcMatrix *s); |
| 1221 |
|
| 1222 |
FcPrivate FcBool |
| 1223 |
FcPatternObjectAddCharSet (FcPattern *p, FcObject object, const FcCharSet *c); |
| 1224 |
|
| 1225 |
FcPrivate FcBool |
| 1226 |
FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b); |
| 1227 |
|
| 1228 |
FcPrivate FcBool |
| 1229 |
FcPatternObjectAddLangSet (FcPattern *p, FcObject object, const FcLangSet *ls); |
| 1230 |
|
| 1231 |
FcPrivate FcBool |
| 1232 |
FcPatternObjectAddRange (FcPattern *p, FcObject object, const FcRange *r); |
| 1233 |
|
| 1234 |
FcPrivate FcResult |
| 1235 |
FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int n, int *i); |
| 1236 |
|
| 1237 |
FcPrivate FcResult |
| 1238 |
FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int n, double *d); |
| 1239 |
|
| 1240 |
FcPrivate FcResult |
| 1241 |
FcPatternObjectGetString (const FcPattern *p, FcObject object, int n, FcChar8 **s); |
| 1242 |
|
| 1243 |
FcPrivate FcResult |
| 1244 |
FcPatternObjectGetMatrix (const FcPattern *p, FcObject object, int n, FcMatrix **s); |
| 1245 |
|
| 1246 |
FcPrivate FcResult |
| 1247 |
FcPatternObjectGetCharSet (const FcPattern *p, FcObject object, int n, FcCharSet **c); |
| 1248 |
|
| 1249 |
FcPrivate FcResult |
| 1250 |
FcPatternObjectGetBool (const FcPattern *p, FcObject object, int n, FcBool *b); |
| 1251 |
|
| 1252 |
FcPrivate FcResult |
| 1253 |
FcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet **ls); |
| 1254 |
|
| 1255 |
FcPrivate FcResult |
| 1256 |
FcPatternObjectGetRange (const FcPattern *p, FcObject object, int id, FcRange **r); |
| 1257 |
|
| 1258 |
FcPrivate FcBool |
| 1259 |
FcPatternAppend (FcPattern *p, FcPattern *s); |
| 1260 |
|
| 1261 |
FcPrivate int |
| 1262 |
FcPatternPosition (const FcPattern *p, const char *object); |
| 1263 |
|
| 1264 |
FcPrivate FcBool |
| 1265 |
FcPatternFindObjectIter (const FcPattern *pat, FcPatternIter *iter, FcObject object); |
| 1266 |
|
| 1267 |
FcPrivate FcObject |
| 1268 |
FcPatternIterGetObjectId (const FcPattern *pat, FcPatternIter *iter); |
| 1269 |
|
| 1270 |
FcPrivate FcValueListPtr |
| 1271 |
FcPatternIterGetValues (const FcPattern *pat, FcPatternIter *iter); |
| 1272 |
|
| 1273 |
FcPrivate FcPattern * |
| 1274 |
FcPatternCacheRewriteFile (const FcPattern *pat, FcCache *cache, const FcChar8 *relocated_font_file); |
| 1275 |
|
| 1276 |
FcPrivate FcChar32 |
| 1277 |
FcStringHash (const FcChar8 *s); |
| 1278 |
|
| 1279 |
FcPrivate FcBool |
| 1280 |
FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat); |
| 1281 |
|
| 1282 |
FcPrivate FcPattern * |
| 1283 |
FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat); |
| 1284 |
|
| 1285 |
FcPrivate FcBool |
| 1286 |
FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *pat); |
| 1287 |
|
| 1288 |
FcPrivate FcValueList * |
| 1289 |
FcValueListSerialize (FcSerialize *serialize, const FcValueList *pat); |
| 1290 |
|
| 1291 |
/* fcrender.c */ |
| 1292 |
|
| 1293 |
/* fcmatrix.c */ |
| 1294 |
|
| 1295 |
extern FcPrivate const FcMatrix FcIdentityMatrix; |
| 1296 |
|
| 1297 |
FcPrivate void |
| 1298 |
FcMatrixFree (FcMatrix *mat); |
| 1299 |
|
| 1300 |
/* fcrange.c */ |
| 1301 |
|
| 1302 |
FcPrivate FcRange * |
| 1303 |
FcRangePromote (double v, FcValuePromotionBuffer *vbuf); |
| 1304 |
|
| 1305 |
FcPrivate FcBool |
| 1306 |
FcRangeIsInRange (const FcRange *a, const FcRange *b); |
| 1307 |
|
| 1308 |
FcPrivate FcBool |
| 1309 |
FcRangeCompare (FcOp op, const FcRange *a, const FcRange *b); |
| 1310 |
|
| 1311 |
FcPrivate FcChar32 |
| 1312 |
FcRangeHash (const FcRange *r); |
| 1313 |
|
| 1314 |
FcPrivate FcBool |
| 1315 |
FcRangeSerializeAlloc (FcSerialize *serialize, const FcRange *r); |
| 1316 |
|
| 1317 |
FcPrivate FcRange * |
| 1318 |
FcRangeSerialize (FcSerialize *serialize, const FcRange *r); |
| 1319 |
|
| 1320 |
/* fcstat.c */ |
| 1321 |
|
| 1322 |
FcPrivate int |
| 1323 |
FcStat (const FcChar8 *file, struct stat *statb); |
| 1324 |
|
| 1325 |
FcPrivate int |
| 1326 |
FcStatChecksum (const FcChar8 *file, struct stat *statb); |
| 1327 |
|
| 1328 |
FcPrivate FcBool |
| 1329 |
FcIsFsMmapSafe (int fd); |
| 1330 |
|
| 1331 |
FcPrivate FcBool |
| 1332 |
FcIsFsMtimeBroken (const FcChar8 *dir); |
| 1333 |
|
| 1334 |
/* fcstr.c */ |
| 1335 |
FcPrivate FcStrSet * |
| 1336 |
FcStrSetCreateEx (unsigned int control); |
| 1337 |
|
| 1338 |
FcPrivate FcBool |
| 1339 |
FcStrSetInsert (FcStrSet *set, const FcChar8 *s, int pos); |
| 1340 |
|
| 1341 |
FcPrivate FcBool |
| 1342 |
FcStrSetAddLangs (FcStrSet *strs, const char *languages); |
| 1343 |
|
| 1344 |
FcPrivate void |
| 1345 |
FcStrSetSort (FcStrSet *set); |
| 1346 |
|
| 1347 |
FcPrivate FcBool |
| 1348 |
FcStrSetMemberAB (FcStrSet *set, const FcChar8 *a, FcChar8 *b, FcChar8 **ret); |
| 1349 |
|
| 1350 |
FcPrivate FcBool |
| 1351 |
FcStrSetAddTriple (FcStrSet *set, const FcChar8 *a, const FcChar8 *b, const FcChar8 *c); |
| 1352 |
|
| 1353 |
FcPrivate const FcChar8 * |
| 1354 |
FcStrTripleSecond (FcChar8 *s); |
| 1355 |
|
| 1356 |
FcPrivate const FcChar8 * |
| 1357 |
FcStrTripleThird (FcChar8 *str); |
| 1358 |
|
| 1359 |
FcPrivate FcBool |
| 1360 |
FcStrSetAddFilenamePairWithSalt (FcStrSet *strs, const FcChar8 *d, const FcChar8 *m, const FcChar8 *salt); |
| 1361 |
|
| 1362 |
FcPrivate FcBool |
| 1363 |
FcStrSetDeleteAll (FcStrSet *set); |
| 1364 |
|
| 1365 |
FcPrivate void |
| 1366 |
FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size); |
| 1367 |
|
| 1368 |
FcPrivate void |
| 1369 |
FcStrBufDestroy (FcStrBuf *buf); |
| 1370 |
|
| 1371 |
FcPrivate FcChar8 * |
| 1372 |
FcStrBufDone (FcStrBuf *buf); |
| 1373 |
|
| 1374 |
FcPrivate FcChar8 * |
| 1375 |
FcStrBufDoneStatic (FcStrBuf *buf); |
| 1376 |
|
| 1377 |
FcPrivate FcBool |
| 1378 |
FcStrBufChar (FcStrBuf *buf, FcChar8 c); |
| 1379 |
|
| 1380 |
FcPrivate FcBool |
| 1381 |
FcStrBufString (FcStrBuf *buf, const FcChar8 *s); |
| 1382 |
|
| 1383 |
FcPrivate FcBool |
| 1384 |
FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len); |
| 1385 |
|
| 1386 |
FcPrivate int |
| 1387 |
FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2); |
| 1388 |
|
| 1389 |
FcPrivate int |
| 1390 |
FcStrCmpIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims); |
| 1391 |
|
| 1392 |
FcPrivate const FcChar8 * |
| 1393 |
FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2); |
| 1394 |
|
| 1395 |
FcPrivate const FcChar8 * |
| 1396 |
FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2); |
| 1397 |
|
| 1398 |
FcPrivate const FcChar8 * |
| 1399 |
FcStrContainsWord (const FcChar8 *s1, const FcChar8 *s2); |
| 1400 |
|
| 1401 |
FcPrivate int |
| 1402 |
FcStrMatchIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims); |
| 1403 |
|
| 1404 |
FcPrivate FcBool |
| 1405 |
FcStrGlobMatch (const FcChar8 *glob, |
| 1406 |
const FcChar8 *string); |
| 1407 |
|
| 1408 |
FcPrivate FcBool |
| 1409 |
FcStrUsesHome (const FcChar8 *s); |
| 1410 |
|
| 1411 |
FcPrivate FcBool |
| 1412 |
FcStrIsAbsoluteFilename (const FcChar8 *s); |
| 1413 |
|
| 1414 |
FcPrivate FcChar8 * |
| 1415 |
FcStrLastSlash (const FcChar8 *path); |
| 1416 |
|
| 1417 |
FcPrivate FcChar32 |
| 1418 |
FcStrHashIgnoreCase (const FcChar8 *s); |
| 1419 |
|
| 1420 |
FcPrivate FcChar32 |
| 1421 |
FcStrHashIgnoreBlanksAndCase (const FcChar8 *s); |
| 1422 |
|
| 1423 |
FcPrivate FcChar8 * |
| 1424 |
FcStrRealPath (const FcChar8 *path); |
| 1425 |
|
| 1426 |
FcPrivate FcChar8 * |
| 1427 |
FcStrCanonFilename (const FcChar8 *s); |
| 1428 |
|
| 1429 |
FcPrivate FcBool |
| 1430 |
FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str); |
| 1431 |
|
| 1432 |
FcPrivate FcChar8 * |
| 1433 |
FcStrSerialize (FcSerialize *serialize, const FcChar8 *str); |
| 1434 |
|
| 1435 |
/* fcobjs.c */ |
| 1436 |
FcPrivate void |
| 1437 |
FcObjectInit (void); |
| 1438 |
|
| 1439 |
FcPrivate void |
| 1440 |
FcObjectFini (void); |
| 1441 |
|
| 1442 |
FcPrivate FcObject |
| 1443 |
FcObjectLookupIdByName (const char *str); |
| 1444 |
|
| 1445 |
FcPrivate FcObject |
| 1446 |
FcObjectLookupBuiltinIdByName (const char *str); |
| 1447 |
|
| 1448 |
FcPrivate const char * |
| 1449 |
FcObjectLookupOtherNameById (FcObject id); |
| 1450 |
|
| 1451 |
FcPrivate const FcObjectType * |
| 1452 |
FcObjectLookupOtherTypeById (FcObject id); |
| 1453 |
|
| 1454 |
FcPrivate const FcObjectType * |
| 1455 |
FcObjectLookupOtherTypeByName (const char *str); |
| 1456 |
|
| 1457 |
/* fchash.c */ |
| 1458 |
FcPrivate FcBool |
| 1459 |
FcHashStrCopy (const void *src, |
| 1460 |
void **dest); |
| 1461 |
|
| 1462 |
FcPrivate FcBool |
| 1463 |
FcHashUuidCopy (const void *src, |
| 1464 |
void **dest); |
| 1465 |
|
| 1466 |
FcPrivate void |
| 1467 |
FcHashUuidFree (void *data); |
| 1468 |
|
| 1469 |
FcPrivate FcHashTable * |
| 1470 |
FcHashTableCreate (FcHashFunc hash_func, |
| 1471 |
FcCompareFunc compare_func, |
| 1472 |
FcCopyFunc key_copy_func, |
| 1473 |
FcCopyFunc value_copy_func, |
| 1474 |
FcDestroyFunc key_destroy_func, |
| 1475 |
FcDestroyFunc value_destroy_func); |
| 1476 |
|
| 1477 |
FcPrivate void |
| 1478 |
FcHashTableDestroy (FcHashTable *table); |
| 1479 |
|
| 1480 |
FcPrivate FcBool |
| 1481 |
FcHashTableFind (FcHashTable *table, |
| 1482 |
const void *key, |
| 1483 |
void **value); |
| 1484 |
|
| 1485 |
FcPrivate FcBool |
| 1486 |
FcHashTableAdd (FcHashTable *table, |
| 1487 |
void *key, |
| 1488 |
void *value); |
| 1489 |
|
| 1490 |
FcPrivate FcBool |
| 1491 |
FcHashTableReplace (FcHashTable *table, |
| 1492 |
void *key, |
| 1493 |
void *value); |
| 1494 |
|
| 1495 |
FcPrivate FcBool |
| 1496 |
FcHashTableRemove (FcHashTable *table, |
| 1497 |
void *key); |
| 1498 |
|
| 1499 |
#endif /* _FC_INT_H_ */ |