# HG changeset patch # User atlka # Date 1003227244 0 # Node ID ddf897c38fb1d6686f05f7b0897fce749072cb09 # Parent 9fd911c931cdbe320a10cc0baa22f5020df717be read font files from the same dir as font.desc or as specified in font.desc diff -r 9fd911c931cd -r ddf897c38fb1 libvo/font_load.c --- a/libvo/font_load.c Tue Oct 16 02:31:14 2001 +0000 +++ b/libvo/font_load.c Tue Oct 16 10:14:04 2001 +0000 @@ -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 -if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font"; +// desc->fpath=get_path("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; }