# HG changeset patch # User eugeni # Date 1154886961 0 # Node ID f0d49f38ce97006a53472f40e19d8a6d69e21361 # Parent 5717347573b5c27d2a50de83b0355b44ff133bba Use FontConfig cache to speedup mplayer startup. Patch by Zealot . diff -r 5717347573b5 -r f0d49f38ce97 libass/ass_fontconfig.c --- a/libass/ass_fontconfig.c Sun Aug 06 14:30:38 2006 +0000 +++ b/libass/ass_fontconfig.c Sun Aug 06 17:56:01 2006 +0000 @@ -152,6 +152,34 @@ return 0; } + if (FcDirCacheValid((const FcChar8 *)dir) == FcFalse) + { + FcFontSet* fcs; + FcStrSet* fss; + mp_msg(MSGT_GLOBAL, MSGL_INFO, "[ass] Updating font cache\n"); + fcs = FcFontSetCreate(); + fss = FcStrSetCreate(); + rc = FcStrSetAdd(fss, (const FcChar8*)dir); + if (!rc) { + mp_msg(MSGT_GLOBAL, MSGL_WARN, "FcStrSetAdd failed\n"); + goto ErrorFontCache; + } + + rc = FcDirScan(fcs, fss, NULL, FcConfigGetBlanks(priv->config), (const FcChar8 *)dir, FcFalse); + if (!rc) { + mp_msg(MSGT_GLOBAL, MSGL_WARN, "FcDirScan failed\n"); + goto ErrorFontCache; + } + + rc = FcDirSave(fcs, fss, (const FcChar8 *)dir); + if (!rc) { + mp_msg(MSGT_GLOBAL, MSGL_WARN, "FcDirSave failed\n"); + goto ErrorFontCache; + } + ErrorFontCache: + ; + } + rc = FcConfigAppFontAddDir(priv->config, (const FcChar8*)dir); if (!rc) { mp_msg(MSGT_GLOBAL, MSGL_WARN, "FcConfigAppFontAddDir failed\n");