blob: b6b8bc0a01256c681fc011e6840474c165aa102b (
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
/* $Log: globals.h,v $
* Revision 0.8 92/11/23 19:47:02 19:47:02 bt (Bo Thide')
* Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
*
* Revision 0.7 92/11/13 02:41:17 02:41:17 bt (Bo Thide')
* More bug fixes and improvements. Support for PaintJet XL
*
* Revision 0.6 92/11/10 21:48:43 21:48:43 bt (Bo Thide')
* Bug fixes. Added -R option. Better font handling.
*
* Revision 0.5 92/11/09 16:25:50 16:25:50 bt (Bo Thide')
* Rewrite of dospecial.c. Extended \special support
*
* Revision 0.4 92/11/08 02:46:06 02:46:06 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:43:17 12:43:17 bt (Bo Thide')
* Fixed 8 bit (dc font) support.
*
* Revision 0.2 92/08/23 17:28:53 17:28:53 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.
*
*/
#ifndef _DVI2PCL_GLOBALS_INCLUDED
#define _DVI2PCL_GLOBALS_INCLUDED
#define BANNER "TeX Dvi to HP Print Command Language translator dvi2pcl 0.7.\n"
#define BITFILE_SUFFIX ".pcl" /* Bit file suffix */
#define BLACKBYTE '\377'
#define DEV_LJPLUS 0
#define DEV_LJ2 1
#define DEV_LJ2D 2
#define DEV_LJ2P 3
#define DEV_LJ3SI 4
#define DEV_LJ3P 5
#define DEV_PJ 10
#define DEV_PJXL 11
#define DVIFILE_SUFFIX ".dvi" /* Dvi file suffix */
#define DYNAMICFONTBASE 256 /* Start value for internal font #'s */
#define FALSE 0
#define FIX (1 << 20)
#define FMASK 7
#define FONTPATH "/%dpt/%s.%d" /* Where to look for fonts */
#define HOFFSET 200
#define INFINITY 0x7FFFFFFF
#define MAXCHEIGHT 128 /* Max character height for printer */
#define MAXCWIDTH 128 /* Max character width for printer */
#define MAXDOWN 128 /* Max number of downloadable fonts */
#define MAXDRIFT 2 /* Max dots rounding error */
#define MAXFONTS 256 /* Max # of fonts to be used */
#define MAXPAGES 1000 /* Max # of pages of the document */
#define MAXPKSIZE 65536 /* Max .pk buffer size */
#define MAXPXLSIZE 65536 /* Max .pxl buffer size */
#define MINPRINTERMEM 122880 /* 120 KByte */
#define NAMELENGTH 255 /* Max length of file names */
#define NAMESIZE 4096 /* Max texbtuffer size for names */
#define NULL 0
#define PCLLEVEL 4 /* Default PCL level (old LaserJets) */
#define PRESCAN_OFF 0 /* Not in the prescan cycle */
#define PRESCAN_ON 1 /* In the prescan cycle */
#define RESOLUTION 300
#define SCALE 75780587.52 /* 72.27*2**20 */
#define STACKSIZE 100
#define TERMLINELENGTH 80
#define TRUE 1
#define USGFILE_SUFFIX ".usg" /* Usage (log) file suffix */
#define VOFFSET 150
#define WHITEBYTE '\0'
/* Global type definitions */
typedef char byte;
typedef unsigned char ubyte;
typedef unsigned char bool;
#ifdef TRUE
#include <sys/types.h>
#else
typedef unsigned short ushort;
typedef unsigned int uint;
#endif /* TRUE */
/* PCL font descriptor */
typedef struct {
ushort size;
ubyte descriptor;
ubyte font_type;
ubyte style_MSB;
byte reserved;
ushort baseline;
ushort cell_width;
ushort cell_height;
ubyte orientation;
bool spacing;
ushort symbol_set;
ushort pitch;
ushort height;
ushort x_height;
byte width_type;
ubyte style_LSB;
byte stroke_weight;
ubyte typeface_LSB;
ubyte typeface_MSB;
ubyte serif_style;
ubyte quality;
byte placement;
byte underl_dist;
ubyte underl_height;
ushort text_height;
ushort text_width;
ushort first_code;
ushort last_code;
ubyte pitch_ext;
ubyte height_ext;
ushort cap_height;
uint font_number;
char font_name[16];
} fdfmt;
/* PCL character descriptor */
typedef struct {
ubyte format;
bool continuation;
ubyte size;
ubyte class;
ubyte orientation;
byte reserved;
short left_offset;
short top_offset;
ushort char_width;
ushort char_height;
short delta_x;
} cdfmt;
/* Internal character information */
typedef struct {
short pk_char;
long pxl_width;
long tfm_width;
long use_count;
} charfmt;
/* Internal font information */
typedef struct {
long checksum;
long scaled_size;
long design_size;
long space;
short dir_size;
double height;
short down;
short name;
short bc;
short ec;
charfmt chr[256];
} fontfmt;
/* Internal graphic char information */
typedef struct {
short pxl_bytes;
short pxl_rows;
long x_offset;
long y_offset;
byte *pxl_pattern;
} gcharfmt;
typedef gcharfmt (*gfontfmt)[256]; /* Internal graphic font information */
/* Header part of .tfm files */
typedef struct {
short lf;
short lh;
short bc;
short ec;
short nw;
short nh;
short nd;
short ni;
short nl;
short nk;
short ne;
short np;
long cs;
long ds;
} tfmfmt;
/* Printer name and capabilities */
typedef struct {
long mem;
char name[16];
char lang[8];
} prtfmt;
/* Global variables in alphabetical order */
int actualpagecount;
cdfmt cd; /* character descriptor */
charfmt *cbase;
double conv;
double convpxl;
double convtfm;
long count[10];
int c_black;
int c_flag;
int c_height;
int c_hoffset;
int c_nib;
int c_voffset;
int c_width;
long denominator;
charfmt *drawchar();
int dyn_f;
byte *endofchardata;
int e_offset;
fdfmt fd; /* font descriptor */
long firstpage;
long firstpar();
fontfmt *font;
int fontpathlen;
fontfmt *fontptr[MAXFONTS];
gfontfmt gfont;
gfontfmt gfontptr[MAXFONTS];
bool inpostamble;
long h_offset;
bool h_posed;
int landscape;
long lastpage;
long magnification;
int manualfeed;
long maxh;
int maxs;
long maxv;
long maxhsofar;
int maxssofar;
long maxvsofar;
int maxpages;
int max_depth;
int max_width;
int max_offset;
char names[NAMESIZE];
int nextfontdown;
char *nextnamesfree;
long numerator;
int o_offset;
short outreverse;
byte *pkbase;
long pkbuffer[MAXPKSIZE];
byte *pkcharinfo();
char pkfixname[NAMELENGTH];
char pkname[NAMELENGTH];
byte *pk_ptr;
long power[8];
long prevpage;
prtfmt printer;
long printermem_used;
byte pxlbuffer[MAXPXLSIZE];
int r_offset;
int s;
long startcount[10];
int startthere[10];
int startvals;
long v_offset;
bool v_posed;
bool verbose;
long h, v, w, x, y, z;
#endif /* _DVI2PCL_GLOBALS_INCLUDED */
|