[vlc-commits] Freetype: correctly load fonts with complete path

Jean-Baptiste Kempf git at videolan.org
Tue Nov 1 13:31:49 CET 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Nov  1 13:29:38 2011 +0100| [4e27ee7bf9157bf744ba9949cfd1ac5b2efdfee2] | committer: Jean-Baptiste Kempf

Freetype: correctly load fonts with complete path

Close #5495

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

 modules/text_renderer/freetype.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index 00f2421..f9d2d77 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -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
 



More information about the vlc-commits mailing list