[Fontconfig] Re: fc-cache sometimes looses fonts
plam at MIT.EDU
Tue Nov 1 06:27:37 EST 2005
James Cloos wrote:
>>>>>>"Patrick" == Patrick Lam <plam at MIT.EDU> writes:
> Patrick> I think it's one per directory; after all, all fonts in the
> Patrick> same directory have the same pathname!
> Somehow as I was writing that missive I was thinking that the string
> passed to open(2) would have to remain around. Obviously it can be
> free(2)d, so that isn't really an issue.
Well, I need to keep one copy around per directory, but that should be
enough, and not that much of a memory drain.
> Patrick> FcPattern contains a 'bank' field which will tell you about
> Patrick> the directory, and then I just set up a hash table or
> Patrick> something which returns the pathname of that directory. How
> Patrick> does that sound?
> For new code that does seem right, but how does that work for existing
> code? Will the lib need to bump it's version number? It would be
> cool if it would work with existing pango apps. And w/o having to
> recompile the whole system....
So I was suggesting this slightly evil thing. If you call
FcPatternGetString for an FC_FILE, then fontconfig will silently append
the path of the cache file to the path of the file. (I guess I'll also
add a pointer to the FcPattern for the path, but that's not visible
outside fontconfig). If you call FcPatternGetString for anything else,
nothing changes. The result is that no changes are visible from the
outside; no version number bumping or recompilation required.
More information about the Fontconfig