[vlc-commits] commit: Freetype: try to fix the fontconfig cache building bug on Win32 ( Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Mon Apr 26 23:54:37 CEST 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Apr 26 23:53:22 2010 +0200| [51f7b23eb1a0df5f5626c0111b4319b1f01d7eac] | committer: Jean-Baptiste Kempf 

Freetype: try to fix the fontconfig cache building bug on Win32

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=51f7b23eb1a0df5f5626c0111b4319b1f01d7eac
---

 modules/misc/freetype.c |   33 ++++++++-------------------------
 1 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index c84d351..2317fd7 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -351,45 +351,28 @@ static int Create( vlc_object_t *p_this )
     if( asprintf( &psz_fontsize, "%d", p_sys->i_default_font_size ) == -1 )
         goto error;
 
+
+    msg_Dbg( p_filter, "Building font databases.");
+    mtime_t t1, t2;
+    t1 = mdate();
+
 #ifdef WIN32
     dialog_progress_bar_t *p_dialog = NULL;
+    FcConfig *fcConfig = FcInitLoadConfig();
 
-    if( !FcConfigUptoDate( NULL ) )
-    {
-        p_dialog = dialog_ProgressCreate( p_filter,
+    p_dialog = dialog_ProgressCreate( p_filter,
             _("Building font cache"),
             _("Please wait while your font cache is rebuilt.\n"
                 "This should take less than a few minutes."), NULL );
-    }
-    char *path = xmalloc( PATH_MAX + 1 );
-    /* Fontconfig doesnt seem to know where windows fonts are with
-     * current contribs. So just tell default windows font directory
-     * is the place to search fonts
-     */
-    GetWindowsDirectory( path, PATH_MAX + 1 );
-    strcat( path, "\\fonts" );
-    if( p_dialog )
-        dialog_ProgressSet( p_dialog, NULL, 0.4 );
-
-    FcConfigAppFontAddDir( NULL , path );
-    free(path);
-
 
     if( p_dialog )
         dialog_ProgressSet( p_dialog, NULL, 0.5 );
 #endif
-    mtime_t t1, t2;
-
-    msg_Dbg( p_filter, "Building font database.");
-    t1 = mdate();
-    FcConfigBuildFonts( NULL );
+    FcConfigBuildFonts( fcConfig );
     t2 = mdate();
-
-    msg_Dbg( p_filter, "Finished building font database." );
     msg_Dbg( p_filter, "Took %ld microseconds", (long)((t2 - t1)) );
 
     fontpattern = FcPatternCreate();
-
     if( !fontpattern )
     {
         msg_Err( p_filter, "Creating fontpattern failed");



More information about the vlc-commits mailing list