[Fontconfig] please sort fonts.cache entries
plam at MIT.EDU
Thu Mar 2 12:11:57 PST 2006
Egmont Koblinger wrote:
> I don't know if my request is still relevant with the new fonts.cache-2
> binary format, since I haven't looked at the binary format, but I guess it
> is relevant.
As far as I can tell, it'll make it an even worse problem, because you
can't easily tweak the fonts.cache files to fix the problem.
> In other words: please make
> sure that the directories are scanned in a deterministic way (e.g. according
> to the standard LC_ALL=C string sorting) or the resulted cache files are
> sorted before being written.
> I believe that implementing this isn't too hard, and the performance
> regression caused by this is negligible (especially compared to the sleep(2)
> in fc-config :-))))
I can see two ways of doing this.
1. fix the loop in fcdir.c lines 177-184 so that it records the set of
files, sorts them, and then calls FcFileScanConfig on each one in sorted
2. sort the fonts at line 142 of fcfs.c before serializing them.
However, it's not clear to me how to sort fonts in general.
If you could write a patch that uses an FcStrSet to record the filenames
in lines 177-184, that would be great. Otherwise it might take me a
couple of days to get to it.
More information about the Fontconfig