[Fontconfig] icon theme weight query ... (fwd)

Patrick Lam plam at MIT.EDU
Mon Feb 6 06:22:55 PST 2006

Behdad Esfahbod wrote:
> Hi,
> Michael Meeks points a very inefficient read loop in fontconfig.
> Should be easy to fix...  Would have been easier in fact if
> fontconfig was mmapping the cache file right away...

Yes, fontconfig reads the header of the cache file one byte at a time.
The header tells fontconfig whether the cache file is global or not (so
that's one string) and about the sizes of things on that architecture
(another string).  There should be about 160 bytes this way, but since
it's a string, it's kind of hard to tell how many bytes there should be.
 The old fontconfig used getc, but that was less bad since it was on a

Hopefully Dirk will have a patch soon.  It should only need to change
FcCacheReadString.  There's a convenient 'len' parameter to
FcCacheReadString which would be useful in deciding how much to read, so
it should be something like this:

read (fd, dest, len);
// iterate though and replace \\ with \, etc
lseek (fd, strlen(dest)-len, SEEK_SET);


More information about the Fontconfig mailing list