Add documentation for FcConfigNormalizeFontDir.
Write directory information to global caches to fix make check (reported by Ronny V. Vindenes). This changes the global cache format again.
This commit is contained in:
parent
97293e07dd
commit
971cf18018
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2006-01-29 Patrick Lam <plam@mit.edu>
|
||||||
|
* doc/fcconfig.fncs:
|
||||||
|
Add documentation for FcConfigNormalizeFontDir.
|
||||||
|
|
||||||
|
* src/fccache.c (FcGlobalCacheDirDestroy, FcGlobalCacheLoad,
|
||||||
|
FcGlobalCacheUpdate, FcGlobalCacheSave):
|
||||||
|
* src/fcdir.c (FcDirScanConfig):
|
||||||
|
* src/fcint.h:
|
||||||
|
|
||||||
|
Write directory information to global caches to fix make check
|
||||||
|
(reported by Ronny V. Vindenes). This changes the global cache
|
||||||
|
format again.
|
||||||
|
|
||||||
2006-01-27 Patrick Lam <plam@mit.edu>
|
2006-01-27 Patrick Lam <plam@mit.edu>
|
||||||
* fc-cache/fc-cache.c (scanDirs):
|
* fc-cache/fc-cache.c (scanDirs):
|
||||||
* fontconfig/fontconfig.h:
|
* fontconfig/fontconfig.h:
|
||||||
|
|
|
@ -290,3 +290,14 @@ in 'config'. Any include files referenced from within 'file' will be loaded
|
||||||
with FcConfigLoad and also parsed. If 'complain' is FcFalse, no warning
|
with FcConfigLoad and also parsed. If 'complain' is FcFalse, no warning
|
||||||
will be displayed if 'file' does not exist.
|
will be displayed if 'file' does not exist.
|
||||||
@@
|
@@
|
||||||
|
|
||||||
|
@RET@ const FcChar8 *
|
||||||
|
@FUNC@ FcConfigNormalizeFontDir
|
||||||
|
@TYPE1@ FcConfig * @ARG1@ config
|
||||||
|
@TYPE2@ const FcChar8 * @ARG2@ dir
|
||||||
|
@PURPOSE@ normalize a font directory
|
||||||
|
@DESC@
|
||||||
|
Converts the directory name given in 'dir' to a normal form, i.e. one
|
||||||
|
of the forms which are derived from the font directories specified
|
||||||
|
in the config file.
|
||||||
|
@@
|
||||||
|
|
|
@ -157,6 +157,7 @@ FcCacheWriteString (int fd, const char *chars)
|
||||||
static void
|
static void
|
||||||
FcGlobalCacheDirDestroy (FcGlobalCacheDir *d)
|
FcGlobalCacheDirDestroy (FcGlobalCacheDir *d)
|
||||||
{
|
{
|
||||||
|
FcStrSetDestroy (d->subdirs);
|
||||||
FcMemFree (FC_MEM_STRING, strlen (d->name)+1);
|
FcMemFree (FC_MEM_STRING, strlen (d->name)+1);
|
||||||
free (d->name);
|
free (d->name);
|
||||||
FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheDir));
|
FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheDir));
|
||||||
|
@ -206,6 +207,7 @@ FcGlobalCacheLoad (FcGlobalCache *cache,
|
||||||
off_t current_arch_start;
|
off_t current_arch_start;
|
||||||
|
|
||||||
struct stat cache_stat, dir_stat;
|
struct stat cache_stat, dir_stat;
|
||||||
|
char subdirName[FC_MAX_FILE_LEN + 1 + 12 + 1];
|
||||||
|
|
||||||
if (stat ((char *) cache_file, &cache_stat) < 0)
|
if (stat ((char *) cache_file, &cache_stat) < 0)
|
||||||
return;
|
return;
|
||||||
|
@ -264,6 +266,11 @@ FcGlobalCacheLoad (FcGlobalCache *cache,
|
||||||
d->name = (char *)FcStrCopy ((FcChar8 *)name_buf);
|
d->name = (char *)FcStrCopy ((FcChar8 *)name_buf);
|
||||||
d->ent = 0;
|
d->ent = 0;
|
||||||
d->offset = lseek (cache->fd, 0, SEEK_CUR);
|
d->offset = lseek (cache->fd, 0, SEEK_CUR);
|
||||||
|
|
||||||
|
d->subdirs = FcStrSetCreate();
|
||||||
|
while (strlen(FcCacheReadString (cache->fd, subdirName, sizeof (subdirName))) > 0)
|
||||||
|
FcStrSetAdd (d->subdirs, (FcChar8 *)subdirName);
|
||||||
|
|
||||||
if (read (cache->fd, &d->metadata, sizeof (FcCache)) != sizeof (FcCache))
|
if (read (cache->fd, &d->metadata, sizeof (FcCache)) != sizeof (FcCache))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
targ = FcCacheNextOffset (lseek(cache->fd, 0, SEEK_CUR)) + d->metadata.count;
|
targ = FcCacheNextOffset (lseek(cache->fd, 0, SEEK_CUR)) + d->metadata.count;
|
||||||
|
@ -324,11 +331,13 @@ FcGlobalCacheReadDir (FcFontSet *set, FcStrSet *dirs, FcGlobalCache * cache, con
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcGlobalCacheUpdate (FcGlobalCache *cache,
|
FcGlobalCacheUpdate (FcGlobalCache *cache,
|
||||||
|
FcStrSet *dirs,
|
||||||
const char *name,
|
const char *name,
|
||||||
FcFontSet *set,
|
FcFontSet *set,
|
||||||
FcConfig *config)
|
FcConfig *config)
|
||||||
{
|
{
|
||||||
FcGlobalCacheDir * d;
|
FcGlobalCacheDir *d;
|
||||||
|
int i;
|
||||||
|
|
||||||
name = (char *)FcConfigNormalizeFontDir (config, (FcChar8 *)name);
|
name = (char *)FcConfigNormalizeFontDir (config, (FcChar8 *)name);
|
||||||
for (d = cache->dirs; d; d = d->next)
|
for (d = cache->dirs; d; d = d->next)
|
||||||
|
@ -351,6 +360,9 @@ FcGlobalCacheUpdate (FcGlobalCache *cache,
|
||||||
d->name = (char *)FcStrCopy ((FcChar8 *)name);
|
d->name = (char *)FcStrCopy ((FcChar8 *)name);
|
||||||
d->ent = FcDirCacheProduce (set, &d->metadata);
|
d->ent = FcDirCacheProduce (set, &d->metadata);
|
||||||
d->offset = 0;
|
d->offset = 0;
|
||||||
|
d->subdirs = FcStrSetCreate();
|
||||||
|
for (i = 0; i < dirs->num; i++)
|
||||||
|
FcStrSetAdd (d->subdirs, dirs->strs[i]);
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +371,7 @@ FcGlobalCacheSave (FcGlobalCache *cache,
|
||||||
const FcChar8 *cache_file,
|
const FcChar8 *cache_file,
|
||||||
FcConfig *config)
|
FcConfig *config)
|
||||||
{
|
{
|
||||||
int fd, fd_orig;
|
int fd, fd_orig, i;
|
||||||
FcGlobalCacheDir *dir;
|
FcGlobalCacheDir *dir;
|
||||||
FcAtomic *atomic;
|
FcAtomic *atomic;
|
||||||
off_t current_arch_start = 0, truncate_to;
|
off_t current_arch_start = 0, truncate_to;
|
||||||
|
@ -424,6 +436,10 @@ FcGlobalCacheSave (FcGlobalCache *cache,
|
||||||
truncate_to += sizeof (FcCache);
|
truncate_to += sizeof (FcCache);
|
||||||
truncate_to = FcCacheNextOffset (truncate_to);
|
truncate_to = FcCacheNextOffset (truncate_to);
|
||||||
truncate_to += dir->metadata.count;
|
truncate_to += dir->metadata.count;
|
||||||
|
|
||||||
|
for (i = 0; i < dir->subdirs->size; i++)
|
||||||
|
truncate_to += strlen((char *)dir->subdirs->strs[i]) + 1;
|
||||||
|
truncate_to ++;
|
||||||
}
|
}
|
||||||
truncate_to -= current_arch_start;
|
truncate_to -= current_arch_start;
|
||||||
|
|
||||||
|
@ -439,6 +455,11 @@ FcGlobalCacheSave (FcGlobalCache *cache,
|
||||||
const char * d = (const char *)FcConfigNormalizeFontDir (config, (const FcChar8 *)dir->name);
|
const char * d = (const char *)FcConfigNormalizeFontDir (config, (const FcChar8 *)dir->name);
|
||||||
|
|
||||||
FcCacheWriteString (fd, d);
|
FcCacheWriteString (fd, d);
|
||||||
|
|
||||||
|
for (i = 0; i < dir->subdirs->size; i++)
|
||||||
|
FcCacheWriteString (fd, (char *)dir->subdirs->strs[i]);
|
||||||
|
FcCacheWriteString (fd, "");
|
||||||
|
|
||||||
write (fd, &dir->metadata, sizeof(FcCache));
|
write (fd, &dir->metadata, sizeof(FcCache));
|
||||||
lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_CUR)), SEEK_SET);
|
lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_CUR)), SEEK_SET);
|
||||||
write (fd, dir->ent, dir->metadata.count);
|
write (fd, dir->ent, dir->metadata.count);
|
||||||
|
|
|
@ -194,7 +194,7 @@ FcDirScanConfig (FcFontSet *set,
|
||||||
* add the cache entry
|
* add the cache entry
|
||||||
*/
|
*/
|
||||||
if (ret && cache)
|
if (ret && cache)
|
||||||
FcGlobalCacheUpdate (cache, (char *)dir, tmpSet, config);
|
FcGlobalCacheUpdate (cache, dirs, (char *)dir, tmpSet, config);
|
||||||
|
|
||||||
for (i = 0; i < tmpSet->nfont; i++)
|
for (i = 0; i < tmpSet->nfont; i++)
|
||||||
FcFontSetAdd (set, tmpSet->fonts[i]);
|
FcFontSetAdd (set, tmpSet->fonts[i]);
|
||||||
|
|
|
@ -333,6 +333,7 @@ struct _FcGlobalCacheDir {
|
||||||
char *name;
|
char *name;
|
||||||
FcCache metadata;
|
FcCache metadata;
|
||||||
off_t offset;
|
off_t offset;
|
||||||
|
FcStrSet *subdirs;
|
||||||
void *ent;
|
void *ent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -447,6 +448,7 @@ FcGlobalCacheLoad (FcGlobalCache *cache,
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcGlobalCacheUpdate (FcGlobalCache *cache,
|
FcGlobalCacheUpdate (FcGlobalCache *cache,
|
||||||
|
FcStrSet *dirs,
|
||||||
const char *file,
|
const char *file,
|
||||||
FcFontSet *set,
|
FcFontSet *set,
|
||||||
FcConfig *config);
|
FcConfig *config);
|
||||||
|
|
Loading…
Reference in New Issue