[Mplayer-cvslog] CVS: main/libvo font_load.c,1.18,1.19
Adam Tla/lka
atlka at mplayer.dev.hu
Tue Oct 16 12:14:18 CEST 2001
Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv27153/libvo
Modified Files:
font_load.c
Log Message:
read font files from the same dir as font.desc or as specified in font.desc
Index: font_load.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/font_load.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- font_load.c 6 Aug 2001 00:22:13 -0000 1.18
+++ font_load.c 16 Oct 2001 10:14:04 -0000 1.19
@@ -45,6 +45,7 @@
unsigned char sor2[1024];
font_desc_t *desc;
FILE *f;
+char *dn;
struct stat fstate;
char section[64];
int i,j;
@@ -57,9 +58,19 @@
f=fopen(fname,"rt");if(!f){ printf("font: can't open file: %s\n",fname); return NULL;}
-desc->fpath=get_path("font/");
+i = strlen (fname) - 9;
+if ((dn = malloc(i+1))!=NULL){
+ strncpy (dn, fname, i);
+ dn[i]='\0';
+}
+
+desc->fpath = dn; // search in the same dir as fonts.desc
+
+// desc->fpath=get_path("font/");
+// if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font";
+
+
-if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font";
// set up some defaults, and erase table
desc->charspace=2;
@@ -120,6 +131,8 @@
if(strcmp(section,"[fpath]")==0){
if(pdb==1){
+ if (desc->fpath)
+ free (desc->fpath); // release previously allocated memory
desc->fpath=strdup(p[0]);
continue;
}
More information about the MPlayer-cvslog
mailing list