#include #include #include #include /* This program takes a ttc file and turns it into its component ttf files */ /* This makes two changes to the data: */ /* * The tables are placed at different offsets, therefore */ /* the offset fields in the table header are also different. */ /* * the 'head' table checksumAdjustment field is set correctly */ #define CHR(ch1,ch2,ch3,ch4) (((ch1)<<24)|((ch2)<<16)|((ch3)<<8)|(ch4)) static void putshort(FILE *file,int sval) { putc((sval>>8)&0xff,file); putc(sval&0xff,file); } static void putlong(FILE *file,int val) { putc((val>>24)&0xff,file); putc((val>>16)&0xff,file); putc((val>>8)&0xff,file); putc(val&0xff,file); } static int getushort(FILE *ttf) { int ch1 = getc(ttf); int ch2 = getc(ttf); if ( ch2==EOF ) return( EOF ); return( (ch1<<8)|ch2 ); } static int getlong(FILE *ttf) { int ch1 = getc(ttf); int ch2 = getc(ttf); int ch3 = getc(ttf); int ch4 = getc(ttf); if ( ch4==EOF ) return( EOF ); return( (ch1<<24)|(ch2<<16)|(ch3<<8)|ch4 ); } static unsigned int filecheck(FILE *file) { unsigned int sum = 0, chunk; rewind(file); while ( 1 ) { chunk = getlong(file); if ( feof(file) || ferror(file)) break; sum += chunk; } return( sum ); } static void copytable(FILE *ttf,FILE *ttc,int offset,int length) { int i, ch; fseek(ttc,offset,SEEK_SET); for ( i=0; i ", filename ); for ( i=0; i