ftp.nice.ch/pub/next/text/tex/apps/texview.3.a9.s.tar.gz#/texview/fontdef.c

This is fontdef.c in view mode; [Download] [Up]

/*
 *   fontdef.c of dviamiga software package.
 *
 *  Stores the data from a font definition into the global data structures.
 *  A routine skipnop is also included to skip over nops and font definitions.
 *  It returns the first byte not a nop or font definition.
 */
#include "structures.h"
/*
 *   These are the external routines it calls.
 */
extern shalfword dvibyte() ;
extern integer signedquad() ;
extern void dviseek() ;
/*
 *   The external variables it uses:
 */
extern TeXfontdesctype *TeXfonts[] ;
extern integer curpos, thispage ;
extern int tracking ;
extern int debugon ;
long fakeeof = 2000000000 ;
/*
 *   We use mymalloc here:
 */
void *mymalloc() ;
/*
 *   fontdef takes a font definition in the dvi file and loads the data
 *   into its data structures.
 */
void fontdef()
{  register int i, j ;
   register char *p ;
   register TeXfontdesctype *fp ;
   register shalfword fn ;
   register integer t1, t2, t3 ;

   fn = dvibyte() ;
   if (TeXfonts[fn] == NULL)
   {
      t1 = signedquad() ;
      t2 = signedquad() ;
      t3 = signedquad() ;
      i = dvibyte() ;
      j = dvibyte() ;
      fp = mymalloc(sizeof(TeXfontdesctype)+i+j+1, 0L) ;
      TeXfonts[fn] = fp ;
      fp->loaded = NULL ;
      fp->checksum = t1 ;
      fp->scaledsize = t2 ;
      fp->designsize = t3 ;
      fp->thinspace = t2 / 6 ;
      p = fp->name ;
      for (; i>0; i--)
         *p++ = dvibyte() ;
      *p++ = 0 ;
      for (; j>0; j--)
         *p++ = dvibyte() ;
      *p++ = 0 ;
      for (i=0; i<256; i++)
         fp->scaledwidth[i] = 0 ;
#ifdef DEBUG
      if (debugon > 4)
         printf("Defining font %s\n", fp->name+1) ;
#endif
   } else {
      for (i = 1; i<=12; i++) dvibyte() ;
      i = dvibyte() + dvibyte() ;
      for (; i>0; i--) dvibyte() ;
   }
}
/*
 *   Skips any nops or font definitions between pages in a dvi file.  Returns
 *   the first command which is not a nop or font definition.
 */
int skipnop()
{ register int cmd ;

  if (curpos >= fakeeof)
    return 248 ; /* we fake an eof. */
  while ((cmd=dvibyte())==138||cmd==243)
    if (cmd==243) fontdef() ;
  return(cmd) ;
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.