On Wed, 30 Nov 2005, Patrick Lam wrote:
> Behdad Esfahbod wrote:
> > Hi,
> >
> > There''s a but report for Pango here:
> >
> > http://bugzilla.gnome.org/show_bug.cgi?id=89946
> >
> > that while being a user problem, can be fixed by fontconfig doing
> > these:
> >
> > 1) Not to include a config file more than once,
> > 2) Not to scan a directory more than once.
> >
> > Is it possible/easy to do that?
>
> Please send me a patch to FcConfigAddFontDir and FcConfigAddConfigFile
> in fccfg.c that ensure that no font dir or config file is added more
> than once. Keeping them in sorted order is one way to do that, a hash
> table is another way.
Seems like directories are not a problem, since they are added to
an FcSet (which is a real set) and processed later. For config
files, the attached patch simply returns true if the config file
has been added already. Patch is against branch.
> pat
--behdad
http://behdad.org/
"Commandment Three says Do Not Kill, Amendment Two says Blood Will
Spill"
-- Dan Bern, "New American Language"
-------------- next part --------------
? fontconfig-config-once.patch
Index: src/fcxml.c
==================================================================RCS file:
/cvs/fontconfig/fontconfig/src/fcxml.c,v
retrieving revision 1.37.4.9
diff -u -p -r1.37.4.9 fcxml.c
--- src/fcxml.c 18 Nov 2005 20:32:30 -0000 1.37.4.9
+++ src/fcxml.c 30 Nov 2005 22:06:29 -0000
@@ -2368,6 +2368,12 @@ FcConfigParseAndLoad (FcConfig *conf
if (!filename)
goto bail0;
+ if (FcStrSetMember (config->configFiles, filename))
+ {
+ FcStrFree (filename);
+ return FcTrue;
+ }
+
if (!FcStrSetAdd (config->configFiles, filename))
{
FcStrFree (filename);