Freetype: correctly load fonts with complete path
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 1 Nov 2011 12:29:38 +0000 (13:29 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 1 Nov 2011 12:29:38 +0000 (13:29 +0100)
Close #5495

modules/text_renderer/freetype.c

index 00f2421..f9d2d77 100644 (file)
@@ -616,10 +616,19 @@ static char* Win32_Select( filter_t *p_filter, const char* family,
     i_idx = 0;
 
     /* */
-    char *psz_tmp;
-    if( asprintf( &psz_tmp, "%s\\%s", p_filter->p_sys->psz_win_fonts_path, psz_filename ) == -1 )
-        return NULL;
-    return psz_tmp;
+    if( strchr( psz_filename, DIR_SEP_CHAR ) )
+        return psz_filename;
+    else
+    {
+        char *psz_tmp;
+        if( asprintf( &psz_tmp, "%s\\%s", p_filter->p_sys->psz_win_fonts_path, psz_filename ) == -1 )
+        {
+            free( psz_filename );
+            return NULL;
+        }
+        free( psz_filename );
+        return psz_tmp;
+    }
 }
 #endif