diff options
-rw-r--r-- | showfond.c | 16 | ||||
-rw-r--r-- | ufond.c | 13 | ||||
-rw-r--r-- | ufondpfb.c | 2 |
3 files changed, 27 insertions, 4 deletions
@@ -70,7 +70,7 @@ static FOND *BuildFondList(FILE *f,long rlistpos,int subcnt,long rdata_pos, int ch1, ch2; int i, j, k, l, ch, rlen, cnt; FOND *head=NULL, *cur; - long widoff, kernoff, styleoff, bboff, offsetstart; + long widoff, kernoff, styleoff, bboff, offsetstart, glyphenc; fseek(f,rlistpos,SEEK_SET); for ( i=0; i<subcnt; ++i ) { @@ -220,7 +220,7 @@ static FOND *BuildFondList(FILE *f,long rlistpos,int subcnt,long rdata_pos, if ( class&0x80 ) printf( " 0x80 No auto-condense\n" ); if ( class&0x100 ) printf( " 0x100 No auto-expand\n" ); if ( class&0x200 ) printf( " 0x200 Needs some other encoding scheme\n" ); - printf( " Glyph encoding offset: %d\n", getlong(f)); /* offset from start of table */ + printf( " Glyph encoding offset: %d\n", glyphenc = getlong(f)); /* offset from start of table */ /* reserved = */ getlong(f); /* 48 (byte) indeces into the name table */ printf( "Plain index is: %d\n", getc(f)); @@ -258,6 +258,18 @@ static FOND *BuildFondList(FILE *f,long rlistpos,int subcnt,long rdata_pos, /* then load that string, the bytes in the string tell you what */ /* other strings to concatenate to the base font name to get the */ /* PS fontname for this style */ + if ( glyphenc!=0 ) { + fseek(f,styleoff+glyphenc,SEEK_SET); + printf( "Postscript glyph-name cnt: %d\n", cnt = getushort(f)); + for ( l=1; l<=cnt; ++l ) { + printf( " Map encoding 0x%02x to '", getc(f)); + k = getc(f); + for ( j=0; j<k; ++j) + putchar(getc(f)); + putchar('\''); + putchar('\n'); + } + } } fseek(f,here,SEEK_SET); } @@ -299,7 +299,7 @@ static void putpsstring(FILE *res,char *fontname) { } static uint32 FamilyToFOND(FILE *res,Family *fam) { - uint32 rlenpos = ftell(res), widoffpos, widoffloc, kernloc, styleloc, end; + uint32 rlenpos = ftell(res), widoffpos, widoffloc, kernloc, styleloc, glyphloc, end; int i,j,cnt, scnt, strcnt, pscnt, maxw; Face *face, *test; int exact, badmatch; @@ -441,6 +441,11 @@ static uint32 FamilyToFOND(FILE *res,Family *fam) { if ( strcmp(family,fam->psfaces[i]->fontname)!=0 ) putpsstring(res,fam->psfaces[i]->fontname+strlen(family)); } + /* Greg: record offset for glyph encoding table */ + /* We assume that the bitmap and postscript fonts are encoded similarly */ + /* and so a null vector will do. */ + glyphloc = ftell( res ); + putshort(0, res); /* Greg: an empty Glyph encoding table */ } end = ftell(res); @@ -449,6 +454,12 @@ static uint32 FamilyToFOND(FILE *res,Family *fam) { putlong(kernloc!=0?kernloc-rlenpos-4:0,res); /* Fill in kern offset */ putlong(styleloc!=0?styleloc-rlenpos-4:0,res); /* Fill in style offset */ + /* Greg: go back and add the glyph encoding table offset */ + if (styleloc && glyphloc) { + fseek(res, styleloc + 2, SEEK_SET); + putlong(glyphloc-styleloc, res); + } + fseek(res,rlenpos,SEEK_SET); putlong(end-rlenpos-4,res); /* resource length */ fseek(res,end,SEEK_SET); @@ -41,7 +41,7 @@ static long getpfblong(FILE *f) { int ch4 = getc(f); if ( ch4==EOF ) return( EOF ); -return( ch1|(ch2<<8)|(ch3<<16)|(ch4<<24) ); +return( ch4|(ch3<<8)|(ch2<<16)|(ch1<<24) ); } int PSGetNames(Face *face) { |