[Fontconfig] Finding a font but without fallback
pierremarc at oep-h.com
Sat Apr 26 16:50:36 PDT 2008
Vous (Keith Packard) avez écrit :
> I hope you realize what a performance cost this is -- fontconfig has
> been designed to cache information about fonts reasonably efficiently;
> on my system with 3382 font files, 'fc-list foo', which reads the entire
> database scanning it for any fonts named 'foo', takes 19ms.
I know how Fontconfig is good in this field and more generally takes care of
these things. It is just that dealing with uninstalled fonts, I already had
a function for scanning directories. So when someone asked for, at least,
having the system fonts in "read-only" mode listed in the application
(without the possibility to deactivate them) I reused the same function.
> If fontconfig doesn't provide the interface you need, please build what
> you want and let us see it. We can't fix the library if you continue to
> work around it.
To be honest, I actually think that using Fontconfig the way we do comes to
pervert it :-) Though not in how we grab the system fonts list because I do
it just once at program startup, but rather the way we "activate" fonts (ie
sym-links into a directory for which we write a DIR element in ~/.fonts.conf)
and thus we maintain our own database, that’s bad.
But when I tried to base all the activation on Fontconfig by means of
SELECTFONT, REJECTFONT & ACCEPTFONT I had some issues I could not overcome
and at this point nobody was interested to help. It’s not a problem since
we’re at the very beginning of the development and have time to
refine^^rewrite the code.
Finally, for the moment, the only feature we would want is a font channel on
DBUS (or something similar) to activate/deactivate, lock/unlock fonts, etc.
Or is it the only thing I can think at by now? We’ll see!
More information about the Fontconfig