summaryrefslogtreecommitdiff
path: root/dviware/dvi2pcl/checkfont.c
blob: 59f2f3d05e37916152e28c1eef948332f1bb2b85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* $Log:	checkfont.c,v $
 * Revision 0.8  92/11/23  19:46:37  19:46:37  bt (Bo Thide')
 * Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
 * 
 * Revision 0.7  92/11/13  02:41:21  02:41:21  bt (Bo Thide')
 * More bug fixes and improvements. Support for PaintJet XL
 * 
 * Revision 0.6  92/11/10  21:47:38  21:47:38  bt (Bo Thide')
 * Bug fixes. Added -R option. Better font handling.
 * 
 * Revision 0.5  92/11/09  16:25:24  16:25:24  bt (Bo Thide')
 * Rewrite of dospecial.c. Extended \special support
 * 
 * Revision 0.4  92/11/08  02:45:40  02:45:40  bt (Bo Thide')
 * Changed to portable bit manipulations. Replaced strrstr for non-POSIX compliant C. Fixed numerous bugs. Added support for more \special's.
 * 
 * Revision 0.3  92/08/24  12:45:33  12:45:33  bt (Bo Thide')
 * Fixed 8 bit (dc font) support.
 * 
 * Revision 0.2  92/08/23  17:28:54  17:28:54  bt (Bo Thide')
 * Source cleaned up.  Changed certain function calls.  Removed globals.
 * 
 * Revision 0.1  92/08/22  23:58:47  23:58:47  bt (Bo Thide')
 * First Release.
 *  */

#include <stdio.h>
#include "globals.h"
#include "macros.h"

static char rcsid[] = "$Header: checkfont.c,v 0.8 92/11/23 19:46:37 bt Exp $";

/*
 * Check that all font definitions found in the postamble agree with all the
 * font definitions found during prescan. For any disagreement a warning will
 * be printed. Those fonts which are not detected during the prescan phase
 * will be defined now
 */
checkfont(dvifile,f)
FILE	*dvifile;
int	f;
{
	int	 i;
	int	 a, l;
	fontfmt	 *font;
	char	 *p;
	char	  buffer[TERMLINELENGTH];

	if(f >= MAXFONTS)
		fprintf(stderr,"Warning: Only font definitions 0..255 are valid.\n");
	else if(!(font = fontptr[f]))
			definefont(dvifile, f);
	else
	{ 
		if(getsquad(dvifile) != font->checksum)
			fprintf(stderr,"Warning: Pre-post disagreement in checksum for font # %d !\n",f);
		if(getsquad(dvifile) != font->scaled_size)
			fprintf(stderr,"Warning: Pre-post disagreement in scaled_size for font # %d !\n",
			    f);
		if(getsquad(dvifile) != font->design_size)
			fprintf(stderr,"Warning: Pre-post disagreement in design_size for font # %d !\n",
			    f);
		a = (int)getubyte(dvifile);
		l = (int)getubyte(dvifile);
		for(i = 0; i < a ; i++)
			buffer[i] = getubyte(dvifile);
		buffer[a] = '\0';
		p = names + font->name;
		if(strcmp(p,buffer))
			fprintf(stderr,"Warning: Pre-post disagreement in path_name for font # %d !\n",
			    f);
		for(i = 0; i < l ; i++)
			buffer[i] = getubyte(dvifile);
		buffer[l] = '\0';
		p = names + font->name + a + 1;
		if(strcmp(p,buffer))
			fprintf(stderr,"Warning: Pre-post disagreement in font_name for font # %d !\n",
			    f);
	}
}