summaryrefslogtreecommitdiff
path: root/dviware/dvi2pcl/initialize.c
blob: bb65c62c873396537dc05ef70fee19cc0ccc964d (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* $Log:	initialize.c,v $
 * Revision 0.8  92/11/23  19:46:47  19:46:47  bt (Bo Thide')
 * Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
 * 
 * Revision 0.7  92/11/13  02:41:31  02:41:31  bt (Bo Thide')
 * More bug fixes and improvements. Support for PaintJet XL
 * 
 * Revision 0.6  92/11/10  21:47:47  21:47:47  bt (Bo Thide')
 * Bug fixes. Added -R option. Better font handling.
 * 
 * Revision 0.5  92/11/09  16:25:35  16:25:35  bt (Bo Thide')
 * Rewrite of dospecial.c. Extended \special support
 * 
 * Revision 0.4  92/11/08  02:45:50  02:45:50  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:42  12:45:42  bt (Bo Thide')
 * Fixed 8 bit (dc font) support.
 * 
 * Revision 0.2  92/08/23  17:28:57  17:28:57  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 "paths.h"

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

/*
 * Get all variables initialized
 */

initialize()
{
	int	i,j;
	int	linelength=80;
	char	*cols;

	if(verbose)
		fprintf(stderr,BANNER);
	for(i=0; i<MAXFONTS; i++) {
		fontptr[i] = NULL;
		gfontptr[i] = NULL;
	}
	pkbase = (byte *)pkbuffer;
#ifdef DEBUG
	fprintf(stderr,"initialize: pkbase = %d\n", &pkbase);
#endif /* DEBUG */
	nextnamesfree = names + 1;
	verbose = FALSE;
	maxpages = MAXPAGES;
	startvals = 0;
	startthere[0] = FALSE;
	inpostamble = FALSE;
	maxv = INFINITY - 99;
	maxh = INFINITY - 99;
	maxs = STACKSIZE + 1;
	maxvsofar = 0;
	maxhsofar = 0;
	maxssofar = 0;
	h_posed = FALSE;
	v_posed = FALSE;
	h_offset = HOFFSET;
	r_offset = HOFFSET;
	v_offset = VOFFSET;

	lastpage = -1;
	prevpage = -1;
	actualpagecount = 0;
	nextfontdown = DYNAMICFONTBASE;
	printermem_used = 0;
	landscape = FALSE;
	manualfeed = FALSE;

	/* Initialize font descriptor data */
	fd.size = 64;
	fd.descriptor = 0;
	fd.font_type = 2;
	fd.style_MSB = 0;
	fd.reserved = 0;
	fd.baseline = 0;
	fd.cell_width = 1;
	fd.cell_height = 1;
	fd.orientation = 0;
	fd.spacing = 1;
	fd.symbol_set = 2048;	/* Largest allowed value + 1 */
	fd.pitch = 1;
	fd.height = 1;
	fd.x_height = 0;
	fd.width_type = 0;
	fd.style_LSB = 0;
	fd.stroke_weight = 0;
	fd.typeface_LSB = 0;
	fd.typeface_MSB = 0;
        fd.serif_style = 128;	/* Serif */
        fd.quality = 0;
        fd.placement = 0;
        fd.underl_dist = 0;
        fd.underl_height = 0;
        fd.text_height = 0;
        fd.text_width = 0;
        fd.first_code = 1;
        fd.last_code = 255;
        fd.pitch_ext = 0;
        fd.height_ext = 0;
        fd.cap_height = 0;
        fd.font_number = 0;
        strcpy(fd.font_name,"-TeX dvi font-");

	/* Initialize character descriptor data */
	cd.format = 4;
	cd.continuation = 0;
	cd.size = 14;
	cd.class = 1;
	cd.orientation = 0;
	cd.reserved = 0;
	cd.left_offset = 0;
	cd.top_offset = 0;
	cd.char_width = 0;
	cd.char_height = 0;
	cd.delta_x = 0;

	j = 1;
	for(i=0 ; i<8; i++)
	{ 
		power[i] = (long)j;
		j <<= 1;
	}

	/* Take a stab at line length (SYSVish) */
	if ((cols = (char *)getenv("COLUMNS")) != NULL){ 
		sscanf(cols, " %d", &linelength);
		if(linelength > 500) linelength = 500;
		if(linelength < 20) linelength = 20;
	}
  
	strcpy(pkfixname,fontpath);
	fontpathlen = strlen(pkfixname);
}