Make the perf guys hate me a bit less: hoist the directory-name
FcConfigAcceptFont check for cached fonts up to directory cache read time, rather than running it for each font.
This commit is contained in:
parent
51af050992
commit
9fad72abaf
|
@ -1,3 +1,11 @@
|
|||
2005-11-29 Patrick Lam <plam@mit.edu>
|
||||
* src/fccfg.c (FcConfigBuildFonts):
|
||||
* src/fccache.c (FcCacheReadDirs):
|
||||
|
||||
Make the perf guys hate me a bit less: hoist the directory-name
|
||||
FcConfigAcceptFont check for cached fonts up to directory cache
|
||||
read time, rather than running it for each font.
|
||||
|
||||
2005-11-29 Patrick Lam <plam@mit.edu>
|
||||
* src/fccfg.c (FcConfigBuildFonts):
|
||||
* src/fcint.h:
|
||||
|
|
|
@ -624,6 +624,9 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
|
|||
*/
|
||||
while ((dir = FcStrListNext (list)))
|
||||
{
|
||||
if (!FcConfigAcceptFilename (config, dir))
|
||||
continue;
|
||||
|
||||
/* freed below */
|
||||
file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + FC_MAX_FILE_LEN + 1);
|
||||
if (!file)
|
||||
|
|
|
@ -308,13 +308,11 @@ FcConfigBuildFonts (FcConfig *config)
|
|||
|
||||
for (i = 0; i < cached_fonts->nfont; i++)
|
||||
{
|
||||
FcChar8 *cfn, *cfd;
|
||||
FcChar8 *cfn;
|
||||
FcPatternGetString (cached_fonts->fonts[i], FC_FILE, 0, &cfn);
|
||||
cfd = (FcChar8 *)FcCacheFindBankDir (cached_fonts->fonts[i]->bank);
|
||||
|
||||
if (FcConfigAcceptFont (config, cached_fonts->fonts[i]) &&
|
||||
(cfn && FcConfigAcceptFilename (config, cfn)) &&
|
||||
(cfd && FcConfigAcceptFilename (config, cfd)))
|
||||
(cfn && FcConfigAcceptFilename (config, cfn)))
|
||||
FcFontSetAdd (fonts, cached_fonts->fonts[i]);
|
||||
|
||||
cached_fonts->fonts[i] = 0; /* prevent free in FcFontSetDestroy */
|
||||
|
|
Loading…
Reference in New Issue