summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Williams <gww@silcom.com>2004-12-23 02:47:12 +0000
committerGeorge Williams <gww@silcom.com>2004-12-23 02:47:12 +0000
commita8139580a8d40bb09215ed48a46c0d40878fb28a (patch)
treed2012f6c51404cf27ce51ca4e080c3d54b608d09
parent0fc81b08c9c3c5472927f0fe0f5a3de8cdbd7048 (diff)
Neil Parker points out that some FOND resources contain stringoffsets which point to string 0. But there is no string 0. This must mean a non-existant style. We used to crash on this.
-rw-r--r--fondu.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fondu.c b/fondu.c
index 8f9ab7d..ef56bb5 100644
--- a/fondu.c
+++ b/fondu.c
@@ -175,7 +175,8 @@ static void ProcessNestedPS( char *fontname, char *origfilename, PSFONT *psfont
}
if ( psfont!=NULL && psfont->fontname==NULL ) {
char *pt = strrchr(filename,'.');
- if ( pt!=NULL ) *pt = '\0';
+ char *ept = strrchr(filename,'/');
+ if ( pt!=NULL && pt>ept ) *pt = '\0';
fprintf( stderr, "Failed to find file %s when searching for a postscript resource\n", filename );
}
free(filename);
@@ -258,7 +259,7 @@ static void MakeAfmFiles(FOND *fond,FILE *f, int isfixed,char *origfilename) {
fprintf( afm, "Comment Caveat: This does not contain all the information generally found in an AFM file\n" );
fprintf( afm, "Comment Generated by Fondu from a mac FOND resource\n" );
time(&now);
- fprintf( afm, "Comment Creation Data: %s", ctime(&now) );
+ fprintf( afm, "Comment Creation Date: %s", ctime(&now) );
fprintf( afm, "FontName %s\n", fontname );
fprintf( afm, "FamilyName %s\n", familyname );
fprintf( afm, "IsFixedPitch %s\n", isfixed?"true":"false");
@@ -494,7 +495,7 @@ static FOND *BuildFondList(FILE *f,long rlistpos,int subcnt,long rdata_pos,
for ( k=j-1; k>=0; --k )
if ( stringoffsets[j]==stringoffsets[k] )
break;
- if ( k!=-1 )
+ if ( k!=-1 || stringoffsets[j]==0 )
continue; /* this style doesn't exist */
format = stringoffsets[j]-1;
strlen = strings[0][0];