diff options
Diffstat (limited to 'ufondbdf.c')
-rw-r--r-- | ufondbdf.c | 33 |
1 files changed, 23 insertions, 10 deletions
@@ -233,10 +233,16 @@ static void ParseBdfHeader(struct macfont *macfont, struct bdffont *bdf) { static int ParseCharWidths(struct macfont *macfont,int ch,char **chlist,int loc) { int pwidth=0, swidth=0, gwidth=0, lb=0; - - sscanf(chlist[2],"SWIDTH %d", &swidth ); - sscanf(chlist[3],"DWIDTH %d", &pwidth ); - sscanf(chlist[4],"BBX %d %*d %d", &gwidth, &lb ); + int i; + + for ( i=0 ; chlist[i]!=NULL; ++i ) { + if ( strncmp(chlist[i],"SWIDTH", 6)==0 ) + sscanf(chlist[i],"SWIDTH %d", &swidth ); + else if ( strncmp(chlist[i],"DWIDTH", 6)==0 ) + sscanf(chlist[i],"DWIDTH %d", &pwidth ); + else if ( strncmp(chlist[i],"BBX", 3)==0 ) + sscanf(chlist[i],"BBX %d %*d %d", &gwidth, &lb ); + } macfont->widths[ch] = pwidth; macfont->lbearings[ch] = lb; @@ -310,13 +316,20 @@ return; } static void ParseBitmap(struct macfont *macfont,int ch,char **chlist) { - int height, descent, ascent,off,i; + int height, descent, ascent,off,i, base; - sscanf(chlist[4],"BBX %*d %d %*d %d", &height, &descent ); - ascent = height+descent; - off = macfont->ascent-ascent; - for ( i=0; i<height; ++i ) - ParseRow(macfont,ch,i+off,chlist[i+6]); + for ( base=0 ; chlist[base]!=NULL; ++base ) { + if ( strncmp(chlist[base],"BBX",3)==0 ) + sscanf(chlist[base],"BBX %*d %d %*d %d", &height, &descent ); + else if ( strncmp(chlist[base],"BITMAP",6)==0 ) + break; + } + if ( chlist[base]!=NULL ) { + ascent = height+descent; + off = macfont->ascent-ascent; + for ( i=0; i<height; ++i ) + ParseRow(macfont,ch,i+off,chlist[i+base+1]); + } } static void DummyUpFakeBitmap(struct macfont *macfont,int ch) { |