diff options
author | Patrick Lam <plam@MIT.EDU> | 2006-01-09 13:58:04 +0000 |
---|---|---|
committer | Patrick Lam <plam@MIT.EDU> | 2006-01-09 13:58:04 +0000 |
commit | cd9bca69702900ca9b24319c76b2dc9432bb548f (patch) | |
tree | 74881fd3fca3ac3726a1e0e55b47387d5dec9185 /src/fccfg.c | |
parent | 5576a5873dc9cd6e11234df6e64dbff18afe6378 (diff) |
Normalize font dirs by using the form, as given in fonts.conf, and recorded
in FcConfig's fontDirs string set, as canonical.
Actually update config.fontDirs as font directories are scanned.
Diffstat (limited to 'src/fccfg.c')
-rw-r--r-- | src/fccfg.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/fccfg.c b/src/fccfg.c index eefbca9..8b44948 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -388,6 +388,29 @@ FcConfigAddFontDir (FcConfig *config, return FcStrSetAddFilename (config->fontDirs, d); } +const FcChar8 * +FcConfigNormalizeFontDir (FcConfig *config, + const FcChar8 *d) +{ + /* If this is a bottleneck, we can cache the fontDir inodes. */ + ino_t di; + int n; + struct stat s; + + if (stat ((char *)d, &s) == -1) + return 0; + di = s.st_ino; + + for (n = 0; n < config->fontDirs->num; n++) + { + if (stat ((char *)config->fontDirs->strs[n], &s) == -1) + continue; + if (di == s.st_ino) + return config->fontDirs->strs[n]; + } + return 0; +} + FcBool FcConfigAddDir (FcConfig *config, const FcChar8 *d) |