[Fontconfig] fontconfig: Branch 'master'

Jeremy Huddleston Sequoia jeremyhu at freedesktop.org
Thu Nov 7 22:32:53 PST 2013


Unfortunately, I think this change doesn't really address the case on OS X because /Library/Fonts will have subdirs if the user installed MS Office.  Culled from my previous email:

/Library/Fonts: skipping, existing cache is valid: 505 fonts, 1 dirs
/Library/Fonts/Microsoft: skipping, existing cache is valid: 207 fonts, 0 dirs
...
/Library/Fonts: caching, new cache contents: 505 fonts, 1 dirs

--Jeremy

On Nov 5, 2013, at 3:31, Akira TAGOH <tagoh at kemper.freedesktop.org> wrote:

> fc-cache/fc-cache.c |   26 ++++++++++++++++++--------
> 1 file changed, 18 insertions(+), 8 deletions(-)
> 
> New commits:
> commit a4443e64c89256087d40462cfbb482950873e366
> Author: Akira TAGOH <akira at tagoh.org>
> Date:   Tue Nov 5 20:30:35 2013 +0900
> 
>    Re-scan font directories only when it contains subdirs
> 
>    Somewhat improves the performance but still need to think about for the situation
>    where both directories and fonts are in.
> 
> diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
> index af7ba6d..27c7513 100644
> --- a/fc-cache/fc-cache.c
> +++ b/fc-cache/fc-cache.c
> @@ -118,7 +118,7 @@ usage (char *program, int error)
> static FcStrSet *processed_dirs;
> 
> static int
> -scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, FcBool verbose, FcBool recursive, int *changed)
> +scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, FcBool verbose, FcBool recursive, int *changed, FcStrSet *updateDirs)
> {
>     int		    ret = 0;
>     const FcChar8   *dir;
> @@ -137,7 +137,10 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
>     {
> 	if (verbose)
> 	{
> -	    printf ("%s: ", dir);
> +	    if (!recursive)
> +		printf ("Re-scanning %s: ", dir);
> +	    else
> +		printf ("%s: ", dir);
> 	    fflush (stdout);
> 	}
> 	
> @@ -226,6 +229,8 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
> 	    }
> 	    for (i = 0; i < FcCacheNumSubdir (cache); i++)
> 		FcStrSetAdd (subdirs, FcCacheSubdir (cache, i));
> +	    if (updateDirs && FcCacheNumSubdir (cache) > 0)
> +		FcStrSetAdd (updateDirs, dir);
> 	
> 	    FcDirCacheUnload (cache);
> 	
> @@ -238,7 +243,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
> 		continue;
> 	    }
> 	    FcStrSetAdd (processed_dirs, dir);
> -	    ret += scanDirs (sublist, config, force, really_force, verbose, recursive, changed);
> +	    ret += scanDirs (sublist, config, force, really_force, verbose, recursive, changed, updateDirs);
> 	    FcStrListDone (sublist);
> 	}
> 	else
> @@ -271,7 +276,7 @@ cleanCacheDirectories (FcConfig *config, FcBool verbose)
> int
> main (int argc, char **argv)
> {
> -    FcStrSet	*dirs;
> +    FcStrSet	*dirs, *updateDirs;
>     FcStrList	*list;
>     FcBool    	verbose = FcFalse;
>     FcBool	force = FcFalse;
> @@ -369,13 +374,18 @@ main (int argc, char **argv)
> 	fprintf(stderr, "Cannot malloc\n");
> 	return 1;
>     }
> -	
> +
> +    updateDirs = FcStrSetCreate ();
>     changed = 0;
> -    ret = scanDirs (list, config, force, really_force, verbose, FcTrue, &changed);
> +    ret = scanDirs (list, config, force, really_force, verbose, FcTrue, &changed, updateDirs);
>     /* Update the directory cache again to avoid the race condition as much as possible */
> -    FcStrListFirst (list);
> -    ret += scanDirs (list, config, FcTrue, really_force, verbose, FcFalse, &changed);
>     FcStrListDone (list);
> +    list = FcStrListCreate (updateDirs);
> +    if (list)
> +    {
> +	ret += scanDirs (list, config, FcTrue, really_force, verbose, FcFalse, &changed, NULL);
> +	FcStrListDone (list);
> +    }
> 
>     /*
>      * Try to create CACHEDIR.TAG anyway.
> _______________________________________________
> Fontconfig mailing list
> Fontconfig at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/fontconfig
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4154 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20131107/94f5c9e2/attachment.bin>


More information about the Fontconfig mailing list