summaryrefslogtreecommitdiff
path: root/src/fchash.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-10-29 16:39:05 -0700
committerAkira TAGOH <akira@tagoh.org>2019-04-03 12:02:09 +0000
commitc4324f54ee16e648ba91f3e9c66af13ab3b1754c (patch)
treedd64c4ac0bc6d628bf39cafabe1950578c2dfdbd /src/fchash.c
parent4cde12bfda1316e6d5464a2d9607d15322ef8024 (diff)
downloadfontconfig-c4324f54ee16e648ba91f3e9c66af13ab3b1754c.tar.gz
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>
Diffstat (limited to 'src/fchash.c')
-rw-r--r--src/fchash.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/fchash.c b/src/fchash.c
index 2f06f1a..481bf21 100644
--- a/src/fchash.c
+++ b/src/fchash.c
@@ -52,23 +52,6 @@ FcHashStrCopy (const void *src,
return *dest != NULL;
}
-FcBool
-FcHashUuidCopy (const void *src,
- void **dest)
-{
-#ifndef _WIN32
- *dest = malloc (sizeof (uuid_t));
- uuid_copy (*dest, src);
-#endif
- return FcTrue;
-}
-
-void
-FcHashUuidFree (void *data)
-{
- free (data);
-}
-
FcHashTable *
FcHashTableCreate (FcHashFunc hash_func,
FcCompareFunc compare_func,