changeset 216:338b5664ea13

Search font files in ~/.mplayer/font/ instead of current dir
author lgb
date Mon, 26 Mar 2001 17:16:27 +0000
parents 09d565842a33
children cb3b0d65dddd
files libvo/font_load.c
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/font_load.c	Sun Mar 25 20:38:14 2001 +0000
+++ b/libvo/font_load.c	Mon Mar 26 17:16:27 2001 +0000
@@ -5,6 +5,8 @@
 
 #include "font_load.h"
 
+char *get_path ( char * );
+
 raw_file* load_raw(char *name){
     int bpp;
     raw_file* raw=malloc(sizeof(raw_file));
@@ -107,17 +109,31 @@
   
   if(strcmp(section,"[files]")==0){
       if(pdb==2 && strcmp(p[0],"alpha")==0){
-          if(!((desc->pic_a[fontdb]=load_raw(p[1])))){
+    	  char *cp=get_path("font/");
+	  char *cp2=malloc(strlen(cp)+strlen(p[1])+1);
+	  sprintf(cp2,"%s%s",cp,p[1]);
+          if(!((desc->pic_a[fontdb]=load_raw(cp2)))){
                 printf("Can't load font bitmap: %s\n",p[1]);
+		free(cp);
+		free(cp2);
                 return NULL;
           }
+	  free(cp);
+	  free(cp2);
           continue;
       }
       if(pdb==2 && strcmp(p[0],"bitmap")==0){
-          if(!((desc->pic_b[fontdb]=load_raw(p[1])))){
+    	  char *cp=get_path("font/");
+	  char *cp2=malloc(strlen(cp)+strlen(p[1])+1);
+	  sprintf(cp2,"%s%s",cp,p[1]);
+          if(!((desc->pic_b[fontdb]=load_raw(cp2)))){
                 printf("Can't load font bitmap: %s\n",p[1]);
+		free(cp);
+		free(cp2);
                 return NULL;
           }
+	  free(cp);
+	  free(cp2);
           continue;
       }
   } else