changeset 2238:be4160d7db48

if not found using fpath try to load font bitmaps from default dir
author atlka
date Wed, 17 Oct 2001 15:15:30 +0000
parents 00a46cd41edd
children 9525c7d29543
files libvo/font_load.c
diffstat 1 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/font_load.c	Wed Oct 17 13:59:49 2001 +0000
+++ b/libvo/font_load.c	Wed Oct 17 15:15:30 2001 +0000
@@ -139,6 +139,7 @@
   } else    
 
   if(strcmp(section,"[files]")==0){
+      char *default_dir=DATADIR"/font";
       if(pdb==2 && strcmp(p[0],"alpha")==0){
     	  char *cp;
 	  if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) return NULL;
@@ -146,9 +147,16 @@
 	  snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s",
 		desc->fpath,p[1]);
           if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
-                printf("Can't load font bitmap: %s\n",p[1]);
 		free(cp);
-                return NULL;
+		if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) 
+		   return NULL;
+		snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s",
+			 default_dir,p[1]);
+		if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
+		   printf("Can't load font bitmap: %s\n",p[1]);
+		   free(cp);
+		   return NULL;
+		}
           }
 	  free(cp);
           continue;
@@ -160,9 +168,16 @@
 	  snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s",
 		desc->fpath,p[1]);
           if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
-                printf("Can't load font bitmap: %s\n",p[1]);
 		free(cp);
-                return NULL;
+		if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) 
+		   return NULL;
+		snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s",
+			 default_dir,p[1]);
+		if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
+		   printf("Can't load font bitmap: %s\n",p[1]);
+		   free(cp);
+		   return NULL;
+		}
           }
 	  free(cp);
           continue;