[MPlayer-cvslog] r19346 - trunk/libass/ass_fontconfig.c

eugeni subversion at mplayerhq.hu
Sun Aug 6 19:56:01 CEST 2006


Author: eugeni
Date: Sun Aug  6 19:56:01 2006
New Revision: 19346

Modified:
   trunk/libass/ass_fontconfig.c

Log:
Use FontConfig cache to speedup mplayer startup.
Patch by Zealot <zealot0630 at gmail dot com>.


Modified: trunk/libass/ass_fontconfig.c
==============================================================================
--- trunk/libass/ass_fontconfig.c	(original)
+++ trunk/libass/ass_fontconfig.c	Sun Aug  6 19:56:01 2006
@@ -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");



More information about the MPlayer-cvslog mailing list