#include "utils.h" #define infile t1file #define outfile pdffile typedef signed char TTFCHAR; typedef unsigned char TTFBYTE; typedef signed short TTFSHORT; typedef unsigned short TTFUSHORT; typedef signed long TTFLONG; typedef unsigned long TTFULONG; typedef unsigned long TTFFIXED; typedef unsigned short TTFFUNIT; typedef signed short TTFFWORD; typedef unsigned short TTFUFWORD; typedef unsigned short TTFF2DOT14; #define TTFCHAR_SIZE 1 #define TTFBYTE_SIZE 1 #define TTFSHORT_SIZE 2 #define TTFUSHORT_SIZE 2 #define TTFLONG_SIZE 4 #define TTFULONG_SIZE 4 #define TTFFIXED_SIZE 4 #define TTFFWORD_SIZE 2 #define TTFUFWORD_SIZE 2 #define TTFF2DOT14_SIZE 2 #define ARG_1_AND_2_ARE_WORDS (1<<0) #define ARGS_ARE_XY_VALUES (1<<1) #define ROUND_XY_TO_GRID (1<<2) #define WE_HAVE_A_SCALE (1<<3) #define RESERVED (1<<4) #define MORE_COMPONENTS (1<<5) #define WE_HAVE_AN_X_AND_Y_SCALE (1<<6) #define WE_HAVE_A_TWO_BY_TWO (1<<7) #define WE_HAVE_INSTRUCTIONS (1<<8) #define USE_MY_METRICS (1<<9) #define GET_NUM(t) ((t)getnum(t##_SIZE)) #define SKIP(n) getnum(n) #define GET_CHAR() GET_NUM(TTFCHAR) #define GET_BYTE() GET_NUM(TTFBYTE) #define GET_SHORT() GET_NUM(TTFSHORT) #define GET_USHORT() GET_NUM(TTFUSHORT) #define GET_LONG() GET_NUM(TTFLONG) #define GET_ULONG() GET_NUM(TTFULONG) #define GET_FIXED() GET_NUM(TTFFIXED) #define GET_FUNIT() GET_NUM(TTFFUNIT) #define GET_FWORD() GET_NUM(TTFFWORD) #define GET_UFWORD() GET_NUM(TTFUFWORD) #define GET_F2DOT14() GET_NUM(TTFF2DOT14) #define PUT_NUM(t,n) ((t)putnum(t##_SIZE, n)) #define PUT_CHAR(n) PUT_NUM(TTFCHAR, n) #define PUT_BYTE(n) PUT_NUM(TTFBYTE, n) #define PUT_SHORT(n) PUT_NUM(TTFSHORT, n) #define PUT_USHORT(n) PUT_NUM(TTFUSHORT, n) #define PUT_LONG(n) PUT_NUM(TTFLONG, n) #define PUT_ULONG(n) PUT_NUM(TTFULONG, n) #define PUT_FIXED(n) PUT_NUM(TTFFIXED, n) #define PUT_FUNIT(n) PUT_NUM(TTFFUNIT, n) #define PUT_FWORD(n) PUT_NUM(TTFFWORD, n) #define PUT_UFWORD(n) PUT_NUM(TTFUFWORD, n) #define PUT_F2DOT14(n) PUT_NUM(TTFF2DOT14, n) #define COPY_BYTE() PUT_BYTE(GET_BYTE()) #define COPY_CHAR() PUT_CHAR(GET_CHAR()) #define COPY_USHORT() PUT_USHORT(GET_USHORT()) #define COPY_SHORT() PUT_SHORT(GET_SHORT()) #define COPY_ULONG() PUT_ULONG(GET_ULONG()) #define COPY_LONG() PUT_LONG(GET_LONG()) #define COPY_FIXED() PUT_FIXED(GET_FIXED()) #define COPY_FUNIT() PUT_FUNIT(GET_FUNIT()) #define COPY_FWORD() PUT_FWORD(GET_FWORD()) #define COPY_UFWORD() PUT_UFWORD(GET_UFWORD()) #define COPY_F2DOT14() PUT_F2DOT14(GET_F2DOT14()) #define NMACGLYPHS 258 #define NEW_NTABS 14 #define TABDIR_OFF 12 #define pdf_ascent_code 0 #define pdf_capheight_code 1 #define pdf_descent_code 2 #define pdf_fontname_code 3 #define pdf_italicangle_code 4 #define pdf_stemv_code 5 #define pdf_avgwidth_code 6 #define pdf_leading_code 7 #define pdf_maxwidth_code 8 #define pdf_missingwidth_code 9 #define pdf_stemh_code 10 #define pdf_xheight_code 11 #define pdf_fontbbox_code 12 #define PDF_FONT_INFO(p) pdffontinfo[(p) + pdffpbase[f]].cint typedef struct _dirtab_entry { char tag[4]; TTFULONG checksum; TTFULONG offset; TTFULONG length; } dirtab_entry; typedef struct _glyph_entry { char *name; TTFUSHORT nindex; TTFLONG offset; TTFLONG newoffset; TTFUFWORD advWidth; TTFFWORD lsb; short newindex; } glyph_entry; typedef struct _enc_entry { char *name; short index; } enc_entry; dirtab_entry *dirtab; glyph_entry *gtab; enc_entry *etab; char *post_strpool; char *enc_strpool; short *gidx; int post_format; int loca_format; int nglyphs; int nhmtxs; int nchars = 256; int chkcount; int new_nglyphs = 2; TTFUSHORT ntabs; TTFULONG checksum; TTFUSHORT upem; TTFULONG ttf_offset; char *mac_glyph[NMACGLYPHS] = { ".notdef",".null","CR","space","exclam","quotedbl","numbersign","dollar", "percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus", "comma","hyphen","period","slash","zero","one","two","three","four","five", "six","seven","eight","nine","colon","semicolon","less","equal","greater", "question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P", "Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash", "bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g", "h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z", "braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla", "Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex", "adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex", "edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute", "ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex", "udieresis","dagger","degree","cent","sterling","section","bullet","paragraph", "germandbls","registered","copyright","trademark","acute","dieresis","notequal", "AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu1", "partialdiff","summation","product","pi","integral","ordfeminine", "ordmasculine","Ohm","ae","oslash","questiondown","exclamdown","logicalnot", "radical","florin","approxequal","increment","guillemotleft","guillemotright", "ellipsis","nbspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash", "quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge", "ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright", "fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase", "perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave", "Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","applelogo", "Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde", "overscore","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek", "caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth", "eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior", "twosuperior","threesuperior","onehalf","onequarter","threequarters","franc", "Gbreve","gbreve","Idot","Scedilla","scedilla","Cacute","cacute","Ccaron", "ccaron","dmacron"}; char *newtabnames[] = { "OS/2", "PCLT", "cmap", "cvt ", "fpgm", "glyf", "head", "hhea", "hmtx", "loca", "maxp", "name", "post", "prep" }; unsigned char addchksm(unsigned char b) { checksum += (b<<(8*chkcount--)); if (chkcount < 0) chkcount = 3; return b; } TTFLONG putnum(int s, TTFLONG n) { TTFULONG i = n; char buf[10], *p = buf; while (s-- > 0) { *p++ = i&0xFF; i >>= 8; } p--; while (p >= buf) putc(addchksm(*p--), outfile); return n; } TTFLONG getnum(int s) { TTFLONG i = 0; int c; while (s > 0) { if ((c = getc(infile)) < 0) { if (c == EOF) FAIL("unexpected EOF while reading font file");\ else FAIL("getc() failed while reading font file: %s" AND SYS_ERR); } i = (i << 8) + c; s--; } return i; } long funit(long n) { if (n < 0) return -((-n/upem)*1000 + ((-n%upem)*1000)/upem); else return (n/upem)*1000 + ((n%upem)*1000)/upem; } void ncopy(int n) { while (n-- > 0) COPY_BYTE(); } dirtab_entry *name_lookup(char *s) { dirtab_entry *p; for (p = dirtab; p - dirtab < ntabs; p++) if (strncmp(p->tag, s, 4) == 0) break; if (p - dirtab == ntabs) FAIL("can't find table `%s'" AND s); return p; } dirtab_entry *seek_tab(char *name, TTFLONG offset) { char buf[255], *p = filename; dirtab_entry *pd = name_lookup(name); sprintf(buf, "%s while reading table %s", p, name); filename = buf; xfseek(infile, pd->offset + offset, SEEK_SET, filename); filename = p; return pd; } void seek_off(char *name, TTFLONG offset) { char buf[255], *p = filename; sprintf(buf, "%s while reading table %s", p, name); filename = buf; xfseek(infile, offset, SEEK_SET, filename); filename = p; } strnumber mkstr(char *s) { while (*s) strpool[poolptr++] = *s++; return makestring(); } void copy_encoding() { int i, j; char *p, *q; int e = fmtab[fmcur].encoding; for (i = 0; i < 256; i++) if (enctab[e].encglyphnames[i] != 0) break; for (j = 255; j >= 0; j--) if (enctab[e].encglyphnames[j] != 0) break; etab = MALLOC(enc_entry, 256); enc_strpool = MALLOC(char, strstart[enctab[e].encglyphnames[j] + 1] - strstart[enctab[e].encglyphnames[i]] + 256); for (p = q = enc_strpool, i = 0; i < 256; i++) if (enctab[e].encglyphnames[i] == 0) etab[i].name = mac_glyph[0]; else { for (j = strstart[enctab[e].encglyphnames[i]] + 1; j < strstart[enctab[e].encglyphnames[i] + 1]; j++) *p++ = strpool[j]; *p++ = 0; etab[i].name = q; q = p; } } void read_font() { long i, j, k, l, n; char buf[256], *p, **c; glyph_entry *pg; enc_entry *pe; dirtab_entry *pd; TTFUSHORT flags; TTFUSHORT glyphIndex; TTFUFWORD last_advWidth; if ((i= GET_FIXED()) != 0x00010000) FAIL("unsupport version %8lx; can handle only version 1.0" AND i); dirtab = MALLOC(dirtab_entry, ntabs = GET_USHORT()); SKIP(3*TTFUSHORT_SIZE); for (pd = dirtab; pd - dirtab < ntabs; pd++) { for (i = 0; i < 4; i++) pd->tag[i] = GET_CHAR(); pd->checksum = GET_ULONG(); pd->offset = GET_ULONG(); pd->length = GET_ULONG(); } seek_tab("maxp", TTFFIXED_SIZE); gtab = MALLOC(glyph_entry, 1 + (nglyphs = GET_USHORT())); for (pg = gtab; pg - gtab < nglyphs; pg++) pg->newindex = -1; gidx = MALLOC(short, nglyphs); gidx[0] = 0; gidx[1] = 1; seek_tab("head", 2*TTFFIXED_SIZE + 2*TTFULONG_SIZE + TTFUSHORT_SIZE); upem = GET_USHORT(); SKIP(16); PDF_FONT_INFO(pdf_fontbbox_code) = funit(GET_FWORD()); PDF_FONT_INFO(pdf_fontbbox_code + 1) = funit(GET_FWORD()); PDF_FONT_INFO(pdf_fontbbox_code + 2) = funit(GET_FWORD()); PDF_FONT_INFO(pdf_fontbbox_code + 3) = funit(GET_FWORD()); SKIP(2*TTFUSHORT_SIZE + TTFSHORT_SIZE); loca_format = GET_SHORT(); seek_tab("hhea", TTFFIXED_SIZE); PDF_FONT_INFO(pdf_ascent_code) = funit(GET_FWORD()); PDF_FONT_INFO(pdf_descent_code) = funit(GET_FWORD()); SKIP(TTFFWORD_SIZE + TTFUFWORD_SIZE + 3*TTFFWORD_SIZE + 8*TTFSHORT_SIZE); nhmtxs = GET_USHORT(); seek_tab("PCLT", TTFFIXED_SIZE + TTFULONG_SIZE + TTFUSHORT_SIZE); PDF_FONT_INFO(pdf_xheight_code) = funit(GET_USHORT()); SKIP(2*TTFUSHORT_SIZE); PDF_FONT_INFO(pdf_capheight_code) = funit(GET_USHORT()); seek_tab("hmtx", 0); for (pg = gtab; pg - gtab < nhmtxs; pg++) { pg->advWidth = GET_UFWORD(); pg->lsb = GET_UFWORD(); } if (nhmtxs < nglyphs) { last_advWidth = pg[-1].advWidth; while (pg - gtab < nglyphs) { pg->advWidth = last_advWidth; (pg++)->lsb = GET_UFWORD(); } } pd = seek_tab("post", 0); post_format = GET_FIXED(); SKIP(TTFFIXED_SIZE + 2*TTFFWORD_SIZE + 5*TTFULONG_SIZE); switch (post_format) { case 0x00010000: for (pg = gtab; pg - gtab < NMACGLYPHS; pg++) { pg->name = mac_glyph[pg - gtab]; pg->nindex = pg - gtab; } while (pg - gtab < nglyphs) { pg->name = mac_glyph[0]; pg->nindex = 0; } break; case 0x00020000: SKIP(TTFUSHORT_SIZE); for (pg = gtab; pg - gtab < nglyphs; pg++) pg->nindex = GET_USHORT(); i = pd->length - (xftell(infile, filename) - pd->offset); post_strpool = MALLOC(char, i); for (p = post_strpool; p - post_strpool < i;) { for (k = GET_BYTE(); k > 0; k--) *p++ = GET_CHAR(); *p++ = 0; } for (pg = gtab; pg - gtab < nglyphs; pg++) { if (pg->nindex < NMACGLYPHS) pg->name = mac_glyph[pg->nindex]; else { for (k = pg->nindex - NMACGLYPHS, p = post_strpool; k > 0; k--, p = (char *)strchr(p, 0) + 1); pg->name = p; } } break; /* case 0x00018000: for (pg = gtab; pg - gtab < nglyphs; pg++) pg->name = mac_glyph[GET_CHAR() + pg - gtab]; break; */ default: FAIL("unsupported format (%8X) of `post' table" AND post_format); } seek_tab("loca", 0); if (loca_format != 0) for (pg = gtab; pg - gtab < nglyphs; pg++) pg->offset = GET_ULONG(); else for (pg = gtab; pg - gtab < nglyphs; pg++) pg->offset = GET_USHORT()<<1; for (pe = etab; pe - etab < nchars; pe++) { pe->index = 0; if (pe->name != mac_glyph[0]) { for (pg = gtab; pg - gtab < nglyphs; pg++) if (!strcmp(pe->name, pg->name)) break; if (pg - gtab < nglyphs) { pe->index = new_nglyphs; gidx[new_nglyphs] = pg - gtab; pg->newindex = new_nglyphs++; } } } seek_tab("name", TTFUSHORT_SIZE); i = xftell(infile, filename); n = GET_USHORT(); j = GET_USHORT() + i - TTFUSHORT_SIZE; i += 2*TTFUSHORT_SIZE; while (n-- > 0) { seek_off("name", i + 3*TTFUSHORT_SIZE); k = GET_USHORT(); l = GET_USHORT(); if (k == 6) { seek_off("name", j + GET_USHORT()); p = buf; while (l-- > 0) *p++ = GET_CHAR(); *p++ = 0; PDF_FONT_INFO(pdf_fontname_code) = mkstr(buf); break; } i += 6*TTFUSHORT_SIZE; } } #define RESET_CHKSM() \ do {\ checksum = 0L;\ chkcount = 3;\ pd->offset = xftell(outfile, filename) - ttf_offset;\ } while (0) #define SET_CHKSM() \ do {\ pd->checksum = checksum;\ pd->length = xftell(outfile, filename) - pd->offset - ttf_offset;\ } while (0) void copytab(char *name) { dirtab_entry *pd = seek_tab(name, 0); long i; RESET_CHKSM(); for (i = pd->length; i > 0; i--) PUT_CHAR(GET_CHAR()); SET_CHKSM(); } void write_font() { long i, k; char *p; TTFUSHORT flags; TTFUSHORT glyph; glyph_entry *pg; dirtab_entry *pd; short *pidx; enc_entry *pe; pdfflush(); ttf_offset = xftell(outfile, filename); for (i = 1, k = 0; i <= NEW_NTABS; i <<= 1, k++); PUT_FIXED(0x00010000); /* font version */ PUT_USHORT(NEW_NTABS); /* number of tables */ PUT_USHORT(i<<3); /* search range */ PUT_USHORT(k - 1); /* entry selector */ PUT_USHORT((NEW_NTABS<<4) - (i<<3)); /* range shift */ xfseek(outfile, ttf_offset + TABDIR_OFF + NEW_NTABS*4*TTFULONG_SIZE, SEEK_SET, filename); copytab("OS/2"); copytab("PCLT"); pd = name_lookup("cmap"); RESET_CHKSM(); PUT_USHORT(0); /* table version number (0) */ PUT_USHORT(1); /* number of encoding tables (1) */ PUT_USHORT(1); /* platform ID */ PUT_USHORT(0); /* encoding ID */ PUT_ULONG(4*TTFUSHORT_SIZE + TTFULONG_SIZE); /* byte offset from beginning of table */ if (new_nglyphs < 256) { PUT_USHORT(0); /* format number (0: byte encoding table) */ PUT_USHORT(256 + 3*TTFUSHORT_SIZE); /* length of table */ PUT_USHORT(0); /* version number */ for (pe = etab; pe - etab < nchars; pe++) PUT_BYTE(pe->index); while (pe++ - etab < 256) PUT_BYTE(0); } else { for (pe = etab; pe - etab < nchars; pe++) if (pe->index != 0) break; i = pe - etab; for (pe = etab + nchars - 1; pe > etab; pe--) if (pe->index != 0) break; k = pe - etab; PUT_USHORT(6); /* format number (6): trimmed table mapping */ PUT_USHORT(TTFUSHORT_SIZE*(5 + k - i + 1)); PUT_USHORT(0); /* version number (0) */ PUT_USHORT(i); /* first character code */ PUT_USHORT(k - i + 1); /* number of character code in table */ for (pe = etab + i; pe - etab <= k; pe++) PUT_BYTE(pe->index); } SET_CHKSM(); copytab("cvt "); copytab("fpgm"); i = (pd = name_lookup("glyf"))->offset; RESET_CHKSM(); loca_format = 0; for (pidx = gidx; pidx - gidx < new_nglyphs; pidx++) { if ((gtab[*pidx].newoffset = xftell(outfile, filename) - pd->offset - ttf_offset) > 0x00020000 || (gtab[*pidx].newoffset & 1)) loca_format = 1; if (gtab[*pidx].offset != gtab[*pidx + 1].offset) { seek_off("glyph", i + gtab[*pidx].offset); k = COPY_SHORT(); ncopy(4*TTFFWORD_SIZE); if (k < 0) { do { flags = COPY_USHORT(); glyph = GET_USHORT(); if (gtab[glyph].newindex < 0) { gtab[glyph].newindex = new_nglyphs; gidx[new_nglyphs++] = glyph; /* NOTICE: Here we change `new_nglyphs', which appears in the condition of the `for' loop */ } PUT_USHORT(gtab[glyph].newindex); if (flags & ARG_1_AND_2_ARE_WORDS) ncopy(2*TTFSHORT_SIZE); else ncopy(TTFUSHORT_SIZE); if (flags & WE_HAVE_A_SCALE) ncopy(TTFF2DOT14_SIZE); else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) ncopy(2*TTFF2DOT14_SIZE); else if (flags & WE_HAVE_A_TWO_BY_TWO) ncopy(4*TTFF2DOT14_SIZE); } while (flags & MORE_COMPONENTS); if (flags & WE_HAVE_INSTRUCTIONS) ncopy(COPY_USHORT()); } else ncopy(gtab[*pidx + 1].offset - gtab[*pidx].offset - TTFUSHORT_SIZE - 4*TTFFWORD_SIZE); } } SET_CHKSM(); if ((i = pd->length) > 0x00020000 || i & 1) loca_format = 1; pd = seek_tab("head", 0); RESET_CHKSM(); ncopy( 2*TTFFIXED_SIZE + 2*TTFULONG_SIZE + 2*TTFUSHORT_SIZE + 16 + 4*TTFFWORD_SIZE + 2*TTFUSHORT_SIZE + TTFSHORT_SIZE); if (loca_format) PUT_SHORT(1); else PUT_SHORT(0); PUT_SHORT(0); SET_CHKSM(); pd = seek_tab("hhea", 0); RESET_CHKSM(); ncopy(TTFFIXED_SIZE + 3*TTFFWORD_SIZE + TTFUFWORD_SIZE + 3*TTFFWORD_SIZE + 8*TTFSHORT_SIZE); PUT_USHORT(new_nglyphs); SET_CHKSM(); pd = seek_tab("hmtx", 0); RESET_CHKSM(); for (pidx = gidx; pidx - gidx < new_nglyphs; pidx++) { PUT_UFWORD(gtab[*pidx].advWidth); PUT_UFWORD(gtab[*pidx].lsb); } SET_CHKSM(); pd = seek_tab("loca", 0); RESET_CHKSM(); if (loca_format != 0) { for (pidx = gidx; pidx - gidx < new_nglyphs; pidx++) PUT_ULONG(gtab[*pidx].newoffset); PUT_ULONG(i); } else { for (pidx = gidx; pidx - gidx < new_nglyphs; pidx++) PUT_USHORT(gtab[*pidx].newoffset/2); PUT_USHORT(i/2); } SET_CHKSM(); pd = seek_tab("maxp", TTFFIXED_SIZE + TTFUSHORT_SIZE); RESET_CHKSM(); PUT_FIXED(0x00010000); PUT_USHORT(new_nglyphs); ncopy(13*TTFUSHORT_SIZE); SET_CHKSM(); copytab("name"); pd = seek_tab("post", TTFFIXED_SIZE); RESET_CHKSM(); PUT_FIXED(0x00020000); ncopy(TTFFIXED_SIZE + 2*TTFFWORD_SIZE + 5*TTFULONG_SIZE); PUT_USHORT(new_nglyphs); for (k = 0, pidx = gidx; pidx - gidx < new_nglyphs; pidx++) if (gtab[*pidx].nindex < NMACGLYPHS) PUT_USHORT(gtab[*pidx].nindex); else PUT_USHORT(NMACGLYPHS + k++); for (pidx = gidx; pidx - gidx < new_nglyphs; pidx++) if (gtab[*pidx].nindex >= NMACGLYPHS) { PUT_BYTE(k = strlen(p = gtab[*pidx].name)); while (k-- > 0) PUT_CHAR(*p++); } SET_CHKSM(); copytab("prep"); out: fflush(outfile); pdfgone += xftell(outfile, filename) - ttf_offset; xfseek(outfile, ttf_offset + TABDIR_OFF, SEEK_SET, filename); for (i = 0; i < NEW_NTABS; i++) { pd = name_lookup(newtabnames[i]); for (k = 0; k < 4; k++) PUT_CHAR(pd->tag[k]); PUT_ULONG(pd->checksum); PUT_ULONG(pd->offset); PUT_ULONG(pd->length); } free(dirtab); free(gtab); free(etab); free(post_strpool); free(enc_strpool); free(gidx); xfflush(outfile); xfseek(outfile, pdfgone, SEEK_SET, filename); } void writettf() { char buf[256], *p; int s, i; copy_encoding(); for (i = 0; i < 256; i++) if (!pdfischarused(f, i)) etab[i].name = mac_glyph[0]; getstr(buf, fmtab[fmcur].fname); filename = buf; ungetc(tfmtemp, infile); read_font(); filename = NULL; write_font(); }