2002-02-15 00:34:13 +01:00
|
|
|
/*
|
2008-08-12 22:34:24 +02:00
|
|
|
* fontconfig/src/fcint.h
|
2002-02-15 00:34:13 +01:00
|
|
|
*
|
2004-12-07 02:14:46 +01:00
|
|
|
* Copyright © 2000 Keith Packard
|
2002-02-15 00:34:13 +01:00
|
|
|
*
|
|
|
|
* 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
|
2010-11-10 22:45:42 +01:00
|
|
|
* documentation, and that the name of the author(s) not be used in
|
2002-02-15 00:34:13 +01:00
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
2010-11-10 22:45:42 +01:00
|
|
|
* specific, written prior permission. The authors make no
|
2002-02-15 00:34:13 +01:00
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
*
|
2009-03-12 21:00:08 +01:00
|
|
|
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
2002-02-15 00:34:13 +01:00
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
2009-03-12 21:00:08 +01:00
|
|
|
* EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
2002-02-15 00:34:13 +01:00
|
|
|
* 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_
|
|
|
|
|
2006-04-07 19:06:55 +02:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2012-11-27 10:25:11 +01:00
|
|
|
#include "fcstdint.h"
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
2012-10-07 20:41:38 +02:00
|
|
|
#include <assert.h>
|
2002-02-15 00:34:13 +01:00
|
|
|
#include <errno.h>
|
2013-07-02 12:04:36 +02:00
|
|
|
#include <limits.h>
|
2013-11-20 10:44:59 +01:00
|
|
|
#include <float.h>
|
|
|
|
#include <math.h>
|
2020-07-07 05:48:34 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2002-02-15 00:34:13 +01:00
|
|
|
#include <unistd.h>
|
2020-07-07 05:48:34 +02:00
|
|
|
#endif
|
2008-01-02 17:47:14 +01:00
|
|
|
#include <stddef.h>
|
2002-02-15 00:34:13 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2002-05-21 19:06:22 +02:00
|
|
|
#include <time.h>
|
2002-02-15 00:34:13 +01:00
|
|
|
#include <fontconfig/fontconfig.h>
|
2007-11-14 00:48:30 +01:00
|
|
|
#include <fontconfig/fcprivate.h>
|
2007-11-04 21:20:45 +01:00
|
|
|
#include "fcdeprecate.h"
|
2012-10-07 20:24:28 +02:00
|
|
|
#include "fcmutex.h"
|
|
|
|
#include "fcatomic.h"
|
2002-02-15 00:34:13 +01:00
|
|
|
|
|
|
|
#ifndef FC_CONFIG_PATH
|
|
|
|
#define FC_CONFIG_PATH "fonts.conf"
|
|
|
|
#endif
|
|
|
|
|
2020-08-24 13:59:18 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define FC_LIKELY(expr) (expr)
|
|
|
|
#define FC_UNLIKELY(expr) (expr)
|
|
|
|
#else
|
2020-08-26 00:12:07 +02:00
|
|
|
#define FC_LIKELY(expr) (__builtin_expect (((expr) ? 1 : 0), 1))
|
|
|
|
#define FC_UNLIKELY(expr) (__builtin_expect (((expr) ? 1 : 0), 0))
|
2020-08-24 13:59:18 +02:00
|
|
|
#endif
|
|
|
|
|
2003-03-22 22:25:34 +01:00
|
|
|
#ifdef _WIN32
|
2013-01-03 00:35:56 +01:00
|
|
|
# include "fcwindows.h"
|
2012-04-12 07:01:25 +02:00
|
|
|
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 ';'
|
2012-03-12 11:18:19 +01:00
|
|
|
# define FC_DIR_SEPARATOR '\\'
|
2012-04-18 05:55:23 +02:00
|
|
|
# define FC_DIR_SEPARATOR_S "\\"
|
2003-03-22 22:25:34 +01:00
|
|
|
#else
|
2012-04-12 07:01:25 +02:00
|
|
|
# define FC_SEARCH_PATH_SEPARATOR ':'
|
2012-03-12 11:18:19 +01:00
|
|
|
# define FC_DIR_SEPARATOR '/'
|
2012-04-18 05:55:23 +02:00
|
|
|
# define FC_DIR_SEPARATOR_S "/"
|
2003-03-22 22:25:34 +01:00
|
|
|
#endif
|
|
|
|
|
2017-03-01 11:48:02 +01:00
|
|
|
#ifdef PATH_MAX
|
|
|
|
#define FC_PATH_MAX PATH_MAX
|
|
|
|
#else
|
|
|
|
#define FC_PATH_MAX 128
|
|
|
|
#endif
|
|
|
|
|
2012-12-30 04:32:56 +01:00
|
|
|
#if __GNUC__ >= 4
|
|
|
|
#define FC_UNUSED __attribute__((unused))
|
|
|
|
#else
|
|
|
|
#define FC_UNUSED
|
|
|
|
#endif
|
|
|
|
|
2020-08-06 05:44:39 +02:00
|
|
|
#ifndef FC_UINT64_FORMAT
|
|
|
|
#define FC_UINT64_FORMAT "llu"
|
|
|
|
#endif
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
#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
|
2002-06-29 22:31:02 +02:00
|
|
|
#define FC_DBG_SCANV 256
|
2004-12-05 06:03:52 +01:00
|
|
|
#define FC_DBG_CONFIG 1024
|
2006-08-30 13:16:22 +02:00
|
|
|
#define FC_DBG_LANGSET 2048
|
2015-06-08 10:38:02 +02:00
|
|
|
#define FC_DBG_MATCH2 4096
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2013-07-03 04:56:58 +02:00
|
|
|
#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1] FC_UNUSED
|
2010-12-28 07:59:19 +01:00
|
|
|
#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
|
|
|
|
#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond))
|
|
|
|
|
2009-11-16 22:57:10 +01:00
|
|
|
#define FC_MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
|
|
#define FC_MAX(a,b) ((a) > (b) ? (a) : (b))
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
/* slim_internal.h */
|
2007-10-25 23:36:24 +02:00
|
|
|
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun)
|
2006-09-04 09:47:07 +02:00
|
|
|
#define FcPrivate __attribute__((__visibility__("hidden")))
|
2006-09-08 00:17:10 +02:00
|
|
|
#define HAVE_GNUC_ATTRIBUTE 1
|
|
|
|
#include "fcalias.h"
|
2006-09-04 09:47:07 +02:00
|
|
|
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
|
|
|
#define FcPrivate __hidden
|
|
|
|
#else /* not gcc >= 3.3 and not Sun Studio >= 8 */
|
|
|
|
#define FcPrivate
|
|
|
|
#endif
|
|
|
|
|
2014-03-27 07:10:44 +01:00
|
|
|
/* NLS */
|
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
#include <libintl.h>
|
|
|
|
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
|
|
|
|
#else
|
|
|
|
#define dgettext(d, s) (s)
|
|
|
|
#define _(x) (x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define N_(x) x
|
|
|
|
|
2012-10-07 20:41:38 +02:00
|
|
|
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
|
|
|
|
|
2013-01-02 09:06:15 +01:00
|
|
|
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
|
|
|
|
#define FcFree(s) (free ((FcChar8 *) (s)))
|
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
/*
|
|
|
|
* Serialized data structures use only offsets instead of pointers
|
|
|
|
* A low bit of 1 indicates an offset.
|
|
|
|
*/
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
/* Is the provided pointer actually an offset? */
|
|
|
|
#define FcIsEncodedOffset(p) ((((intptr_t) (p)) & 1) != 0)
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
/* 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)
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
/* 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)
|
2013-11-20 10:44:59 +01:00
|
|
|
#define FcValueRange(v) FcPointerMember(v,u.r,const FcRange)
|
2006-08-30 13:16:22 +02:00
|
|
|
|
|
|
|
typedef struct _FcValueList *FcValueListPtr;
|
|
|
|
|
|
|
|
typedef struct _FcValueList {
|
|
|
|
struct _FcValueList *next;
|
|
|
|
FcValue value;
|
|
|
|
FcValueBinding binding;
|
2002-02-15 00:34:13 +01:00
|
|
|
} FcValueList;
|
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
#define FcValueListNext(vl) FcPointerMember(vl,next,FcValueList)
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
typedef int FcObject;
|
2005-08-24 08:21:30 +02:00
|
|
|
|
2013-08-23 13:42:37 +02:00
|
|
|
/* The 1024 is to leave some room for future added internal objects, such
|
2013-08-05 13:04:13 +02:00
|
|
|
* that caches from newer fontconfig can still be used with older fontconfig
|
|
|
|
* without getting confused. */
|
2013-08-23 13:42:37 +02:00
|
|
|
#define FC_EXT_OBJ_INDEX 1024
|
|
|
|
#define FC_OBJ_ID(_n_) ((_n_) & (~FC_EXT_OBJ_INDEX))
|
2013-08-05 13:04:13 +02:00
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
typedef struct _FcPatternElt *FcPatternEltPtr;
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
/*
|
2010-04-12 18:18:50 +02:00
|
|
|
* Pattern elts are stuck in a structure connected to the pattern,
|
2006-08-30 13:16:22 +02:00
|
|
|
* so they get moved around when the pattern is resized. Hence, the
|
|
|
|
* values field must be a pointer/offset instead of just an offset
|
|
|
|
*/
|
2002-02-15 00:34:13 +01:00
|
|
|
typedef struct _FcPatternElt {
|
2006-08-30 13:16:22 +02:00
|
|
|
FcObject object;
|
|
|
|
FcValueList *values;
|
2002-02-15 00:34:13 +01:00
|
|
|
} FcPatternElt;
|
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
#define FcPatternEltValues(pe) FcPointerMember(pe,values,FcValueList)
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
struct _FcPattern {
|
|
|
|
int num;
|
|
|
|
int size;
|
2006-08-30 13:16:22 +02:00
|
|
|
intptr_t elts_offset;
|
2012-10-07 20:41:38 +02:00
|
|
|
FcRef ref;
|
2002-02-15 00:34:13 +01:00
|
|
|
};
|
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
#define FcPatternElts(p) FcOffsetMember(p,elts_offset,FcPatternElt)
|
|
|
|
|
|
|
|
#define FcFontSetFonts(fs) FcPointerMember(fs,fonts,FcPattern *)
|
2006-08-30 22:51:03 +02:00
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
#define FcFontSetFont(fs,i) (FcIsEncodedOffset((fs)->fonts) ? \
|
2006-09-01 11:22:59 +02:00
|
|
|
FcEncodedOffsetToPtr(fs, \
|
2006-08-30 22:51:03 +02:00
|
|
|
FcFontSetFonts(fs)[i], \
|
|
|
|
FcPattern) : \
|
|
|
|
fs->fonts[i])
|
2006-08-30 13:16:22 +02:00
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
typedef enum _FcOp {
|
2010-12-06 04:38:18 +01:00
|
|
|
FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpRange, FcOpBool, FcOpCharSet, FcOpLangSet,
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOpNil,
|
|
|
|
FcOpField, FcOpConst,
|
2010-04-12 18:18:50 +02:00
|
|
|
FcOpAssign, FcOpAssignReplace,
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast,
|
2013-01-29 12:19:36 +01:00
|
|
|
FcOpDelete, FcOpDeleteAll,
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOpQuest,
|
2010-04-12 18:18:50 +02:00
|
|
|
FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual,
|
2003-07-20 18:06:18 +02:00
|
|
|
FcOpContains, FcOpListing, FcOpNotContains,
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual,
|
|
|
|
FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide,
|
2003-04-16 01:38:06 +02:00
|
|
|
FcOpNot, FcOpComma, FcOpFloor, FcOpCeil, FcOpRound, FcOpTrunc,
|
|
|
|
FcOpInvalid
|
2002-02-15 00:34:13 +01:00
|
|
|
} FcOp;
|
|
|
|
|
2012-04-11 12:52:35 +02:00
|
|
|
typedef enum _FcOpFlags {
|
2018-04-11 20:39:56 +02:00
|
|
|
FcOpFlagIgnoreBlanks = 1U << 0
|
2012-04-11 12:52:35 +02:00
|
|
|
} 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))
|
|
|
|
|
2012-12-30 03:39:06 +01:00
|
|
|
typedef struct _FcExprMatrix {
|
|
|
|
struct _FcExpr *xx, *xy, *yx, *yy;
|
|
|
|
} FcExprMatrix;
|
|
|
|
|
2012-12-30 05:58:38 +01:00
|
|
|
typedef struct _FcExprName {
|
|
|
|
FcObject object;
|
|
|
|
FcMatchKind kind;
|
|
|
|
} FcExprName;
|
|
|
|
|
2014-08-20 22:07:26 +02:00
|
|
|
struct _FcRange {
|
2013-11-20 10:44:59 +01:00
|
|
|
double begin;
|
|
|
|
double end;
|
|
|
|
};
|
|
|
|
|
2012-12-30 05:58:38 +01:00
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
typedef struct _FcExpr {
|
|
|
|
FcOp op;
|
|
|
|
union {
|
2013-11-20 10:44:59 +01:00
|
|
|
int ival;
|
|
|
|
double dval;
|
|
|
|
const FcChar8 *sval;
|
|
|
|
FcExprMatrix *mexpr;
|
|
|
|
FcBool bval;
|
|
|
|
FcCharSet *cval;
|
|
|
|
FcLangSet *lval;
|
|
|
|
FcRange *rval;
|
|
|
|
|
|
|
|
FcExprName name;
|
|
|
|
const FcChar8 *constant;
|
2002-02-15 00:34:13 +01:00
|
|
|
struct {
|
|
|
|
struct _FcExpr *left, *right;
|
|
|
|
} tree;
|
|
|
|
} u;
|
|
|
|
} FcExpr;
|
|
|
|
|
2009-06-06 04:32:31 +02:00
|
|
|
typedef struct _FcExprPage FcExprPage;
|
|
|
|
|
|
|
|
struct _FcExprPage {
|
|
|
|
FcExprPage *next_page;
|
|
|
|
FcExpr *next;
|
|
|
|
FcExpr exprs[(1024 - 2/* two pointers */ - 2/* malloc overhead */) * sizeof (void *) / sizeof (FcExpr)];
|
2012-06-18 04:23:39 +02:00
|
|
|
FcExpr end[FLEXIBLE_ARRAY_MEMBER];
|
2009-06-06 04:32:31 +02:00
|
|
|
};
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
typedef enum _FcQual {
|
2002-06-19 22:08:22 +02:00
|
|
|
FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
|
2002-02-15 00:34:13 +01:00
|
|
|
} FcQual;
|
|
|
|
|
2002-08-11 20:11:04 +02:00
|
|
|
#define FcMatchDefault ((FcMatchKind) -1)
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
typedef struct _FcTest {
|
2002-08-11 20:11:04 +02:00
|
|
|
FcMatchKind kind;
|
2002-02-15 00:34:13 +01:00
|
|
|
FcQual qual;
|
2006-08-30 13:16:22 +02:00
|
|
|
FcObject object;
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOp op;
|
|
|
|
FcExpr *expr;
|
|
|
|
} FcTest;
|
|
|
|
|
|
|
|
typedef struct _FcEdit {
|
2006-08-30 13:16:22 +02:00
|
|
|
FcObject object;
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOp op;
|
|
|
|
FcExpr *expr;
|
2002-07-31 03:36:37 +02:00
|
|
|
FcValueBinding binding;
|
2002-02-15 00:34:13 +01:00
|
|
|
} FcEdit;
|
|
|
|
|
2014-03-27 07:10:44 +01:00
|
|
|
typedef void (* FcDestroyFunc) (void *data);
|
|
|
|
|
|
|
|
typedef struct _FcPtrList FcPtrList;
|
|
|
|
/* need to sync with FcConfigFileInfoIter at fontconfig.h */
|
|
|
|
typedef struct _FcPtrListIter {
|
|
|
|
void *dummy1;
|
|
|
|
void *dummy2;
|
|
|
|
void *dummy3;
|
|
|
|
} FcPtrListIter;
|
|
|
|
|
2013-07-04 12:51:03 +02:00
|
|
|
typedef enum _FcRuleType {
|
|
|
|
FcRuleUnknown, FcRuleTest, FcRuleEdit
|
|
|
|
} FcRuleType;
|
|
|
|
|
|
|
|
typedef struct _FcRule {
|
|
|
|
struct _FcRule *next;
|
|
|
|
FcRuleType type;
|
|
|
|
union {
|
|
|
|
FcTest *test;
|
|
|
|
FcEdit *edit;
|
|
|
|
} u;
|
|
|
|
} FcRule;
|
|
|
|
|
2014-03-27 07:10:44 +01:00
|
|
|
typedef struct _FcRuleSet {
|
|
|
|
FcRef ref;
|
|
|
|
FcChar8 *name;
|
|
|
|
FcChar8 *description;
|
|
|
|
FcChar8 *domain;
|
|
|
|
FcBool enabled;
|
|
|
|
FcPtrList *subst[FcMatchKindEnd];
|
|
|
|
} FcRuleSet;
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2002-05-31 06:42:42 +02:00
|
|
|
typedef struct _FcCharLeaf {
|
2002-02-15 00:34:13 +01:00
|
|
|
FcChar32 map[256/32];
|
2002-05-31 06:42:42 +02:00
|
|
|
} FcCharLeaf;
|
2002-02-15 00:34:13 +01:00
|
|
|
|
|
|
|
struct _FcCharSet {
|
2012-10-07 20:41:38 +02:00
|
|
|
FcRef ref; /* reference count */
|
2002-05-31 06:42:42 +02:00
|
|
|
int num; /* size of leaves and numbers arrays */
|
2006-08-30 13:16:22 +02:00
|
|
|
intptr_t leaves_offset;
|
|
|
|
intptr_t numbers_offset;
|
2002-02-15 00:34:13 +01:00
|
|
|
};
|
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
#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)
|
|
|
|
|
2016-01-09 03:06:31 +01:00
|
|
|
#define FCSS_DEFAULT 0 /* default behavior */
|
|
|
|
#define FCSS_ALLOW_DUPLICATES 1 /* allows for duplicate strings in the set */
|
|
|
|
#define FCSS_GROW_BY_64 2 /* grows buffer by 64 elements instead of 1 */
|
|
|
|
|
|
|
|
#define FcStrSetHasControlBit(s,c) (s->control & c)
|
|
|
|
#define FcStrSetHasControlBits(s,c) ( (c) == (s->control & (c)) )
|
|
|
|
|
2002-05-21 19:06:22 +02:00
|
|
|
struct _FcStrSet {
|
2012-10-07 20:41:38 +02:00
|
|
|
FcRef ref; /* reference count */
|
2002-05-21 19:06:22 +02:00
|
|
|
int num;
|
|
|
|
int size;
|
2005-08-24 08:21:30 +02:00
|
|
|
FcChar8 **strs;
|
2016-01-09 03:06:31 +01:00
|
|
|
unsigned int control; /* control bits for set behavior */
|
2002-05-21 19:06:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _FcStrList {
|
|
|
|
FcStrSet *set;
|
|
|
|
int n;
|
|
|
|
};
|
|
|
|
|
2002-02-18 23:29:28 +01:00
|
|
|
typedef struct _FcStrBuf {
|
2002-02-15 00:34:13 +01:00
|
|
|
FcChar8 *buf;
|
|
|
|
FcBool allocated;
|
|
|
|
FcBool failed;
|
|
|
|
int len;
|
|
|
|
int size;
|
2009-03-11 18:56:09 +01:00
|
|
|
FcChar8 buf_static[16 * sizeof (void *)];
|
2002-02-18 23:29:28 +01:00
|
|
|
} FcStrBuf;
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2017-11-15 08:10:49 +01:00
|
|
|
typedef struct _FcHashTable FcHashTable;
|
|
|
|
|
|
|
|
typedef FcChar32 (* FcHashFunc) (const void *data);
|
|
|
|
typedef int (* FcCompareFunc) (const void *v1, const void *v2);
|
|
|
|
typedef FcBool (* FcCopyFunc) (const void *src, void **dest);
|
|
|
|
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
struct _FcCache {
|
2012-12-30 04:47:49 +01:00
|
|
|
unsigned int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */
|
2015-05-27 23:36:35 +02:00
|
|
|
int version; /* FC_CACHE_VERSION_NUMBER */
|
2006-08-31 08:09:39 +02:00
|
|
|
intptr_t size; /* size of file */
|
2006-08-30 13:16:22 +02:00
|
|
|
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 */
|
2012-05-28 07:52:21 +02:00
|
|
|
int checksum; /* checksum of directory state */
|
2015-10-15 08:48:23 +02:00
|
|
|
int64_t checksum_nano; /* checksum of directory state */
|
2006-09-04 09:47:07 +02:00
|
|
|
};
|
2005-07-25 06:10:09 +02:00
|
|
|
|
2006-09-05 11:24:01 +02:00
|
|
|
#undef FcCacheDir
|
|
|
|
#undef FcCacheSubdir
|
2006-08-30 13:16:22 +02:00
|
|
|
#define FcCacheDir(c) FcOffsetMember(c,dir,FcChar8)
|
|
|
|
#define FcCacheDirs(c) FcOffsetMember(c,dirs,intptr_t)
|
|
|
|
#define FcCacheSet(c) FcOffsetMember(c,set,FcFontSet)
|
2006-09-04 09:47:07 +02:00
|
|
|
#define FcCacheSubdir(c,i) FcOffsetToPtr (FcCacheDirs(c),\
|
|
|
|
FcCacheDirs(c)[i], \
|
2006-09-01 10:15:14 +02:00
|
|
|
FcChar8)
|
2006-08-30 13:16:22 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Used while constructing a directory cache object
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FC_SERIALIZE_HASH_SIZE 8191
|
|
|
|
|
2009-11-16 21:12:52 +01:00
|
|
|
typedef union _FcAlign {
|
|
|
|
double d;
|
|
|
|
int i;
|
|
|
|
intptr_t ip;
|
|
|
|
FcBool b;
|
|
|
|
void *p;
|
|
|
|
} FcAlign;
|
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
typedef struct _FcSerializeBucket {
|
|
|
|
struct _FcSerializeBucket *next;
|
|
|
|
const void *object;
|
|
|
|
intptr_t offset;
|
|
|
|
} FcSerializeBucket;
|
|
|
|
|
2006-09-01 10:15:14 +02:00
|
|
|
typedef struct _FcCharSetFreezer FcCharSetFreezer;
|
|
|
|
|
2006-08-30 13:16:22 +02:00
|
|
|
typedef struct _FcSerialize {
|
|
|
|
intptr_t size;
|
2006-09-01 10:15:14 +02:00
|
|
|
FcCharSetFreezer *cs_freezer;
|
2006-08-30 13:16:22 +02:00
|
|
|
void *linear;
|
|
|
|
FcSerializeBucket *buckets[FC_SERIALIZE_HASH_SIZE];
|
|
|
|
} FcSerialize;
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2003-05-05 00:53:49 +02:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
2004-12-29 10:15:17 +01:00
|
|
|
/*
|
|
|
|
* To perform case-insensitive string comparisons, a table
|
|
|
|
* is used which holds three different kinds of folding data.
|
2010-04-12 18:18:50 +02:00
|
|
|
*
|
2004-12-29 10:15:17 +01:00
|
|
|
* 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.
|
2010-04-12 18:18:50 +02:00
|
|
|
*
|
2004-12-29 10:15:17 +01:00
|
|
|
* 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;
|
|
|
|
|
2004-12-05 06:03:52 +01:00
|
|
|
#define FC_MAX_FILE_LEN 4096
|
|
|
|
|
2006-09-01 10:15:14 +02:00
|
|
|
#define FC_CACHE_MAGIC_MMAP 0xFC02FC04
|
|
|
|
#define FC_CACHE_MAGIC_ALLOC 0xFC02FC05
|
2002-07-28 12:50:59 +02:00
|
|
|
|
2002-03-01 23:06:30 +01:00
|
|
|
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) */
|
|
|
|
};
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
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
|
|
|
|
*/
|
2002-05-21 19:06:22 +02:00
|
|
|
FcStrSet *configDirs; /* directories to scan for fonts */
|
Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
FcStrSet *configMapDirs; /* mapped names to generate cache entries */
|
2002-05-21 19:06:22 +02:00
|
|
|
/*
|
|
|
|
* List of directories containing fonts,
|
2010-04-12 18:18:50 +02:00
|
|
|
* built by recursively scanning the set
|
2002-05-21 19:06:22 +02:00
|
|
|
* of configured directories
|
|
|
|
*/
|
|
|
|
FcStrSet *fontDirs;
|
2006-08-04 18:13:00 +02:00
|
|
|
/*
|
|
|
|
* List of directories containing cache files.
|
|
|
|
*/
|
|
|
|
FcStrSet *cacheDirs;
|
2002-02-15 00:34:13 +01:00
|
|
|
/*
|
|
|
|
* Names of all of the configuration files used
|
|
|
|
* to create this configuration
|
|
|
|
*/
|
2002-05-21 19:06:22 +02:00
|
|
|
FcStrSet *configFiles; /* config files loaded */
|
2002-02-15 00:34:13 +01:00
|
|
|
/*
|
|
|
|
* Substitution instructions for patterns and fonts;
|
|
|
|
* maxObjects is used to allocate appropriate intermediate storage
|
|
|
|
* while performing a whole set of substitutions
|
2014-03-27 07:10:44 +01:00
|
|
|
*
|
|
|
|
* 0.. substitutions for patterns
|
|
|
|
* 1.. substitutions for fonts
|
|
|
|
* 2.. substitutions for scanned fonts
|
2002-02-15 00:34:13 +01:00
|
|
|
*/
|
2014-03-27 07:10:44 +01:00
|
|
|
FcPtrList *subst[FcMatchKindEnd];
|
2002-02-15 00:34:13 +01:00
|
|
|
int maxObjects; /* maximum number of tests in all substs */
|
2003-05-07 18:13:24 +02:00
|
|
|
/*
|
|
|
|
* List of patterns used to control font file selection
|
|
|
|
*/
|
|
|
|
FcStrSet *acceptGlobs;
|
|
|
|
FcStrSet *rejectGlobs;
|
2004-12-04 20:41:10 +01:00
|
|
|
FcFontSet *acceptPatterns;
|
|
|
|
FcFontSet *rejectPatterns;
|
2002-02-15 00:34:13 +01:00
|
|
|
/*
|
|
|
|
* 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];
|
2002-05-21 19:06:22 +02:00
|
|
|
/*
|
|
|
|
* 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 */
|
2008-08-23 00:08:07 +02:00
|
|
|
|
2012-10-07 20:41:38 +02:00
|
|
|
FcRef ref; /* reference count */
|
2009-06-06 04:32:31 +02:00
|
|
|
|
2013-02-06 11:35:30 +01:00
|
|
|
FcExprPage *expr_pool; /* pool of FcExpr's */
|
|
|
|
|
|
|
|
FcChar8 *sysRoot; /* override the system root directory */
|
2014-03-27 07:10:44 +01:00
|
|
|
FcStrSet *availConfigFiles; /* config files available */
|
|
|
|
FcPtrList *rulesetList; /* List of rulesets being installed */
|
2002-02-15 00:34:13 +01:00
|
|
|
};
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2005-11-02 07:29:14 +01:00
|
|
|
typedef struct _FcFileTime {
|
|
|
|
time_t time;
|
|
|
|
FcBool set;
|
|
|
|
} FcFileTime;
|
|
|
|
|
2002-07-13 07:43:25 +02:00
|
|
|
typedef struct _FcCharMap FcCharMap;
|
|
|
|
|
2012-05-28 06:59:48 +02:00
|
|
|
typedef struct _FcStatFS FcStatFS;
|
|
|
|
|
|
|
|
struct _FcStatFS {
|
|
|
|
FcBool is_remote_fs;
|
|
|
|
FcBool is_mtime_broken;
|
|
|
|
};
|
|
|
|
|
2012-10-07 20:41:38 +02:00
|
|
|
typedef struct _FcValuePromotionBuffer FcValuePromotionBuffer;
|
|
|
|
|
|
|
|
struct _FcValuePromotionBuffer {
|
|
|
|
union {
|
|
|
|
double d;
|
|
|
|
int i;
|
|
|
|
long l;
|
|
|
|
char c[256]; /* Enlarge as needed */
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fccache.c */
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcCache *
|
2006-09-01 10:15:14 +02:00
|
|
|
FcDirCacheScan (const FcChar8 *dir, FcConfig *config);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcCache *
|
2007-10-18 13:13:51 +02:00
|
|
|
FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcStrSet *dirs);
|
2006-09-01 10:15:14 +02:00
|
|
|
|
2013-12-05 11:15:47 +01:00
|
|
|
FcPrivate FcCache *
|
|
|
|
FcDirCacheRebuild (FcCache *cache, struct stat *dir_stat, FcStrSet *dirs);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-09-01 10:15:14 +02:00
|
|
|
FcDirCacheWrite (FcCache *cache, FcConfig *config);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2012-03-28 10:28:06 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcDirCacheCreateTagFile (const FcChar8 *cache_dir);
|
|
|
|
|
2006-09-05 07:20:25 +02:00
|
|
|
FcPrivate void
|
|
|
|
FcCacheObjectReference (void *object);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcCacheObjectDereference (void *object);
|
|
|
|
|
2018-05-23 15:08:12 +02:00
|
|
|
FcPrivate void *
|
|
|
|
FcCacheAllocate (FcCache *cache, size_t len);
|
|
|
|
|
2006-09-04 22:59:58 +02:00
|
|
|
FcPrivate void
|
|
|
|
FcCacheFini (void);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2018-05-23 15:08:12 +02:00
|
|
|
|
2006-09-05 11:24:01 +02:00
|
|
|
FcPrivate void
|
2006-09-05 07:26:24 +02:00
|
|
|
FcDirCacheReference (FcCache *cache, int nref);
|
|
|
|
|
2015-08-14 10:17:34 +02:00
|
|
|
FcPrivate int
|
|
|
|
FcDirCacheLock (const FcChar8 *dir,
|
|
|
|
FcConfig *config);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcDirCacheUnlock (int fd);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fccfg.c */
|
|
|
|
|
2012-10-07 22:37:03 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcConfigInit (void);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcConfigFini (void);
|
|
|
|
|
2012-03-12 11:18:19 +01:00
|
|
|
FcPrivate FcChar8 *
|
|
|
|
FcConfigXdgCacheHome (void);
|
|
|
|
|
|
|
|
FcPrivate FcChar8 *
|
|
|
|
FcConfigXdgConfigHome (void);
|
|
|
|
|
|
|
|
FcPrivate FcChar8 *
|
|
|
|
FcConfigXdgDataHome (void);
|
|
|
|
|
2009-06-06 04:32:31 +02:00
|
|
|
FcPrivate FcExpr *
|
|
|
|
FcConfigAllocExpr (FcConfig *config);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-05-21 19:06:22 +02:00
|
|
|
FcConfigAddConfigDir (FcConfig *config,
|
|
|
|
const FcChar8 *d);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-05-21 19:06:22 +02:00
|
|
|
FcConfigAddFontDir (FcConfig *config,
|
Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
const FcChar8 *d,
|
2019-01-31 11:17:47 +01:00
|
|
|
const FcChar8 *m,
|
|
|
|
const FcChar8 *salt);
|
Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
|
2019-01-31 08:52:09 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcConfigResetFontDirs (FcConfig *config);
|
|
|
|
|
Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
FcPrivate FcChar8 *
|
|
|
|
FcConfigMapFontPath(FcConfig *config,
|
|
|
|
const FcChar8 *path);
|
2002-05-21 19:06:22 +02:00
|
|
|
|
2019-01-31 11:17:47 +01:00
|
|
|
FcPrivate const FcChar8 *
|
|
|
|
FcConfigMapSalt (FcConfig *config,
|
|
|
|
const FcChar8 *path);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-04 18:13:00 +02:00
|
|
|
FcConfigAddCacheDir (FcConfig *config,
|
|
|
|
const FcChar8 *d);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-02-15 07:01:28 +01:00
|
|
|
FcConfigAddConfigFile (FcConfig *config,
|
|
|
|
const FcChar8 *f);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-02-15 00:34:13 +01:00
|
|
|
FcConfigAddBlank (FcConfig *config,
|
|
|
|
FcChar32 blank);
|
|
|
|
|
2013-07-04 12:51:03 +02:00
|
|
|
FcBool
|
|
|
|
FcConfigAddRule (FcConfig *config,
|
|
|
|
FcRule *rule,
|
2002-02-15 00:34:13 +01:00
|
|
|
FcMatchKind kind);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-02-15 00:34:13 +01:00
|
|
|
FcConfigSetFonts (FcConfig *config,
|
|
|
|
FcFontSet *fonts,
|
|
|
|
FcSetName set);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2005-08-24 08:21:30 +02:00
|
|
|
FcConfigCompareValue (const FcValue *m,
|
2013-06-28 08:04:11 +02:00
|
|
|
unsigned int op_,
|
2005-08-24 08:21:30 +02:00
|
|
|
const FcValue *v);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2003-05-07 18:13:24 +02:00
|
|
|
FcConfigGlobAdd (FcConfig *config,
|
|
|
|
const FcChar8 *glob,
|
|
|
|
FcBool accept);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2003-05-07 18:13:24 +02:00
|
|
|
FcConfigAcceptFilename (FcConfig *config,
|
|
|
|
const FcChar8 *filename);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2004-12-04 20:41:10 +01:00
|
|
|
FcConfigPatternsAdd (FcConfig *config,
|
|
|
|
FcPattern *pattern,
|
|
|
|
FcBool accept);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2004-12-04 20:41:10 +01:00
|
|
|
FcConfigAcceptFont (FcConfig *config,
|
|
|
|
const FcPattern *font);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcFileTime
|
2005-11-02 07:29:14 +01:00
|
|
|
FcConfigModifiedTime (FcConfig *config);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2010-04-12 18:18:50 +02:00
|
|
|
FcConfigAddCache (FcConfig *config, FcCache *cache,
|
2018-05-23 15:15:33 +02:00
|
|
|
FcSetName set, FcStrSet *dirSet, FcChar8 *forDir);
|
2006-08-31 06:59:53 +02:00
|
|
|
|
2014-03-27 07:10:44 +01:00
|
|
|
FcPrivate FcRuleSet *
|
|
|
|
FcRuleSetCreate (const FcChar8 *name);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcRuleSetDestroy (FcRuleSet *rs);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcRuleSetReference (FcRuleSet *rs);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcRuleSetEnable (FcRuleSet *rs,
|
|
|
|
FcBool flag);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcRuleSetAddDescription (FcRuleSet *rs,
|
|
|
|
const FcChar8 *domain,
|
|
|
|
const FcChar8 *description);
|
|
|
|
|
|
|
|
FcPrivate int
|
|
|
|
FcRuleSetAdd (FcRuleSet *rs,
|
|
|
|
FcRule *rule,
|
|
|
|
FcMatchKind kind);
|
|
|
|
|
2006-08-31 06:59:53 +02:00
|
|
|
/* fcserialize.c */
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate intptr_t
|
2006-08-30 13:16:22 +02:00
|
|
|
FcAlignSize (intptr_t size);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcSerialize *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcSerializeCreate (void);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2006-08-30 13:16:22 +02:00
|
|
|
FcSerializeDestroy (FcSerialize *serialize);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcSerializeAlloc (FcSerialize *serialize, const void *object, int size);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate intptr_t
|
2006-08-30 13:16:22 +02:00
|
|
|
FcSerializeReserve (FcSerialize *serialize, int size);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate intptr_t
|
2006-08-30 13:16:22 +02:00
|
|
|
FcSerializeOffset (FcSerialize *serialize, const void *object);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcSerializePtr (FcSerialize *serialize, const void *object);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcLangSetSerializeAlloc (FcSerialize *serialize, const FcLangSet *l);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcLangSet *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fccharset.c */
|
2014-05-13 14:21:43 +02:00
|
|
|
FcPrivate FcCharSet *
|
|
|
|
FcCharSetPromote (FcValuePromotionBuffer *vbuf);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2005-11-04 20:31:26 +01:00
|
|
|
FcLangCharSetPopulate (void);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcCharSetFreezer *
|
2006-09-01 10:49:47 +02:00
|
|
|
FcCharSetFreezerCreate (void);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate const FcCharSet *
|
2006-09-01 10:49:47 +02:00
|
|
|
FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2006-09-01 10:15:14 +02:00
|
|
|
FcCharSetFreezerDestroy (FcCharSetFreezer *freezer);
|
2003-08-15 21:45:20 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-02-18 23:29:28 +01:00
|
|
|
FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcCharSet *
|
2002-02-15 00:34:13 +01:00
|
|
|
FcNameParseCharSet (FcChar8 *string);
|
2008-12-30 02:00:26 +01:00
|
|
|
|
2009-02-12 05:44:36 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcNameUnparseValue (FcStrBuf *buf,
|
|
|
|
FcValue *v0,
|
|
|
|
FcChar8 *escape);
|
|
|
|
|
2008-12-30 02:00:26 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcNameUnparseValueList (FcStrBuf *buf,
|
|
|
|
FcValueListPtr v,
|
|
|
|
FcChar8 *escape);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcCharLeaf *
|
2003-02-06 18:46:06 +01:00
|
|
|
FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
|
2002-07-13 07:43:25 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcCharSetSerializeAlloc(FcSerialize *serialize, const FcCharSet *cs);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcCharSet *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar16 *
|
2005-06-28 05:41:02 +02:00
|
|
|
FcCharSetGetNumbers(const FcCharSet *c);
|
|
|
|
|
2012-12-06 12:01:52 +01:00
|
|
|
/* fccompat.c */
|
|
|
|
FcPrivate int
|
|
|
|
FcOpen(const char *pathname, int flags, ...);
|
|
|
|
|
|
|
|
FcPrivate int
|
|
|
|
FcMakeTempfile (char *template);
|
|
|
|
|
2013-01-22 04:03:28 +01:00
|
|
|
FcPrivate int32_t
|
|
|
|
FcRandom (void);
|
|
|
|
|
2013-08-07 04:57:19 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcMakeDirectory (const FcChar8 *dir);
|
|
|
|
|
2018-01-04 12:23:16 +01:00
|
|
|
FcPrivate ssize_t
|
|
|
|
FcReadLink (const FcChar8 *pathname,
|
|
|
|
FcChar8 *buf,
|
|
|
|
size_t bufsiz);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fcdbg.c */
|
2013-01-02 02:52:14 +01:00
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcValuePrintFile (FILE *f, const FcValue v);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2012-05-01 13:18:41 +02:00
|
|
|
FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcValueListPrintWithPosition (FcValueListPtr l, const FcValueListPtr pos);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcValueListPrint (FcValueListPtr l);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2003-03-05 06:52:31 +01:00
|
|
|
FcLangSetPrint (const FcLangSet *ls);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-02-15 00:34:13 +01:00
|
|
|
FcOpPrint (FcOp op);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-08-11 20:11:04 +02:00
|
|
|
FcTestPrint (const FcTest *test);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-08-11 20:11:04 +02:00
|
|
|
FcExprPrint (const FcExpr *expr);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-08-11 20:11:04 +02:00
|
|
|
FcEditPrint (const FcEdit *edit);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2014-03-27 07:10:44 +01:00
|
|
|
FcRulePrint (const FcRule *rule);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2006-08-30 13:16:22 +02:00
|
|
|
FcCharSetPrint (const FcCharSet *c);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2015-06-12 04:30:01 +02:00
|
|
|
FcPrivate void
|
|
|
|
FcPatternPrint2 (FcPattern *p1, FcPattern *p2, const FcObjectSet *os);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
extern FcPrivate int FcDebugVal;
|
2005-11-24 20:38:05 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
#define FcDebug() (FcDebugVal)
|
2005-11-24 20:38:05 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2005-11-24 20:38:05 +01:00
|
|
|
FcInitDebug (void);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2005-10-22 16:21:14 +02:00
|
|
|
/* fcdefault.c */
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar8 *
|
2005-10-22 16:21:14 +02:00
|
|
|
FcGetDefaultLang (void);
|
|
|
|
|
2013-01-16 03:41:26 +01:00
|
|
|
FcPrivate FcChar8 *
|
|
|
|
FcGetPrgname (void);
|
|
|
|
|
2012-10-07 21:52:25 +02:00
|
|
|
FcPrivate void
|
|
|
|
FcDefaultFini (void);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fcdir.c */
|
|
|
|
|
2012-12-05 10:13:25 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcFileIsLink (const FcChar8 *file);
|
|
|
|
|
2013-08-07 04:57:19 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcFileIsFile (const FcChar8 *file);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2003-05-07 18:13:24 +02:00
|
|
|
FcFileScanConfig (FcFontSet *set,
|
|
|
|
FcStrSet *dirs,
|
|
|
|
const FcChar8 *file,
|
|
|
|
FcConfig *config);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2003-05-07 18:13:24 +02:00
|
|
|
FcDirScanConfig (FcFontSet *set,
|
|
|
|
FcStrSet *dirs,
|
2006-09-01 10:15:14 +02:00
|
|
|
const FcChar8 *dir,
|
2003-05-07 18:13:24 +02:00
|
|
|
FcBool force,
|
2016-04-06 07:39:15 +02:00
|
|
|
FcConfig *config);
|
2003-05-07 18:13:24 +02:00
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fcfont.c */
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate int
|
2002-02-15 00:34:13 +01:00
|
|
|
FcFontDebug (void);
|
2009-06-06 00:27:47 +02:00
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fcfs.c */
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s);
|
2005-07-25 06:10:09 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcFontSet *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2013-12-05 11:15:47 +01:00
|
|
|
FcPrivate FcFontSet *
|
|
|
|
FcFontSetDeserialize (const FcFontSet *set);
|
|
|
|
|
2014-03-27 07:10:44 +01:00
|
|
|
/* fcplist.c */
|
|
|
|
FcPrivate FcPtrList *
|
|
|
|
FcPtrListCreate (FcDestroyFunc func);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcPtrListDestroy (FcPtrList *list);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcPtrListIterInit (const FcPtrList *list,
|
|
|
|
FcPtrListIter *iter);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcPtrListIterInitAtLast (FcPtrList *list,
|
|
|
|
FcPtrListIter *iter);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcPtrListIterNext (const FcPtrList *list,
|
|
|
|
FcPtrListIter *iter);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcPtrListIterIsValid (const FcPtrList *list,
|
|
|
|
const FcPtrListIter *iter);
|
|
|
|
|
|
|
|
FcPrivate void *
|
|
|
|
FcPtrListIterGetValue (const FcPtrList *list,
|
|
|
|
const FcPtrListIter *iter);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcPtrListIterAdd (FcPtrList *list,
|
|
|
|
FcPtrListIter *iter,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcPtrListIterRemove (FcPtrList *list,
|
|
|
|
FcPtrListIter *iter);
|
|
|
|
|
2013-02-06 11:35:30 +01:00
|
|
|
/* fcinit.c */
|
|
|
|
FcPrivate FcConfig *
|
|
|
|
FcInitLoadOwnConfig (FcConfig *config);
|
|
|
|
|
|
|
|
FcPrivate FcConfig *
|
|
|
|
FcInitLoadOwnConfigAndFonts (FcConfig *config);
|
|
|
|
|
2009-06-06 00:27:47 +02:00
|
|
|
/* fcxml.c */
|
2015-05-22 09:53:34 +02:00
|
|
|
FcPrivate void
|
|
|
|
FcConfigPathFini (void);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-02-15 00:34:13 +01:00
|
|
|
FcTestDestroy (FcTest *test);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-02-15 00:34:13 +01:00
|
|
|
FcEditDestroy (FcEdit *e);
|
|
|
|
|
2013-07-04 12:51:03 +02:00
|
|
|
void
|
|
|
|
FcRuleDestroy (FcRule *rule);
|
|
|
|
|
2002-07-07 01:47:44 +02:00
|
|
|
/* fclang.c */
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcLangSet *
|
2010-04-12 18:18:50 +02:00
|
|
|
FcFreeTypeLangSet (const FcCharSet *charset,
|
2002-07-08 09:31:53 +02:00
|
|
|
const FcChar8 *exclusiveLang);
|
2002-07-07 01:47:44 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcLangResult
|
2002-07-07 01:47:44 +02:00
|
|
|
FcLangCompare (const FcChar8 *s1, const FcChar8 *s2);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcLangSet *
|
2012-10-07 20:41:38 +02:00
|
|
|
FcLangSetPromote (const FcChar8 *lang, FcValuePromotionBuffer *buf);
|
2002-08-22 09:36:45 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcLangSet *
|
2002-08-22 09:36:45 +02:00
|
|
|
FcNameParseLangSet (const FcChar8 *string);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-08-22 09:36:45 +02:00
|
|
|
FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar8 *
|
2006-08-31 23:38:18 +02:00
|
|
|
FcNameUnparseEscaped (FcPattern *pat, FcBool escape);
|
|
|
|
|
2014-03-27 07:10:44 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcConfigParseOnly (FcConfig *config,
|
|
|
|
const FcChar8 *name,
|
|
|
|
FcBool complain);
|
|
|
|
|
|
|
|
FcPrivate FcChar8 *
|
|
|
|
FcConfigRealFilename (FcConfig *config,
|
|
|
|
const FcChar8 *url);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fclist.c */
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2004-12-04 20:41:10 +01:00
|
|
|
FcListPatternMatchAny (const FcPattern *p,
|
|
|
|
const FcPattern *font);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fcmatch.c */
|
|
|
|
|
|
|
|
/* fcname.c */
|
|
|
|
|
2012-09-20 20:42:31 +02:00
|
|
|
enum {
|
|
|
|
FC_INVALID_OBJECT = 0,
|
2013-02-06 11:02:07 +01:00
|
|
|
#define FC_OBJECT(NAME, Type, Cmp) FC_##NAME##_OBJECT,
|
2012-09-20 20:42:31 +02:00
|
|
|
#include "fcobjs.h"
|
|
|
|
#undef FC_OBJECT
|
|
|
|
FC_ONE_AFTER_MAX_BASE_OBJECT
|
|
|
|
#define FC_MAX_BASE_OBJECT (FC_ONE_AFTER_MAX_BASE_OBJECT - 1)
|
|
|
|
};
|
2005-08-27 04:34:24 +02:00
|
|
|
|
2018-11-30 08:03:54 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcNameConstantWithObjectCheck (const FcChar8 *string, const char *object, int *result);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcNameBool (const FcChar8 *v, FcBool *result);
|
2005-11-16 16:55:17 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcObjectValidType (FcObject object, FcType type);
|
2005-08-24 08:21:30 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcObject
|
2006-08-30 13:16:22 +02:00
|
|
|
FcObjectFromName (const char * name);
|
2005-08-24 08:21:30 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate const char *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcObjectName (FcObject object);
|
2005-08-27 04:34:24 +02:00
|
|
|
|
2008-08-13 08:24:42 +02:00
|
|
|
FcPrivate FcObjectSet *
|
|
|
|
FcObjectGetSet (void);
|
|
|
|
|
2006-08-31 03:50:58 +02:00
|
|
|
#define FcObjectCompare(a, b) ((int) a - (int) b)
|
2005-08-24 08:21:30 +02:00
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fcpat.c */
|
2005-08-24 08:21:30 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcValue
|
2005-08-24 08:21:30 +02:00
|
|
|
FcValueCanonicalize (const FcValue *v);
|
|
|
|
|
2012-11-15 08:37:01 +01:00
|
|
|
FcPrivate FcValueListPtr
|
|
|
|
FcValueListCreate (void);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2005-06-28 05:41:02 +02:00
|
|
|
FcValueListDestroy (FcValueListPtr l);
|
|
|
|
|
2012-11-15 08:37:01 +01:00
|
|
|
FcPrivate FcValueListPtr
|
|
|
|
FcValueListPrepend (FcValueListPtr vallist,
|
|
|
|
FcValue value,
|
|
|
|
FcValueBinding binding);
|
|
|
|
|
|
|
|
FcPrivate FcValueListPtr
|
|
|
|
FcValueListAppend (FcValueListPtr vallist,
|
|
|
|
FcValue value,
|
|
|
|
FcValueBinding binding);
|
|
|
|
|
|
|
|
FcPrivate FcValueListPtr
|
|
|
|
FcValueListDuplicate(FcValueListPtr orig);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcPatternElt *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectFindElt (const FcPattern *p, FcObject object);
|
2002-06-03 10:31:15 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcPatternElt *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectInsertElt (FcPattern *p, FcObject object);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2012-11-15 08:37:01 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcPatternObjectListAdd (FcPattern *p,
|
|
|
|
FcObject object,
|
|
|
|
FcValueListPtr list,
|
|
|
|
FcBool append);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddWithBinding (FcPattern *p,
|
|
|
|
FcObject object,
|
|
|
|
FcValue value,
|
|
|
|
FcValueBinding binding,
|
|
|
|
FcBool append);
|
2002-07-07 01:47:44 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2015-07-28 05:48:40 +02:00
|
|
|
FcPrivate FcResult
|
|
|
|
FcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcResult
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectDel (FcPattern *p, FcObject object);
|
2003-08-15 21:45:20 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectRemove (FcPattern *p, FcObject object, int id);
|
2004-12-04 20:41:10 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddMatrix (FcPattern *p, FcObject object, const FcMatrix *s);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddCharSet (FcPattern *p, FcObject object, const FcCharSet *c);
|
2005-11-16 16:55:17 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddLangSet (FcPattern *p, FcObject object, const FcLangSet *ls);
|
|
|
|
|
2013-11-20 10:44:59 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcPatternObjectAddRange (FcPattern *p, FcObject object, const FcRange *r);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcResult
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int n, int *i);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcResult
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int n, double *d);
|
2005-11-25 04:00:51 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcResult
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectGetString (const FcPattern *p, FcObject object, int n, FcChar8 ** s);
|
2005-11-25 04:00:51 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcResult
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectGetMatrix (const FcPattern *p, FcObject object, int n, FcMatrix **s);
|
2005-11-25 04:00:51 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcResult
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectGetCharSet (const FcPattern *p, FcObject object, int n, FcCharSet **c);
|
2005-11-25 04:00:51 +01:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcResult
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectGetBool (const FcPattern *p, FcObject object, int n, FcBool *b);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcResult
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectGetLangSet (const FcPattern *p, FcObject object, int n, FcLangSet **ls);
|
|
|
|
|
2013-11-20 10:44:59 +01:00
|
|
|
FcPrivate FcResult
|
|
|
|
FcPatternObjectGetRange (const FcPattern *p, FcObject object, int id, FcRange **r);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternAppend (FcPattern *p, FcPattern *s);
|
|
|
|
|
2015-06-09 04:15:25 +02:00
|
|
|
FcPrivate int
|
|
|
|
FcPatternPosition (const FcPattern *p, const char *object);
|
|
|
|
|
2018-05-11 13:48:30 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcPatternFindObjectIter (const FcPattern *pat, FcPatternIter *iter, FcObject object);
|
|
|
|
|
|
|
|
FcPrivate FcObject
|
|
|
|
FcPatternIterGetObjectId (const FcPattern *pat, FcPatternIter *iter);
|
|
|
|
|
|
|
|
FcPrivate FcValueListPtr
|
|
|
|
FcPatternIterGetValues (const FcPattern *pat, FcPatternIter *iter);
|
|
|
|
|
2018-05-23 15:15:33 +02:00
|
|
|
FcPrivate FcPattern *
|
|
|
|
FcPatternCacheRewriteFile (const FcPattern *pat, FcCache *cache, const FcChar8 *relocated_font_file);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar32
|
2006-08-30 13:16:22 +02:00
|
|
|
FcStringHash (const FcChar8 *s);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat);
|
2005-06-28 05:41:02 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcPattern *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat);
|
2005-07-25 06:10:09 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *pat);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcValueList *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcValueListSerialize (FcSerialize *serialize, const FcValueList *pat);
|
2005-07-25 06:10:09 +02:00
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fcrender.c */
|
|
|
|
|
|
|
|
/* fcmatrix.c */
|
2002-07-28 12:50:59 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
extern FcPrivate const FcMatrix FcIdentityMatrix;
|
2002-07-28 12:50:59 +02:00
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-02-15 00:34:13 +01:00
|
|
|
FcMatrixFree (FcMatrix *mat);
|
|
|
|
|
2013-11-20 10:44:59 +01:00
|
|
|
/* fcrange.c */
|
|
|
|
|
|
|
|
FcPrivate FcRange *
|
|
|
|
FcRangePromote (double v, FcValuePromotionBuffer *vbuf);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcRangeIsInRange (const FcRange *a, const FcRange *b);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcRangeCompare (FcOp op, const FcRange *a, const FcRange *b);
|
|
|
|
|
|
|
|
FcPrivate FcChar32
|
|
|
|
FcRangeHash (const FcRange *r);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcRangeSerializeAlloc (FcSerialize *serialize, const FcRange *r);
|
|
|
|
|
|
|
|
FcPrivate FcRange *
|
|
|
|
FcRangeSerialize (FcSerialize *serialize, const FcRange *r);
|
|
|
|
|
2012-04-29 12:56:16 +02:00
|
|
|
/* fcstat.c */
|
|
|
|
|
|
|
|
FcPrivate int
|
|
|
|
FcStat (const FcChar8 *file, struct stat *statb);
|
|
|
|
|
2012-05-28 07:52:21 +02:00
|
|
|
FcPrivate int
|
|
|
|
FcStatChecksum (const FcChar8 *file, struct stat *statb);
|
|
|
|
|
2012-05-28 06:59:48 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcIsFsMmapSafe (int fd);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcIsFsMtimeBroken (const FcChar8 *dir);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
/* fcstr.c */
|
2016-01-09 03:06:31 +01:00
|
|
|
FcPrivate FcStrSet *
|
|
|
|
FcStrSetCreateEx (unsigned int control);
|
|
|
|
|
2012-03-29 13:25:20 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcStrSetAddLangs (FcStrSet *strs, const char *languages);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2005-06-28 05:41:02 +02:00
|
|
|
FcStrSetSort (FcStrSet * set);
|
|
|
|
|
2019-04-03 06:48:42 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcStrSetMemberAB (FcStrSet *set, const FcChar8 *a, FcChar8 *b, FcChar8 **ret);
|
|
|
|
|
Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
FcPrivate FcBool
|
2019-01-31 11:17:47 +01:00
|
|
|
FcStrSetAddTriple (FcStrSet *set, const FcChar8 *a, const FcChar8 *b, const FcChar8 *c);
|
Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
|
2019-01-31 11:17:47 +01:00
|
|
|
FcPrivate const FcChar8 *
|
|
|
|
FcStrTripleSecond (FcChar8 *s);
|
|
|
|
|
|
|
|
FcPrivate const FcChar8 *
|
|
|
|
FcStrTripleThird (FcChar8 *str);
|
Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
|
|
|
|
FcPrivate FcBool
|
2019-01-31 11:17:47 +01:00
|
|
|
FcStrSetAddFilenamePairWithSalt (FcStrSet *strs, const FcChar8 *d, const FcChar8 *m, const FcChar8 *salt);
|
Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
|
2019-01-31 08:52:09 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcStrSetDeleteAll (FcStrSet *set);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-02-18 23:29:28 +01:00
|
|
|
FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate void
|
2002-02-18 23:29:28 +01:00
|
|
|
FcStrBufDestroy (FcStrBuf *buf);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar8 *
|
2002-02-18 23:29:28 +01:00
|
|
|
FcStrBufDone (FcStrBuf *buf);
|
|
|
|
|
2009-03-11 19:07:15 +01:00
|
|
|
FcPrivate FcChar8 *
|
|
|
|
FcStrBufDoneStatic (FcStrBuf *buf);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-02-18 23:29:28 +01:00
|
|
|
FcStrBufChar (FcStrBuf *buf, FcChar8 c);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-02-18 23:29:28 +01:00
|
|
|
FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2002-02-18 23:29:28 +01:00
|
|
|
FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate int
|
2002-07-07 01:47:44 +02:00
|
|
|
FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
|
|
|
|
|
2013-01-18 03:30:10 +01:00
|
|
|
FcPrivate int
|
|
|
|
FcStrCmpIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate const FcChar8 *
|
2003-05-02 03:11:53 +02:00
|
|
|
FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate const FcChar8 *
|
2003-05-02 03:11:53 +02:00
|
|
|
FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
|
|
|
|
|
2006-09-02 05:25:21 +02:00
|
|
|
FcPrivate const FcChar8 *
|
|
|
|
FcStrContainsWord (const FcChar8 *s1, const FcChar8 *s2);
|
|
|
|
|
2013-01-18 03:30:10 +01:00
|
|
|
FcPrivate int
|
|
|
|
FcStrMatchIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims);
|
|
|
|
|
2013-05-08 04:57:49 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcStrGlobMatch (const FcChar8 *glob,
|
|
|
|
const FcChar8 *string);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2003-03-02 20:12:23 +01:00
|
|
|
FcStrUsesHome (const FcChar8 *s);
|
|
|
|
|
2018-07-12 00:50:26 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcStrIsAbsoluteFilename (const FcChar8 *s);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar8 *
|
2003-03-22 22:25:34 +01:00
|
|
|
FcStrLastSlash (const FcChar8 *path);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar32
|
2004-12-29 10:15:17 +01:00
|
|
|
FcStrHashIgnoreCase (const FcChar8 *s);
|
|
|
|
|
2020-08-21 14:05:18 +02:00
|
|
|
FcPrivate FcChar32
|
|
|
|
FcStrHashIgnoreBlanksAndCase (const FcChar8 *s);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar8 *
|
2006-08-28 08:40:51 +02:00
|
|
|
FcStrCanonFilename (const FcChar8 *s);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcBool
|
2006-08-30 13:16:22 +02:00
|
|
|
FcStrSerializeAlloc (FcSerialize *serialize, const FcChar8 *str);
|
|
|
|
|
2006-09-04 09:47:07 +02:00
|
|
|
FcPrivate FcChar8 *
|
2006-08-30 13:16:22 +02:00
|
|
|
FcStrSerialize (FcSerialize *serialize, const FcChar8 *str);
|
|
|
|
|
2012-09-20 20:42:31 +02:00
|
|
|
/* fcobjs.c */
|
|
|
|
|
2015-05-22 09:53:34 +02:00
|
|
|
FcPrivate void
|
|
|
|
FcObjectFini (void);
|
|
|
|
|
2012-09-20 20:42:31 +02:00
|
|
|
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);
|
|
|
|
|
2017-11-15 08:10:49 +01:00
|
|
|
/* fchash.c */
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcHashStrCopy (const void *src,
|
|
|
|
void **dest);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcHashUuidCopy (const void *src,
|
|
|
|
void **dest);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcHashUuidFree (void *data);
|
|
|
|
|
|
|
|
FcPrivate FcHashTable *
|
|
|
|
FcHashTableCreate (FcHashFunc hash_func,
|
|
|
|
FcCompareFunc compare_func,
|
|
|
|
FcCopyFunc key_copy_func,
|
|
|
|
FcCopyFunc value_copy_func,
|
|
|
|
FcDestroyFunc key_destroy_func,
|
|
|
|
FcDestroyFunc value_destroy_func);
|
|
|
|
|
|
|
|
FcPrivate void
|
|
|
|
FcHashTableDestroy (FcHashTable *table);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcHashTableFind (FcHashTable *table,
|
|
|
|
const void *key,
|
|
|
|
void **value);
|
|
|
|
|
|
|
|
FcPrivate FcBool
|
|
|
|
FcHashTableAdd (FcHashTable *table,
|
|
|
|
void *key,
|
|
|
|
void *value);
|
|
|
|
|
2017-12-18 12:05:14 +01:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcHashTableReplace (FcHashTable *table,
|
|
|
|
void *key,
|
|
|
|
void *value);
|
2017-11-15 08:10:49 +01:00
|
|
|
|
2018-06-11 10:03:17 +02:00
|
|
|
FcPrivate FcBool
|
|
|
|
FcHashTableRemove (FcHashTable *table,
|
|
|
|
void *key);
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
#endif /* _FC_INT_H_ */
|