X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=src%2Ffcint.h;h=3b9f3c852697c7259a00ce006a21cf8278a67028;hb=c2c6976d1a88cc35143ffcc34f3c38d0a28d34f4;hp=2f656cb2d84bb93565eaf9677d15a776011bdc93;hpb=7ce196733129b0e664c1bdc20f973f15167292f7;p=fontconfig.git diff --git a/src/fcint.h b/src/fcint.h index 2f656cb..3b9f3c8 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -55,7 +55,6 @@ #define FC_FONT_FILE_INVALID ((FcChar8 *) ".") #define FC_FONT_FILE_DIR ((FcChar8 *) ".dir") -#define FC_GLOBAL_MAGIC_COOKIE "GLOBAL" #ifdef _WIN32 #define FC_SEARCH_PATH_SEPARATOR ';' @@ -75,6 +74,7 @@ #define FC_DBG_MEMORY 512 #define FC_DBG_CONFIG 1024 #define FC_DBG_LANGSET 2048 +#define FC_DBG_OBJTYPES 4096 #define FC_MEM_CHARSET 0 #define FC_MEM_CHARLEAF 1 @@ -199,11 +199,12 @@ struct _FcPattern { #define FcPatternElts(p) FcOffsetMember(p,elts_offset,FcPatternElt) #define FcFontSetFonts(fs) FcPointerMember(fs,fonts,FcPattern *) -/* + #define FcFontSetFont(fs,i) (FcIsEncodedOffset((fs)->fonts) ? \ - FcOffsetToPtr(FcFontSetFonts(fs), \ - FcFontSetFonts(fs)[i]) : \ - fs->fonts[i])*/ + FcEncodedOffsetToPtr(fs, \ + FcFontSetFonts(fs)[i], \ + FcPattern) : \ + fs->fonts[i]) typedef enum _FcOp { FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet, @@ -306,8 +307,9 @@ typedef struct _FcStrBuf { } FcStrBuf; typedef struct _FcCache { - int magic; /* FC_CACHE_MAGIC */ - off_t size; /* size of file */ + int magic; /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */ + int version; /* FC_CACHE_CONTENT_VERSION */ + intptr_t size; /* size of file */ intptr_t dir; /* offset to dir name */ intptr_t dirs; /* offset to subdirs */ int dirs_count; /* number of subdir strings */ @@ -317,6 +319,9 @@ typedef struct _FcCache { #define FcCacheDir(c) FcOffsetMember(c,dir,FcChar8) #define FcCacheDirs(c) FcOffsetMember(c,dirs,intptr_t) #define FcCacheSet(c) FcOffsetMember(c,set,FcFontSet) +#define FcCacheSubdir(c,i) FcOffsetToPtr (FcCacheDirs(cache),\ + FcCacheDirs(cache)[i], \ + FcChar8) /* * Used while constructing a directory cache object @@ -330,8 +335,11 @@ typedef struct _FcSerializeBucket { intptr_t offset; } FcSerializeBucket; +typedef struct _FcCharSetFreezer FcCharSetFreezer; + typedef struct _FcSerialize { intptr_t size; + FcCharSetFreezer *cs_freezer; void *linear; FcSerializeBucket *buckets[FC_SERIALIZE_HASH_SIZE]; } FcSerialize; @@ -388,8 +396,9 @@ typedef struct _FcCaseFold { #define fc_alignof(type) offsetof (struct { char c; type member; }, member) -#define FC_CACHE_MAGIC 0xFC02FC04 -#define FC_CACHE_MAGIC_COPY 0xFC02FC05 +#define FC_CACHE_MAGIC_MMAP 0xFC02FC04 +#define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 +#define FC_CACHE_CONTENT_VERSION 1 struct _FcAtomic { FcChar8 *file; /* original file name */ @@ -404,6 +413,11 @@ struct _FcBlanks { FcChar32 *blanks; }; +typedef struct _FcCacheList { + struct _FcCacheList *next; + FcCache *cache; +} FcCacheList; + struct _FcConfig { /* * File names loaded from the configuration -- saved here as the @@ -411,7 +425,6 @@ struct _FcConfig { * and those directives may occur in any order */ FcStrSet *configDirs; /* directories to scan for fonts */ - FcChar8 *cache; /* name of per-user cache file */ /* * Set of allowed blank chars -- used to * trim fonts of bogus glyphs @@ -439,6 +452,7 @@ struct _FcConfig { */ FcSubst *substPattern; /* substitutions for patterns */ FcSubst *substFont; /* substitutions for fonts */ + FcSubst *substScan; /* substitutions for scanned fonts */ int maxObjects; /* maximum number of tests in all substs */ /* * List of patterns used to control font file selection @@ -454,6 +468,11 @@ struct _FcConfig { * match preferrentially */ FcFontSet *fonts[FcSetApplication + 1]; + /* + * Font cache information is mapped from cache files + * the configuration is destroyed, the files need to be unmapped + */ + FcCacheList *caches; /* * Fontconfig can periodically rescan the system configuration * and font directories. This rescanning occurs when font @@ -480,19 +499,30 @@ typedef struct _FcCharMap FcCharMap; /* fccache.c */ -FcFontSet * -FcCacheRead (FcConfig *config); +FcBool +FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config); + +void +FcDirCacheUnload (FcCache *cache); + +FcCache * +FcDirCacheScan (const FcChar8 *dir, FcConfig *config); + +FcCache * +FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file); + +FcCache * +FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat); FcBool -FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config); +FcDirCacheValid (const FcChar8 *dir); + +FcCache * +FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, FcStrSet *dirs); FcBool -FcDirCacheConsume (FILE *file, FcFontSet *set, FcStrSet *dirs, - const FcChar8 *dir, char *dirname); +FcDirCacheWrite (FcCache *cache, FcConfig *config); -FcBool -FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir, FcConfig *config); - /* fccfg.c */ FcBool @@ -518,10 +548,6 @@ FcBool FcConfigAddConfigFile (FcConfig *config, const FcChar8 *f); -FcBool -FcConfigSetCache (FcConfig *config, - const FcChar8 *c); - FcBool FcConfigAddBlank (FcConfig *config, FcChar32 blank); @@ -563,6 +589,10 @@ FcConfigAcceptFont (FcConfig *config, FcFileTime FcConfigModifiedTime (FcConfig *config); +FcBool +FcConfigAddCache (FcConfig *config, FcCache *cache); + +/* fcserialize.c */ intptr_t FcAlignSize (intptr_t size); @@ -594,11 +624,14 @@ FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l); void FcLangCharSetPopulate (void); -FcCharSet * -FcCharSetFreeze (FcCharSet *cs); +FcCharSetFreezer * +FcCharSetFreezerCreate (void); + +const FcCharSet * +FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs); void -FcCharSetThawAll (void); +FcCharSetFreezerDestroy (FcCharSetFreezer *freezer); FcBool FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c); @@ -665,17 +698,19 @@ FcFileScanConfig (FcFontSet *set, FcStrSet *dirs, FcBlanks *blanks, const FcChar8 *file, - FcBool force, FcConfig *config); FcBool FcDirScanConfig (FcFontSet *set, FcStrSet *dirs, FcBlanks *blanks, - const FcChar8 *dir, + const FcChar8 *dir, FcBool force, FcConfig *config); +FcCache * +FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config); + /* fcfont.c */ int FcFontDebug (void); @@ -784,6 +819,9 @@ FcNameParseLangSet (const FcChar8 *string); FcBool FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls); +FcChar8 * +FcNameUnparseEscaped (FcPattern *pat, FcBool escape); + /* fclist.c */ FcBool @@ -838,6 +876,7 @@ FcListPatternMatchAny (const FcPattern *p, #define FC_FONTFORMAT_OBJECT 37 #define FC_EMBOLDEN_OBJECT 38 #define FC_EMBEDDED_BITMAP_OBJECT 39 +#define FC_DECORATIVE_OBJECT 40 FcBool FcNameBool (const FcChar8 *v, FcBool *result); @@ -851,10 +890,13 @@ FcObjectFromName (const char * name); const char * FcObjectName (FcObject object); -#define FcObjectCompare(a, b) ((int) a - (int) b) +FcBool +FcObjectInit (void); void -FcObjectStaticNameFini (void); +FcObjectFini (void); + +#define FcObjectCompare(a, b) ((int) a - (int) b) /* fcpat.c */