home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / printer / dvi2pcl.lha / checkfont.c < prev    next >
C/C++ Source or Header  |  1992-11-25  |  3KB  |  81 lines

  1. /* $Log:    checkfont.c,v $
  2.  * Revision 0.8  92/11/23  19:46:37  19:46:37  bt (Bo Thide')
  3.  * Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
  4.  * 
  5.  * Revision 0.7  92/11/13  02:41:21  02:41:21  bt (Bo Thide')
  6.  * More bug fixes and improvements. Support for PaintJet XL
  7.  * 
  8.  * Revision 0.6  92/11/10  21:47:38  21:47:38  bt (Bo Thide')
  9.  * Bug fixes. Added -R option. Better font handling.
  10.  * 
  11.  * Revision 0.5  92/11/09  16:25:24  16:25:24  bt (Bo Thide')
  12.  * Rewrite of dospecial.c. Extended \special support
  13.  * 
  14.  * Revision 0.4  92/11/08  02:45:40  02:45:40  bt (Bo Thide')
  15.  * Changed to portable bit manipulations. Replaced strrstr for non-POSIX compliant C. Fixed numerous bugs. Added support for more \special's.
  16.  * 
  17.  * Revision 0.3  92/08/24  12:45:33  12:45:33  bt (Bo Thide')
  18.  * Fixed 8 bit (dc font) support.
  19.  * 
  20.  * Revision 0.2  92/08/23  17:28:54  17:28:54  bt (Bo Thide')
  21.  * Source cleaned up.  Changed certain function calls.  Removed globals.
  22.  * 
  23.  * Revision 0.1  92/08/22  23:58:47  23:58:47  bt (Bo Thide')
  24.  * First Release.
  25.  *  */
  26.  
  27. #include <stdio.h>
  28. #include "globals.h"
  29. #include "macros.h"
  30.  
  31. static char rcsid[] = "$Header: checkfont.c,v 0.8 92/11/23 19:46:37 bt Exp $";
  32.  
  33. /*
  34.  * Check that all font definitions found in the postamble agree with all the
  35.  * font definitions found during prescan. For any disagreement a warning will
  36.  * be printed. Those fonts which are not detected during the prescan phase
  37.  * will be defined now
  38.  */
  39. checkfont(dvifile,f)
  40. FILE    *dvifile;
  41. int    f;
  42. {
  43.     int     i;
  44.     int     a, l;
  45.     fontfmt     *font;
  46.     char     *p;
  47.     char      buffer[TERMLINELENGTH];
  48.  
  49.     if(f >= MAXFONTS)
  50.         fprintf(stderr,"Warning: Only font definitions 0..255 are valid.\n");
  51.     else if(!(font = fontptr[f]))
  52.             definefont(dvifile, f);
  53.     else
  54.     { 
  55.         if(getsquad(dvifile) != font->checksum)
  56.             fprintf(stderr,"Warning: Pre-post disagreement in checksum for font # %d !\n",f);
  57.         if(getsquad(dvifile) != font->scaled_size)
  58.             fprintf(stderr,"Warning: Pre-post disagreement in scaled_size for font # %d !\n",
  59.                 f);
  60.         if(getsquad(dvifile) != font->design_size)
  61.             fprintf(stderr,"Warning: Pre-post disagreement in design_size for font # %d !\n",
  62.                 f);
  63.         a = (int)getubyte(dvifile);
  64.         l = (int)getubyte(dvifile);
  65.         for(i = 0; i < a ; i++)
  66.             buffer[i] = getubyte(dvifile);
  67.         buffer[a] = '\0';
  68.         p = names + font->name;
  69.         if(strcmp(p,buffer))
  70.             fprintf(stderr,"Warning: Pre-post disagreement in path_name for font # %d !\n",
  71.                 f);
  72.         for(i = 0; i < l ; i++)
  73.             buffer[i] = getubyte(dvifile);
  74.         buffer[l] = '\0';
  75.         p = names + font->name + a + 1;
  76.         if(strcmp(p,buffer))
  77.             fprintf(stderr,"Warning: Pre-post disagreement in font_name for font # %d !\n",
  78.                 f);
  79.     }
  80. }
  81.