int size;
} FcStrBuf;
-typedef struct _FcFileCacheEnt {
- struct _FcFileCacheEnt *next;
- unsigned int hash;
- FcChar8 *file;
- int id;
- time_t time;
- FcChar8 *name;
- FcBool referenced;
-} FcFileCacheEnt;
-
-#define FC_FILE_CACHE_HASH_SIZE 509
-
-struct _FcFileCache {
- FcFileCacheEnt *ents[FC_FILE_CACHE_HASH_SIZE];
- FcBool updated;
- int entries;
- int referenced;
-};
+/*
+ * The per-user ~/.fonts.cache file is loaded into
+ * this data structure. Each directory gets a substructure
+ * which is validated by comparing the directory timestamp with
+ * that saved in the cache. When valid, the entire directory cache
+ * can be immediately loaded without reading the directory. Otherwise,
+ * the files are checked individually; updated files are loaded into the
+ * cache which is then rewritten to the users home directory
+ */
+
+#define FC_GLOBAL_CACHE_DIR_HASH_SIZE 37
+#define FC_GLOBAL_CACHE_FILE_HASH_SIZE 67
+
+typedef struct _FcGlobalCacheInfo {
+ unsigned int hash;
+ FcChar8 *file;
+ time_t time;
+ FcBool referenced;
+} FcGlobalCacheInfo;
+
+typedef struct _FcGlobalCacheFile {
+ struct _FcGlobalCacheFile *next;
+ FcGlobalCacheInfo info;
+ int id;
+ FcChar8 *name;
+} FcGlobalCacheFile;
+
+typedef struct _FcGlobalCacheSubdir {
+ struct _FcGlobalCacheSubdir *next;
+ FcChar8 *file;
+} FcGlobalCacheSubdir;
+
+typedef struct _FcGlobalCacheDir {
+ struct _FcGlobalCacheDir *next;
+ FcGlobalCacheInfo info;
+ int len;
+ FcGlobalCacheFile *ents[FC_GLOBAL_CACHE_FILE_HASH_SIZE];
+ FcGlobalCacheSubdir *subdirs;
+} FcGlobalCacheDir;
+
+typedef struct _FcGlobalCache {
+ FcGlobalCacheDir *ents[FC_GLOBAL_CACHE_DIR_HASH_SIZE];
+ FcBool updated;
+ FcBool broken;
+ int entries;
+ int referenced;
+} FcGlobalCache;
struct _FcAtomic {
FcChar8 *file; /* original file name */
/* fccache.c */
-FcFileCache *
-FcFileCacheCreate (void);
+FcGlobalCache *
+FcGlobalCacheCreate (void);
-FcChar8 *
-FcFileCacheFind (FcFileCache *cache,
- const FcChar8 *file,
- int id,
- int *count);
+void
+FcGlobalCacheDestroy (FcGlobalCache *cache);
+
+FcBool
+FcGlobalCacheCheckTime (FcGlobalCacheInfo *info);
void
-FcFileCacheDestroy (FcFileCache *cache);
+FcGlobalCacheReferenced (FcGlobalCache *cache,
+ FcGlobalCacheInfo *info);
+
+FcGlobalCacheDir *
+FcGlobalCacheDirGet (FcGlobalCache *cache,
+ const FcChar8 *dir,
+ int len,
+ FcBool create_missing);
FcBool
-FcFileCacheValid (const FcChar8 *cache_file);
+FcGlobalCacheScanDir (FcFontSet *set,
+ FcStrSet *dirs,
+ FcGlobalCache *cache,
+ const FcChar8 *dir);
+
+FcGlobalCacheFile *
+FcGlobalCacheFileGet (FcGlobalCache *cache,
+ const FcChar8 *file,
+ int id,
+ int *count);
+
void
-FcFileCacheLoad (FcFileCache *cache,
- const FcChar8 *cache_file);
+FcGlobalCacheLoad (FcGlobalCache *cache,
+ const FcChar8 *cache_file);
FcBool
-FcFileCacheUpdate (FcFileCache *cache,
- const FcChar8 *file,
- int id,
- const FcChar8 *name);
+FcGlobalCacheUpdate (FcGlobalCache *cache,
+ const FcChar8 *file,
+ int id,
+ const FcChar8 *name);
FcBool
-FcFileCacheSave (FcFileCache *cache,
- const FcChar8 *cache_file);
+FcGlobalCacheSave (FcGlobalCache *cache,
+ const FcChar8 *cache_file);
FcBool
-FcFileCacheReadDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *cache_file);
+FcDirCacheValid (const FcChar8 *cache_file);
FcBool
-FcFileCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *cache_file);
+FcDirCacheReadDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir);
+
+FcBool
+FcDirCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir);
/* fccfg.c */
/* fcrender.c */
/* fcmatrix.c */
+
+extern const FcMatrix FcIdentityMatrix;
+
void
FcMatrixFree (FcMatrix *mat);