diff options
Diffstat (limited to 'Build/source/texk/dvipsk/virtualfont.c')
-rw-r--r-- | Build/source/texk/dvipsk/virtualfont.c | 246 |
1 files changed, 123 insertions, 123 deletions
diff --git a/Build/source/texk/dvipsk/virtualfont.c b/Build/source/texk/dvipsk/virtualfont.c index 08dedb450c5..a0444623811 100644 --- a/Build/source/texk/dvipsk/virtualfont.c +++ b/Build/source/texk/dvipsk/virtualfont.c @@ -15,8 +15,8 @@ * Now we have some routines to get stuff from the VF file. * Subroutine vfbyte returns the next byte. */ -static FILE *vffile ; -static char name[500] ; +static FILE *vffile; +static char name[500]; void badvf(const char *s) { @@ -27,75 +27,75 @@ badvf(const char *s) shalfword vfbyte(void) { - register shalfword i ; + register shalfword i; if ((i=getc(vffile))==EOF) - badvf("unexpected eof") ; - return(i) ; + badvf("unexpected eof"); + return(i); } integer vfquad(void) { - register integer i ; + register integer i; - i = vfbyte() ; + i = vfbyte(); if (i > 127) - i -= 256 ; - i = i * 256 + vfbyte() ; - i = i * 256 + vfbyte() ; - i = i * 256 + vfbyte() ; - return(i) ; + i -= 256; + i = i * 256 + vfbyte(); + i = i * 256 + vfbyte(); + i = i * 256 + vfbyte(); + return(i); } integer vftrio(void) { - register integer i ; + register integer i; - i = vfbyte() ; - i = i * 256 + vfbyte() ; - i = i * 256 + vfbyte() ; - return(i) ; + i = vfbyte(); + i = i * 256 + vfbyte(); + i = i * 256 + vfbyte(); + return(i); } int vfopen(register fontdesctype *fd) { - register char *n ; + register char *n; #ifndef KPATHSEA - register char *d ; + register char *d; #endif - n = fd->name ; + n = fd->name; #ifndef KPATHSEA - d = fd->area ; + d = fd->area; if (*d==0) - d = vfpath ; + d = vfpath; #endif if (strlen(n) + 5 >= sizeof (name)) { /* 5 for vf() + null */ - error("! VF file name too long in vfopen") ; + error("! VF file name too long in vfopen"); } #ifdef MVSXA /* IBM: MVS/XA */ - (void)sprintf(name, "vf(%s)", n) ; + (void)sprintf(name, "vf(%s)", n); #else - (void)sprintf(name, "%s.vf", n) ; + (void)sprintf(name, "%s.vf", n); #endif #ifdef KPATHSEA if (0 != (vffile=search(vfpath, name, READBIN))) #else if (0 != (vffile=search(d, name, READBIN))) #endif - return(1) ; + return(1); if (!noomega) #ifdef KPATHSEA if (0 != (vffile=search(ovfpath, n, READBIN))) #else if (0 != (vffile=search(d, n, READBIN))) #endif - return(2) ; - return(0) ; + return(2); + return(0); } /* @@ -104,42 +104,42 @@ vfopen(register fontdesctype *fd) fontmaptype * vfontdef(integer s, int siz) { - register integer i, j, fn ; - register fontdesctype *fp ; - register fontmaptype *cfnt ; - char *nam, *area ; - integer cksum, scsize, dssize ; + register integer i, j, fn; + register fontdesctype *fp; + register fontmaptype *cfnt; + char *nam, *area; + integer cksum, scsize, dssize; - fn = vfbyte() ; + fn = vfbyte(); while (siz-- > 1) - fn = (fn << 8) + vfbyte() ; - cfnt = (fontmaptype *)mymalloc((integer)sizeof(fontmaptype)) ; - cfnt->fontnum = fn ; - cksum = vfquad() ; - scsize = scalewidth(s, vfquad()) ; - dssize = (integer)(alpha * (real)vfquad()) ; - i = vfbyte() ; j = vfbyte() ; + fn = (fn << 8) + vfbyte(); + cfnt = (fontmaptype *)mymalloc((integer)sizeof(fontmaptype)); + cfnt->fontnum = fn; + cksum = vfquad(); + scsize = scalewidth(s, vfquad()); + dssize = (integer)(alpha * (real)vfquad()); + i = vfbyte(); j = vfbyte(); if (nextstring + i + j > maxstring) - error("! out of string space") ; - area = nextstring ; + error("! out of string space"); + area = nextstring; for (; i>0; i--) - *nextstring++ = vfbyte() ; - *nextstring++ = 0 ; - nam = nextstring ; + *nextstring++ = vfbyte(); + *nextstring++ = 0; + nam = nextstring; for (; j>0; j--) - *nextstring++ = vfbyte() ; - *nextstring++ = 0 ; - fp = matchfont(nam, area, scsize, (char *)0) ; + *nextstring++ = vfbyte(); + *nextstring++ = 0; + fp = matchfont(nam, area, scsize, (char *)0); if (fp) { - nextstring = nam ; - fp->checksum = cksum ; + nextstring = nam; + fp->checksum = cksum; } else { - fp = newfontdesc(cksum, scsize, dssize, nam, area) ; - fp->next = fonthead ; - fonthead = fp ; + fp = newfontdesc(cksum, scsize, dssize, nam, area); + fp->next = fonthead; + fonthead = fp; } - cfnt->desc = fp ; - return (cfnt) ; + cfnt->desc = fp; + return (cfnt); } /* @@ -148,25 +148,25 @@ vfontdef(integer s, int siz) Boolean virtualfont(register fontdesctype *curfnt) { - register integer i ; - register shalfword cmd ; - register integer k ; - register integer length ; - register integer cc ; - register chardesctype *cd ; - integer scaledsize = curfnt->scaledsize ; - integer no_of_chars=256 ; - integer maxcc=255 ; - register quarterword *tempr ; - fontmaptype *fm, *newf ; - int kindfont ; - kindfont = vfopen(curfnt) ; /* 1 for TeX, 2 for Omega */ + register integer i; + register shalfword cmd; + register integer k; + register integer length; + register integer cc; + register chardesctype *cd; + integer scaledsize = curfnt->scaledsize; + integer no_of_chars=256; + integer maxcc=255; + register quarterword *tempr; + fontmaptype *fm, *newf; + int kindfont; + kindfont = vfopen(curfnt); /* 1 for TeX, 2 for Omega */ if (!kindfont) - return (0) ; + return (0); #ifdef DEBUG if (dd(D_FONTS)) (void)fprintf(stderr,"Loading virtual font %s at %.1fpt\n", - name, (real)scaledsize/(alpha*0x100000)) ; + name, (real)scaledsize/(alpha*0x100000)); #endif /* DEBUG */ /* @@ -180,21 +180,21 @@ virtualfont(register fontdesctype *curfnt) mymalloc(65536 * (integer)sizeof(chardesctype)); } for (i=0; i<no_of_chars; i++) { - curfnt->chardesc[i].TFMwidth = 0 ; - curfnt->chardesc[i].packptr = NULL ; - curfnt->chardesc[i].pixelwidth = 0 ; - curfnt->chardesc[i].flags = 0 ; - curfnt->chardesc[i].flags2 = 0 ; + curfnt->chardesc[i].TFMwidth = 0; + curfnt->chardesc[i].packptr = NULL; + curfnt->chardesc[i].pixelwidth = 0; + curfnt->chardesc[i].flags = 0; + curfnt->chardesc[i].flags2 = 0; } if (vfbyte()!=247) - badvf("expected pre") ; + badvf("expected pre"); if (vfbyte()!=202) - badvf("wrong id byte") ; + badvf("wrong id byte"); for(i=vfbyte(); i>0; i--) - (void)vfbyte() ; - k = vfquad() ; + (void)vfbyte(); + k = vfquad(); check_checksum (k, curfnt->checksum, curfnt->name); - k = (integer)(alpha * (real)vfquad()) ; + k = (integer)(alpha * (real)vfquad()); if (k > curfnt->designsize + 2 || k < curfnt->designsize - 2) { char *msg = concat("Design size mismatch in font ", name); error(msg); @@ -203,42 +203,42 @@ virtualfont(register fontdesctype *curfnt) /* * Now we look for font definitions. */ - fm = NULL ; + fm = NULL; while ((cmd=vfbyte())>=243) { if (cmd>246) - badvf("unexpected command in preamble") ; - newf = vfontdef(scaledsize, cmd-242) ; + badvf("unexpected command in preamble"); + newf = vfontdef(scaledsize, cmd-242); if (fm) - fm->next = newf ; - else curfnt->localfonts = newf ; - fm = newf ; - fm->next = NULL ; /* FIFO */ + fm->next = newf; + else curfnt->localfonts = newf; + fm = newf; + fm->next = NULL; /* FIFO */ } /* * Now we get down to the serious business of reading character definitions. */ do { if (cmd==242) { - length = vfquad() + 2 ; - if (length<2) badvf("negative length packet") ; - if (length>65535) badvf("packet too long") ; - cc = vfquad() ; - if (cc<0 || cc>=no_of_chars) badvf("character code out of range") ; - cd = curfnt->chardesc + cc ; - cd->TFMwidth = scalewidth(vfquad(), scaledsize) ; + length = vfquad() + 2; + if (length<2) badvf("negative length packet"); + if (length>65535) badvf("packet too long"); + cc = vfquad(); + if (cc<0 || cc>=no_of_chars) badvf("character code out of range"); + cd = curfnt->chardesc + cc; + cd->TFMwidth = scalewidth(vfquad(), scaledsize); } else { length = cmd + 2; - cc = vfbyte() ; - cd = curfnt->chardesc + cc ; - cd->TFMwidth = scalewidth(vftrio(), scaledsize) ; + cc = vfbyte(); + cd = curfnt->chardesc + cc; + cd->TFMwidth = scalewidth(vftrio(), scaledsize); } maxcc = (maxcc<cc) ? cc : maxcc; if (cd->TFMwidth >= 0) - cd->pixelwidth = ((integer)(conv*cd->TFMwidth+0.5)) ; + cd->pixelwidth = ((integer)(conv*cd->TFMwidth+0.5)); else - cd->pixelwidth = -((integer)(conv*-cd->TFMwidth+0.5)) ; - cd->flags = EXISTS ; - cd->flags2 = EXISTS ; + cd->pixelwidth = -((integer)(conv*-cd->TFMwidth+0.5)); + cd->flags = EXISTS; + cd->flags2 = EXISTS; if (bytesleft < length) { #ifdef DEBUG if (dd(D_MEM)) @@ -248,39 +248,39 @@ virtualfont(register fontdesctype *curfnt) #else "Allocating new raster memory (%d req, %ld left)\n", #endif - length, bytesleft) ; + length, bytesleft); #endif /* DEBUG */ if (length > MINCHUNK) { - tempr = (quarterword *)mymalloc((integer)length) ; - bytesleft = 0 ; + tempr = (quarterword *)mymalloc((integer)length); + bytesleft = 0; } else { - raster = (quarterword *)mymalloc((integer)RASTERCHUNK) ; - tempr = raster ; - bytesleft = RASTERCHUNK - length ; - raster += length ; + raster = (quarterword *)mymalloc((integer)RASTERCHUNK); + tempr = raster; + bytesleft = RASTERCHUNK - length; + raster += length; } } else { - tempr = raster ; - bytesleft -= length ; - raster += length ; + tempr = raster; + bytesleft -= length; + raster += length; } - cd->packptr = tempr ; - length -= 2 ; - *tempr++ = length / 256 ; - *tempr++ = length % 256 ; + cd->packptr = tempr; + length -= 2; + *tempr++ = length / 256; + *tempr++ = length % 256; for (; length>0; length--) - *tempr++ = vfbyte() ; - cmd = vfbyte() ; - } while (cmd < 243) ; + *tempr++ = vfbyte(); + cmd = vfbyte(); + } while (cmd < 243); if (cmd != 248) - badvf("missing postamble") ; - (void)fclose(vffile) ; - curfnt->loaded = 2 ; + badvf("missing postamble"); + (void)fclose(vffile); + curfnt->loaded = 2; if (maxcc+1<no_of_chars) { curfnt->chardesc = (chardesctype *) xrealloc(curfnt->chardesc, (maxcc+1) * (integer)sizeof(chardesctype)); curfnt->maxchars=maxcc+1; } - return (1) ; + return (1); } |