/usr/bin/gnuplot symlinks packageing problems were fixed gor gnuplot-x11
[gnuplot] / term / hpgl.trm
1 /* Hello, Emacs, this is -*-C-*-
2  * $Id: hpgl.trm,v 1.22.2.1 2009/03/02 23:57:54 sfeam Exp $
3  */
4
5 /* GNUPLOT - hpgl.trm */
6
7 /*[
8  * Copyright 1990 - 1993, 1998, 2004
9  *
10  * Permission to use, copy, and distribute this software and its
11  * documentation for any purpose with or without fee is hereby granted,
12  * provided that the above copyright notice appear in all copies and
13  * that both that copyright notice and this permission notice appear
14  * in supporting documentation.
15  *
16  * Permission to modify the software is granted, but not the right to
17  * distribute the complete modified source code.  Modifications are to
18  * be distributed as patches to the released version.  Permission to
19  * distribute binaries produced by compiling modified sources is granted,
20  * provided you
21  *   1. distribute the corresponding source modifications from the
22  *    released version in the form of a patch file along with the binaries,
23  *   2. add special version identification to distinguish your version
24  *    in addition to the base release version number,
25  *   3. provide your name and address as the primary contact for the
26  *    support of your modified version, and
27  *   4. retain our contact information in regard to use of the base
28  *    software.
29  * Permission to distribute the released version of the source code along
30  * with corresponding source modifications in the form of a patch file is
31  * granted with same provisions 2 through 4 for binary distributions.
32  *
33  * This software is provided "as is" without express or implied warranty
34  * to the extent permitted by applicable law.
35 ]*/
36
37 /*
38  * This file is included by ../term.h.
39  *
40  * This terminal driver supports:
41  *  hpgl, hp7550, hp7580b, HP Laserjet III
42  *  hp7550 has been replaced by  "hpgl 8 eject"
43  *  hp7580b has been replaced by "hpgl 4"
44  *
45  * AUTHORS
46  *  Colin Kelley, Thomas Williams, Russell Lang
47  *
48  * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
49  *
50  */
51
52 /*
53  *
54  * MODIFIED for expanded HPGL/2 and PCL utilites
55  *  Tom Swiler (tom@silica.mse.ufl.edu)
56  * Modified June 1995 Ian MacPhedran to support newterm format
57  * Modified October 1995 Ian MacPhedran to simplify HPGL terminals
58  * Modified January 96 by David Denholm and Emmanuel Bigler for cp850
59  *                               and iso international character sets
60  * Modified February 99 by Jeremy Brenes to give PCL5 terminal optional
61  * multi-pen support (6 pen default), a default 34" plotting width for
62  * use with large color plotters such as the HP Designjet 750C,
63  * various alternative plot sizes, and variable fontsizes;
64  * Also decreased the HPGL terminal's fixed fontsize to make it more
65  * reasonable when plots get scaled to 34"
66  * Modified July 99 by Jeremy Brenes to make extended plot area smaller;
67  * added solid/dashed lines option, additional font types, mixed fonts
68  * Modified November 99 by Jeremy Brenes to add a postscript pointtypes
69  * option, special purpose negative pointtypes, and a pointsize function
70  *
71  */
72 #define HPGL
73 #define PCL
74
75 #include "driver.h"
76
77 #ifdef TERM_REGISTER
78 register_term(hpgl)
79 register_term(pcl5)
80 #endif /* TERM_REGISTER */
81
82 #ifdef TERM_PROTO
83 TERM_PUBLIC void HPGL_options __PROTO((void));
84 TERM_PUBLIC void HPGL2_options __PROTO((void));
85 TERM_PUBLIC void PCL_options __PROTO((void));
86 TERM_PUBLIC void HPGL_init __PROTO((void));
87 /* TERM_PUBLIC void HPGL2_init __PROTO((void)); */
88 TERM_PUBLIC void PCL_init __PROTO((void));
89 TERM_PUBLIC void HPGL_graphics __PROTO((void));
90 TERM_PUBLIC void HPGL2_graphics __PROTO((void));
91 TERM_PUBLIC void PCL_graphics __PROTO((void));
92 TERM_PUBLIC void HPGL_text __PROTO((void));
93 /* TERM_PUBLIC void HPGL2_text __PROTO((void)); */
94 TERM_PUBLIC void PCL_text __PROTO((void));
95 TERM_PUBLIC void HPGL_linetype __PROTO((int linetype));
96 TERM_PUBLIC void HPGL2_linetype __PROTO((int linetype));
97 TERM_PUBLIC void HPGL_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
98 TERM_PUBLIC void HPGL2_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
99 TERM_PUBLIC void HPGL_move __PROTO((unsigned int x, unsigned int y));
100 TERM_PUBLIC void HPGL_vector __PROTO((unsigned int x, unsigned int y));
101 TERM_PUBLIC void HPGL2_move __PROTO((unsigned int x, unsigned int y));
102 TERM_PUBLIC void HPGL2_vector __PROTO((unsigned int x, unsigned int y));
103 TERM_PUBLIC void HPGL2_encode __PROTO((int d));
104 TERM_PUBLIC int HPGL_text_angle __PROTO((int ang));
105 TERM_PUBLIC int HPGL2_text_angle __PROTO((int ang));
106 TERM_PUBLIC void HPGL_reset __PROTO((void));
107 /* TERM_PUBLIC void HPGL2_reset __PROTO((void)); */
108 TERM_PUBLIC void PCL_reset __PROTO((void));
109 TERM_PUBLIC int HPGL2_justify_text __PROTO((enum JUSTIFY just));
110 TERM_PUBLIC int HPGL2_set_font __PROTO((const char *font));
111 TERM_PUBLIC void HPGL2_point __PROTO((unsigned int x, unsigned int y, int number));
112 TERM_PUBLIC void HPGL2_neg_point __PROTO((unsigned int x, unsigned int y, int number));
113 TERM_PUBLIC void HPGL2_pointsize __PROTO((double size));
114 #define GOT_HPGL_PROTO
115 #endif /* TERM_PROTO */
116
117 #ifndef TERM_PROTO_ONLY
118 #ifdef TERM_BODY
119 /*
120  * The maximum plot size, in plotter units.
121  * Note that the actual size of larger plots may be limited by
122  * available printer memory.
123  */
124
125 #define HPGL_PUPI       1016    /* Plotter units per inch */
126
127 #define HPGL_XMAX_A     10000
128 #define HPGL_YMAX_A     7500
129
130 #define HPGL_XMAX_B     13000
131 #define HPGL_YMAX_B     7500
132
133 #define HPGL_XMAX_C     45333
134 #define HPGL_YMAX_C     34000
135
136 #define HPGL_XMAX_D     52000
137 #define HPGL_YMAX_D     34000
138
139 #define HPGL_XMAX       HPGL_XMAX_A
140 #define HPGL_YMAX       HPGL_YMAX_A
141
142 #define PCL_XMAX        HPGL_XMAX_C
143 #define PCL_YMAX        (HPGL_YMAX_C-60)
144
145 /*
146  * Tic sizes
147  */
148
149 #define HPGL_VTIC       (HPGL_YMAX/70)
150 #define HPGL_HTIC       (HPGL_YMAX/70)
151
152 #define PCL_VTIC        ((HPGL_YMAX_C-60)/320)
153 #define PCL_HTIC        ((HPGL_YMAX_C-60)/320)
154
155 /*
156  * Font size for HPGL
157  */
158
159 #define HPGL_VCHAR      (HPGL_YMAX/100*8/10)    /* 0.8% */
160 #define HPGL_HCHAR      (HPGL_XMAX/100*3/10)    /* 0.3% */
161
162 /*
163  * Font size for HPGL/2
164  */
165
166 #define HPGL2_DEF_POINT 12      /* Height of font */
167
168 #define HPGL2_DEF_PITCH (3 * 72 / (HPGL2_DEF_POINT * 2))
169 #define HPGL2_VCHAR     ((int) HPGL_PUPI * HPGL2_DEF_POINT / 72)
170 #define HPGL2_HCHAR     (HPGL2_VCHAR * 2 / 3)
171
172 /*
173  * Point size for HPGL/2
174  */
175
176 static double HPGL2_psize = 1.0;        /* Default point size */
177
178 /*
179  * Number of available pointtypes for HPGL/2
180  */
181
182 #define  HPGL2_NUM_NOPSPOINTS 6;        /* for nopspoints option */
183 #define  HPGL2_NUM_PSPOINTS 75; /* for pspoints option */
184
185 /*
186  * Control constants
187  */
188
189 #define DOWN            0       /* Pen is down */
190 #define UP              1       /* Pen is up */
191 #define UNKNOWN         -10     /* Unknown status for lots of things */
192
193 /*
194  * For Polyline Encoded, either use base 64 or base 32.
195  * Save space with base 64, but get 8-bit characters.
196  */
197
198 #define HPGL2_BASE64 1
199
200 #if HPGL2_BASE64
201 #define HPGL2_BITS 6
202 #define HPGL2_LOW_OFFS 63
203 #define HPGL2_HIGH_OFFS 191
204 #define HPGL2_MASK 63
205 #else
206 #define HPGL2_BITS 5
207 #define HPGL2_LOW_OFFS 63
208 #define HPGL2_HIGH_OFFS 95
209 #define HPGL2_MASK 31
210 #endif
211
212 /*
213  * Data structures for options
214  */
215
216 struct HPGL2_font_str {
217     const char *compare, *name;
218     int symbol_set, spacing;
219     double pitch, height;
220     int posture, stroke_weight, typeface;
221 };
222
223 struct PCL_mode_str {
224     const char *compare, *name, *command;
225     unsigned int xmax, ymax;
226 };
227
228 /*
229  * The default font goes first.  Although it is the ugliest,  the
230  * stick font is probably supported by the most devices.
231  */
232
233 static struct HPGL2_font_str GPFAR HPGL2_font_table[] = {
234     {"u$nivers", "univers", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4148},
235     {"s$tick", "stick", 277, 0, HPGL2_DEF_PITCH, 0.0, 0, 0, 48},
236     {"cg_t$imes", "cg_times", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4101},
237     {"z$apf_dingbats", "zapf_dingbats", 364, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4141},
238     {"an$tique_olive", "antique_olive", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4168},
239     {"ar$ial", "arial", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 16602},
240     {"cou$rier", "courier", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4099},
241     {"g$aramond_antigua", "garamond_antigua", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4197},
242     {"l$etter_gothic", "letter_gothic", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4102},
243     {"cg_o$mega", "cg_omega", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4113},
244     {"al$bertus", "albertus", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 1, 4362},
245     {"ti$mes_new_roman", "times_new_roman", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 16901},
246     {"cl$arendon", "clarendon", 277, 1, 0.0, HPGL2_DEF_POINT, 4, 3, 4140},
247     {"cor$onet", "coronet", 277, 1, 0.0, HPGL2_DEF_POINT, 1, 0, 4116},
248     {"m$arigold", "marigold", 277, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 4297},
249     {"tr$uetype_symbols", "truetype_symbols", 621, 1, 0.0, HPGL2_DEF_POINT, 0, 0, 16686},
250     {"w$ingdings", "wingdings", 18540, 1, 0.0, HPGL2_DEF_POINT, 1, 0, 31402}
251 };
252
253 #define HPGL2_FONTS (sizeof(HPGL2_font_table) / sizeof (struct HPGL2_font_str))
254 static struct HPGL2_font_str *HPGL2_font = &HPGL2_font_table[0];
255
256 /*
257  * The default mode goes first.  Landscape style plots are probably the
258  * most compatable with other HPGL devices.
259  */
260
261 static struct PCL_mode_str GPFAR PCL_mode_table[] = {
262     {"l$andscape", "landscape", "\033&l1O", PCL_XMAX, PCL_YMAX},
263     {"p$ortrait", "portrait", "\033&l0O", PCL_YMAX, PCL_XMAX}
264 };
265
266 #define PCL_MODES (sizeof(PCL_mode_table) / sizeof (struct PCL_mode_str))
267 static struct PCL_mode_str *PCL_mode = &PCL_mode_table[0];
268
269 /*
270  * Various line types and widths to distinguish data sets in monochrome
271  */
272
273 static const char *HPGL2_lt[] = { "", ",2", ",2", ",2", ",2", ",2", ",2", ",2" },
274                   *HPGL2_pw[] = { ".24", ".16", ".08"};
275
276 #define HPGL2_LINETYPES (sizeof(HPGL2_lt) / sizeof(char *))
277 #define HPGL2_PENWIDTHS (sizeof(HPGL2_pw) / sizeof(char *))
278
279 /* encoding vector for cp850 , characters 128 (0200) -> 255 (0377) */
280
281 static char hpgl_cp_850[128][4] = {
282
283 /* 0200 */ "\0164\017",
284 /* 0201 */ "\016O\017",
285 /* 0202 */ "\016E\017",
286 /* 0203 */ "\016@\017",
287 /* 0204 */ "\016L\017",
288 /* 0205 */ "\016H\017",
289 /* 0206 */ "\016T\017",
290 /* 0207 */ "\0165\017",
291
292 /* 0210 */ "\016A\017",
293 /* 0211 */ "\016M\017",
294 /* 0212 */ "\016I\017",
295 /* 0213 */ "\016]\017",
296 /* 0214 */ "\016Q\017",
297 /* 0215 */ "\016Y\017",
298 /* 0216 */ "\016X\017",
299 /* 0217 */ "\016P\017",
300
301 /* 0220 */ "\016\134\017",
302 /* 0221 */ "\016W\017",
303 /* 0222 */ "\016S\017",
304 /* 0223 */ "\016B\017",
305 /* 0224 */ "\016N\017",
306 /* 0225 */ "\016J\017",
307 /* 0226 */ "\016C\017",
308 /* 0227 */ "\016K\017",
309
310 /* 0230 */ "\016o\017",
311 /* 0231 */ "\016Z\017",
312 /* 0232 */ "\016[\017",
313 /* 0233 */ "\016V\017",
314 /* 0234 */ "\016;\017",
315 /* 0235 */ "\016R\017",
316 /* 0236 */ "",
317 /* 0237 */ "\016>\017",
318
319 /* 0240 */ "\016D\017",
320 /* 0241 */ "\016U\017",
321 /* 0242 */ "\016F\017",
322 /* 0243 */ "\016G\017",
323 /* 0244 */ "\0167\017",
324 /* 0245 */ "\0166\017",
325 /* 0246 */ "\016y\017",
326 /* 0247 */ "\016z\017",
327
328 /* 0250 */ "\0169\017",
329
330 /* 0251 */ "",
331 /* 0252 */ "",
332
333 /* 0253 */ "\016x\017",
334 /* 0254 */ "\016w\017",
335 /* 0255 */ "\0168\017",
336 /* 0256 */ "\016{\017",
337 /* 0257 */ "\016}\017",
338
339 /* 0260 */ "",
340 /* 0261 */ "",
341 /* 0262 */ "",
342 /* 0263 */ "",
343 /* 0264 */ "",
344
345 /* 0265 */ "\016`\017",
346 /* 0266 */ "\016\042\017",
347 /* 0267 */ "\016!\017",
348
349 /* 0270 */ "",
350 /* 0271 */ "",
351 /* 0272 */ "",
352 /* 0273 */ "",
353 /* 0274 */ "",
354
355 /* 0275 */ "\016?\017",
356 /* 0276 */ "\016<\017",
357
358 /* 0277 */ "",
359
360 /* 0300 */ "",
361 /* 0301 */ "",
362 /* 0302 */ "",
363 /* 0303 */ "",
364 /* 0304 */ "",
365 /* 0305 */ "",
366
367 /* 0306 */ "\016b\017",
368 /* 0307 */ "\016a\017",
369
370 /* 0310 */ "",
371 /* 0311 */ "",
372 /* 0312 */ "",
373 /* 0313 */ "",
374 /* 0314 */ "",
375 /* 0315 */ "",
376 /* 0316 */ "",
377
378 /* 0317 */ "\016:\017",
379
380 /* 0320 */ "\016d\017",
381 /* 0321 */ "\016c\017",
382 /* 0322 */ "\016$\017",
383 /* 0323 */ "\016%\017",
384 /* 0324 */ "\016#\017",
385
386 /* 0325 */ "",
387
388 /* 0326 */ "\016e\017",
389 /* 0327 */ "\016&\017",
390
391 /* 0330 */ "\016'\017",
392
393 /* 0331 */ "",
394 /* 0332 */ "",
395 /* 0333 */ "",
396 /* 0334 */ "",
397 /* 0335 */ "",
398
399 /* 0336 */ "\016f\017",
400 /* 0337 */ "",
401
402 /* 0340 */ "\016g\017",
403 /* 0341 */ "\016^\017",
404 /* 0342 */ "\016_\017",
405 /* 0343 */ "\016h\017",
406 /* 0344 */ "\016j\017",
407 /* 0345 */ "\016i\017",
408 /* 0346 */ "",
409 /* 0347 */ "\016q\017",
410
411 /* 0350 */ "\016p\017",
412 /* 0351 */ "\016m\017",
413 /* 0352 */ "\016.\017",
414 /* 0353 */ "\016-\017",
415 /* 0354 */ "",
416 /* 0355 */ "",
417 /* 0356 */ "\0160\017",
418 /* 0357 */ "\016(\017",
419
420 /* 0360 */ "\016v\017",
421 /* 0361 */ "\016~\017",
422 /* 0362 */ "",
423 /* 0363 */ "",
424 /* 0364 */ "",
425 /* 0365 */ "\016=\017",
426 /* 0366 */ "",
427 /* 0367 */ "",
428
429 /* 0370 */ "\016z\017",
430 /* 0371 */ "\016+\017",
431 /* 0372 */ "",
432 /* 0373 */ "",
433 /* 0374 */ "",
434 /* 0375 */ "",
435 /* 0376 */ "",
436 /* 0377 */ ""
437 };
438
439
440 /* encoding vector for iso-8859-1 , characters 128 (0200) -> 255 (0377) */
441
442 static char hpgl_iso_8859_1[128][4] = {
443
444 /* 0200 */ "",
445 /* 0201 */ "",
446 /* 0202 */ "",
447 /* 0203 */ "",
448 /* 0204 */ "",
449 /* 0205 */ "",
450 /* 0206 */ "",
451 /* 0207 */ "",
452
453 /* 0210 */ "",
454 /* 0211 */ "",
455 /* 0212 */ "",
456 /* 0213 */ "",
457 /* 0214 */ "",
458 /* 0215 */ "",
459 /* 0216 */ "",
460 /* 0217 */ "",
461
462 /* 0220 */ "",
463 /* 0221 */ "\016\017",
464 /* 0222 */ "\016\017",
465 /* 0223 */ "",
466 /* 0224 */ "",
467 /* 0225 */ "",
468 /* 0226 */ "",
469 /* 0227 */ "",
470
471 /* 0230 */ "",
472 /* 0231 */ "",
473 /* 0232 */ "",
474 /* 0233 */ "",
475 /* 0234 */ "",
476 /* 0235 */ "",
477 /* 0236 */ "",
478 /* 0237 */ "",
479
480 /* 0240 */ "",
481 /* 0241 */ "\0168\017",
482 /* 0242 */ "\0165\017",
483 /* 0243 */ "\016;\017",
484 /* 0244 */ "\016:\017",
485 /* 0245 */ "\016<\017",
486 /* 0246 */ "\017|\017",
487 /* 0247 */ "\016=\017",
488
489 /* 0250 */ "\016+\017",
490 /* 0251 */ "",
491 /* 0252 */ "\016y\017",
492 /* 0253 */ "\016{\017",
493 /* 0254 */ "",
494 /* 0255 */ "",
495 /* 0256 */ "",
496 /* 0257 */ "\0160\017",
497
498 /* 0260 */ "\016z\017",
499 /* 0261 */ "\016~\017",
500 /* 0262 */ "",
501 /* 0263 */ "",
502 /* 0264 */ "",
503 /* 0265 */ "",
504 /* 0266 */ "",
505 /* 0267 */ "",
506
507 /* 0270 */ "",
508 /* 0271 */ "",
509 /* 0272 */ "\016z\017",
510 /* 0273 */ "\016}\017",
511 /* 0274 */ "\016w\017",
512 /* 0275 */ "\016x\017",
513 /* 0276 */ "",
514 /* 0277 */ "\0169\017",
515
516 /* 0300 */ "\016!\017",
517 /* 0301 */ "\016`\017",
518 /* 0302 */ "\016\042\017",
519 /* 0303 */ "\016a\017",
520 /* 0304 */ "\016X\017",
521 /* 0305 */ "\016P\017",
522 /* 0306 */ "\016S\017",
523 /* 0307 */ "\0164\017",
524
525 /* 0310 */ "\016#\017",
526 /* 0311 */ "\016\134\017",
527 /* 0312 */ "\016$\017",
528 /* 0313 */ "\016%\017",
529 /* 0314 */ "\016f\017",
530 /* 0315 */ "\016e\017",
531 /* 0316 */ "\016\046\017",
532 /* 0317 */ "\016'\017",
533
534 /* 0320 */ "\016c\017",
535 /* 0321 */ "\0166\017",
536 /* 0322 */ "\016h\017",
537 /* 0323 */ "\016g\017",
538 /* 0324 */ "\016_\017",
539 /* 0325 */ "\016i\017",
540 /* 0326 */ "\016Z\017",
541 /* 0327 */ "",
542
543 /* 0330 */ "\016R\017",
544 /* 0331 */ "\016-\017",
545 /* 0332 */ "\016m\017",
546 /* 0333 */ "\016.\017",
547 /* 0334 */ "\016[\017",
548 /* 0335 */ "",
549 /* 0336 */ "\016p\017",
550 /* 0337 */ "\016^\017",
551
552 /* 0340 */ "\016H\017",
553 /* 0341 */ "\016D\017",
554 /* 0342 */ "\016@\017",
555 /* 0343 */ "\016b\017",
556 /* 0344 */ "\016L\017",
557 /* 0345 */ "\016T\017",
558 /* 0346 */ "\016W\017",
559 /* 0347 */ "\0165\017",
560
561 /* 0350 */ "\016I\017",
562 /* 0351 */ "\016E\017",
563 /* 0352 */ "\016A\017",
564 /* 0353 */ "\016M\017",
565 /* 0354 */ "\016Y\017",
566 /* 0355 */ "\016U\017",
567 /* 0356 */ "\016Q\017",
568 /* 0357 */ "\016]\017",
569
570 /* 0360 */ "\016d\017",
571 /* 0361 */ "\0167\017",
572 /* 0362 */ "\016J\017",
573 /* 0363 */ "\016F\017",
574 /* 0364 */ "\016B\017",
575 /* 0365 */ "\016j\017",
576 /* 0366 */ "\016N\017",
577 /* 0367 */ "",
578
579 /* 0370 */ "\016V\017",
580 /* 0371 */ "\016K\017",
581 /* 0372 */ "\016G\017",
582 /* 0373 */ "\016C\017",
583 /* 0374 */ "\016O\017",
584 /* 0375 */ "",
585 /* 0376 */ "\016q\017",
586 /* 0377 */ "\016o\017"
587 };
588
589
590 /*
591  * Static variables to keep track of where we are, etc.
592  */
593
594 static int HPGL_ang = 0, HPGL_x = UNKNOWN, HPGL_y = UNKNOWN,
595            HPGL_penstate = UNKNOWN, HPGL_pentype, HPGL2_pentype = UNKNOWN,
596            HPGL2_in_pe, HPGL2_lost;
597
598 /*
599  * The subroutines, grouped by function for different versions.
600  */
601
602 static int HPGL_numpen, HPGL_eject;
603
604 TERM_PUBLIC void
605 HPGL_options()
606 {
607     HPGL_numpen = 6;            /* default to six pens */
608     HPGL_eject = 0;             /* default to no eject */
609
610     while (!END_OF_COMMAND) {
611         if (almost_equals(c_token, "eje$ct"))
612             HPGL_eject = 1;
613         else if (isanumber(c_token)) {
614             HPGL_numpen = (int) real(&token[c_token].l_val);
615             if (HPGL_numpen <= 0) {
616                 HPGL_numpen = 6;
617                 int_error(c_token, "Number of pens must be positive");
618             }
619         } else
620             int_error(c_token, "expecting \"eject\" or number of pens");
621
622         c_token++;
623     }
624
625
626     sprintf(term_options, "%d pens %s", HPGL_numpen,
627             HPGL_eject ? "eject" : "noeject");
628 }
629
630 static int HPGL2_color = 1, HPGL2_numpen = 6;   /* default to 6 pen color */
631 static int HPGL2_dashed = 0;    /* current dashed linetype */
632 static int HPGL2_solid = 1;     /* default to solid lines */
633 static int HPGL2_font_num = 0;  /* font from options */
634 static int HPGL2_font_num_current = 0; /* current font */
635 static int pspointset = 0;      /* default to standard point types */
636 static double HPGL2_point_size = HPGL2_DEF_POINT; /* pointsize from options */
637 static double HPGL2_point_size_current = 0; /* current pointsize */
638 static const char *PCL_dim = "noextended"; /* default plotting dimensions */
639
640
641 enum HPGL2_id {
642     HPGL2_MONOCHROME, HPGL2_COLOR, HPGL2_SOLID, HPGL2_DASHED, HPGL2_FONT,
643     HPGL2_SIZE, HPGL2_NOPSPOINTS, HPGL2_PSPOINTS,
644     HPGL2_INVALID
645 };
646
647 static struct gen_table HPGL2_opts[] =
648 {
649     { "mono$chrome", HPGL2_MONOCHROME },
650     { "col$or", HPGL2_COLOR },
651     { "col$our", HPGL2_COLOR },
652     { "sol$id", HPGL2_SOLID },
653     { "das$hed", HPGL2_DASHED },
654     { "f$ont", HPGL2_FONT },
655     { "s$ize", HPGL2_SIZE },
656     { "n$opspoints", HPGL2_NOPSPOINTS },
657     { "p$spoints", HPGL2_PSPOINTS },
658     { NULL, HPGL2_INVALID }
659 };
660
661 TERM_PUBLIC void
662 HPGL2_options()
663 {
664     struct termentry *t = term;
665     int i;
666
667     while (!END_OF_COMMAND) {
668         switch(lookup_table(&HPGL2_opts[0],c_token)) {
669         case HPGL2_MONOCHROME:
670             HPGL2_color = 0;
671             c_token++;
672             break;
673         case HPGL2_COLOR:
674             HPGL2_color = 1;
675             c_token++;
676             if (!END_OF_COMMAND && isanumber(c_token)) {
677                 HPGL2_numpen = (int) real(&token[c_token].l_val);
678                 if (HPGL2_numpen <= 0) {
679                     HPGL2_numpen = 6;
680                     int_error(c_token, "Number of pens must be a positive");
681                 }
682             c_token++;
683             }
684             break;
685         case HPGL2_SOLID:
686             HPGL2_solid = 1;
687             c_token++;
688             break;
689         case HPGL2_DASHED:
690             HPGL2_solid = 0;
691             c_token++;
692             break;
693         case HPGL2_FONT:
694             c_token++;
695             if (!END_OF_COMMAND) {
696                 for (i = 0; i < HPGL2_FONTS && !almost_equals(c_token, HPGL2_font_table[i].compare); i++);
697                 if (i < HPGL2_FONTS) {
698                     HPGL2_font = &HPGL2_font_table[i];
699                     HPGL2_font_num = i;
700                     HPGL2_font_num_current = HPGL2_font_num;
701                 } else
702                     int_error(c_token,
703                               "expecting font: stick, cg_times, univers, zapf_dingbats, antique_olive,\narial, courier, garamond_antigua, letter_gothic, cg_omega, albertus,\ntimes_new_roman, clarendon, coronet, marigold, truetype_symbols, or wingdings");
704                 c_token++;
705             } else
706                 int_error(c_token,
707                           "expecting font: stick, cg_times, univers, zapf_dingbats, antique_olive,\narial, courier, garamond_antigua, letter_gothic, cg_omega, albertus,\ntimes_new_roman, clarendon, coronet, marigold, truetype_symbols, or wingdings");
708             break;
709         case HPGL2_SIZE:
710             c_token++;
711             if (!END_OF_COMMAND) {
712                 if ((HPGL2_point_size = real(&token[c_token].l_val)) > 0.0) {
713                     HPGL2_point_size_current = HPGL2_point_size;
714                     t->v_char = (int) HPGL_PUPI *HPGL2_point_size / 72;
715                     t->h_char = t->v_char * 2 / 3;
716                     if (HPGL2_font->spacing)
717                         HPGL2_font->height = HPGL2_point_size;
718                     else
719                         HPGL2_font->pitch = 72 * 3 / (HPGL2_point_size * 2);
720                 } else
721                     int_error(c_token, "expecting point size: real number");
722                 c_token++;
723             } else
724                 int_error(c_token, "expecting point size: real number");
725             break;
726         case HPGL2_NOPSPOINTS:
727             c_token++;
728             pspointset = 0;
729             break;
730         case  HPGL2_PSPOINTS:
731             c_token++;
732             pspointset = 1;
733             break;
734         case HPGL2_INVALID:
735             c_token++;
736         default:
737             break;
738         }
739     }
740
741     sprintf(term_options+strlen(term_options)," %s %d %s \\\n"
742                                               "   %s %s %f %s",
743             HPGL2_color ? "color" : "monochrome",
744             HPGL2_color == 1 ? HPGL2_numpen : 1,
745             HPGL2_solid ? "solid" : "dashed",
746             HPGL2_font->name,
747             HPGL2_font->spacing ? "height" : "pitch",
748             HPGL2_font->spacing ? HPGL2_font->height : HPGL2_font->pitch,
749             pspointset ? "pspoints" : "nopspoints");
750 }
751
752 #if 0
753 /* Unused for now */
754
755 enum PCL_id {
756     PCL_MODE, PCL_EXTENDED, PCL_EXTENDED, PCL_LEGAL, PCL_LETTER,
757     PCL_INVALID
758 };
759
760 static struct gen_table PCL_opts[] =
761 {
762     { "m$ode", PCL_MODE },
763     { "ext$ended", PCL_EXTENDED },
764     { "noext$ended", PCL_NOEXTENDED },
765     { "leg$al", PCL_LEGAL },
766     { "let$ter", PCL_LETTER },
767     { NULL, PCL_INVALID }
768 };
769 #endif
770
771 TERM_PUBLIC void
772 PCL_options()
773 {
774     int i;
775
776     if (!END_OF_COMMAND && almost_equals(c_token, "m$ode")) {
777         c_token++;
778         if (!END_OF_COMMAND) {
779             for (i = 0; i < PCL_MODES && !almost_equals(c_token, PCL_mode_table[i].compare); i++);
780             if (i < PCL_MODES)
781                 PCL_mode = &PCL_mode_table[i];
782             else
783                 int_error(c_token, "expecting mode: portrait or landscape");
784             c_token++;
785         } else
786             int_error(c_token, "expecting mode: portrait or landscape");
787     }
788     if (!END_OF_COMMAND && almost_equals(c_token, "ext$ended")) {
789         PCL_mode->xmax = (HPGL_XMAX_D);
790         PCL_mode->ymax = (HPGL_YMAX_D - 60);
791         PCL_dim = "extended";
792         c_token++;
793     } else if (!END_OF_COMMAND && almost_equals(c_token, "noext$ended")) {
794         PCL_mode->xmax = (HPGL_XMAX_C);
795         PCL_mode->ymax = (HPGL_YMAX_C - 60);
796         PCL_dim = "noextended";
797         c_token++;
798     } else if (!END_OF_COMMAND && almost_equals(c_token, "leg$al")) {
799         PCL_mode->xmax = (HPGL_XMAX_B);
800         PCL_mode->ymax = (HPGL_YMAX_B - 60);
801         PCL_dim = "legal";
802         c_token++;
803     } else if (!END_OF_COMMAND && almost_equals(c_token, "let$ter")) {
804         PCL_mode->xmax = (HPGL_XMAX_A);
805         PCL_mode->ymax = (HPGL_YMAX_A - 60);
806         PCL_dim = "letter";
807         c_token++;
808     }
809     sprintf(term_options, "%s %s", PCL_mode->name, PCL_dim);
810     HPGL2_options();
811 }
812
813 TERM_PUBLIC void
814 HPGL_init()
815 {
816 }
817
818 /* void HPGL2_init ()
819 {
820 } */
821
822 TERM_PUBLIC void
823 PCL_init()
824 {
825     struct termentry *t = term;
826 /*
827  * Reset printer, set to one copy, orientation of user's choice.
828  * Make the change to the new orientation all at once.
829  */
830     fprintf(gpoutfile, "\033E\033&l1X%s\n", PCL_mode->command);
831     t->xmax = PCL_mode->xmax;
832     t->ymax = PCL_mode->ymax;
833 /*
834  * Enter HPGL/2 graphics mode
835  * Necessary here to keep the first DI0,1DI1,0 orientation command from being
836  * printed as literal text on the page for some devices. Hopefully this
837  * workaround has no bad consequences elsewhere; omit this line if it does.
838  */
839     fputs("\033%0B", gpoutfile);
840 }
841
842 TERM_PUBLIC void
843 HPGL_graphics()
844 {
845     fputs("\033.Y\n\033.I81;;17:\033.N;19:\033.M500:\n", gpoutfile);
846 /*             1
847         1. enable eavesdropping
848 */
849     fprintf(gpoutfile,
850             "IN;%s\nSC0,%d,0,%d;\nSR%f,%f;\n",
851             ((encoding == S_ENC_CP850) || (encoding == S_ENC_ISO8859_1)) ?
852             "CA7;" : "",
853             HPGL_XMAX, HPGL_YMAX, ((double) (HPGL_HCHAR) * 200 / 3 / HPGL_XMAX), ((double) (HPGL_VCHAR) * 100 / 2 / HPGL_YMAX));
854 /*       1    2             3
855         1. reset to power-up defaults
856         2. set SCaling
857         3. set character size
858 */
859     HPGL_ang = 0;
860 }
861
862 TERM_PUBLIC void
863 HPGL2_graphics()
864 {
865 /*
866  * IN - Initialize
867  * SP - Select pen
868  * SD - Set default font
869  */
870     fprintf(gpoutfile, "INSP1SD1,%d,2,%d,", HPGL2_font->symbol_set, HPGL2_font->spacing);
871     if (HPGL2_font->spacing)
872         fprintf(gpoutfile, "4,%f,", HPGL2_font->height);
873     else
874         fprintf(gpoutfile, "3,%f,", HPGL2_font->pitch);
875     fprintf(gpoutfile, "5,%d,6,%d,7,%d;SS;\n", HPGL2_font->posture, HPGL2_font->stroke_weight, HPGL2_font->typeface);
876 /*
877  * Add a set of user-defined dashed linetypes if the dashed option is
878  * selected. Of course, the UL's below can be edited to user preference.
879  */
880     if (HPGL2_solid == 0) {
881         fputs("\
882 UL1,100;\n\
883 UL2,8,8,9,8,8,9,8,8,9,8,8,9;\n\
884 UL3,6,6,6,7,6,6,6,7,6,6,6,7,6,6,6,7;\n\
885 UL4,5,5,5,10,5,5,5,10,5,5,5,10;\n\
886 UL5,5,5,5,5,5,8,5,5,5,5,5,8,5,5,5,5,5,9;\n\
887 UL6,8,8,0,9,8,8,0,9,8,8,0,9;\n\
888 UL7,4,4,4,4,0,4,4,4,4,4,0,4,4,4,4,4,0,4;\n\
889 UL8,6,6,6,6,6,6,0,6,6,6,6,6,6,6,0,6;\n",
890                 gpoutfile);
891     }
892 /*
893  * Control variables
894  */
895     HPGL_ang = 0;               /* Horizontal */
896     HPGL2_in_pe = FALSE;        /* Not in PE command */
897     HPGL2_lost = TRUE;          /* Pen position is unknown */
898     HPGL_penstate = UP;         /* Pen is up */
899 }
900
901 TERM_PUBLIC void
902 PCL_graphics()
903 {
904 /*
905  * Enter HPGL/2 graphics mode
906  */
907     fputs("\033%0B", gpoutfile);
908     HPGL2_graphics();
909 }
910
911 TERM_PUBLIC void
912 HPGL_text()
913 {
914     if (HPGL_eject == 0) {
915         fputs("PUSP0;\033.Z\n\0", gpoutfile);
916 /*               1 2   3
917         1. pen up
918         2. park pen
919         3. disable eavesdropping
920 */
921     } else {
922         fputs("PUSP0;PG;\033.Z\n\0", gpoutfile);
923 /*               1 2   3  4
924         1. pen up
925         2. park pen
926         3. page eject
927         4. disable eavesdropping
928 */
929     }
930     HPGL_penstate = UP;
931 }
932
933 #if 0                           /* not used */
934 void
935 HPGL2_text()
936 {
937 /*
938  * If in Polyline Encoded command, leave Polyline Encoded command
939  */
940     if (HPGL2_in_pe) {
941         fputs(";\n", gpoutfile);
942         HPGL2_in_pe = 0;
943     }
944 /*
945  * Pen up, park pen
946  */
947     fputs("PUSP0;", gpoutfile);
948     HPGL_penstate = UP;
949 }
950 #endif
951
952 TERM_PUBLIC void
953 PCL_text()
954 {
955     if (HPGL2_in_pe) {
956         fputs(";\n", gpoutfile);
957         HPGL2_in_pe = 0;
958     }
959 /*
960  * Go into PCL mode and eject the page
961  */
962     fputs("\033%1A\033&l0H\n\0", gpoutfile);
963 }
964
965 TERM_PUBLIC void
966 HPGL_linetype(int linetype)
967 {
968     if (linetype < -2)
969         linetype = LT_BLACK;
970 /* allow for set number of pens */
971     linetype = (linetype + 2) % HPGL_numpen + 1;
972 /* only select pen if necessary */
973     if (HPGL_pentype != linetype) {
974         fprintf(gpoutfile, "PU;\nSP%d;\n", linetype);
975         HPGL_pentype = linetype;
976         HPGL_penstate = UP;
977     }
978 }
979
980 TERM_PUBLIC void
981 HPGL2_linetype(int linetype)
982 {
983 /*
984  * If in Polyline Encoded command, leave Polyline Encoded command
985  */
986     if (HPGL2_in_pe) {
987         fputs(";\n", gpoutfile);
988         HPGL2_in_pe = 0;
989     }
990 /* allow for set number of pens for color displays */
991     if (HPGL2_color == 1) {
992         if (linetype >= 0) {
993             if (HPGL2_solid == 0)
994                 HPGL2_dashed = linetype % HPGL2_LINETYPES + 1;
995             linetype = (linetype + 2) % HPGL2_numpen + 1;
996         }
997 /* only select pen if necessary */
998         if (linetype != HPGL2_pentype) {
999             if (linetype >= 0) {
1000                 if (HPGL2_solid == 0) {
1001                     fprintf(gpoutfile, "PU;\nSP%d;\nLT%d;", linetype, HPGL2_dashed);
1002                 } else
1003                     fprintf(gpoutfile, "PU;\nSP%d;\nLT;", linetype);
1004 /* Borders and Tics */
1005             } else if (linetype == LT_BLACK) {
1006                 fprintf(gpoutfile, "PU;\nSP1;\nPW.2LT");
1007 /* Axes and Grids */
1008             } else if (linetype == LT_AXIS)
1009                 fprintf(gpoutfile, "PU;\nSP1;\nPW.2LT1,.25");
1010             HPGL_penstate = UP;
1011             HPGL2_pentype = linetype;
1012         }
1013 /* allow for lots of linetypes for monochrome displays */
1014     } else {
1015         if (linetype >= 0) {
1016             if (HPGL2_solid == 0)
1017                 HPGL2_dashed = linetype % HPGL2_LINETYPES + 1;
1018             linetype = linetype % (HPGL2_LINETYPES * HPGL2_PENWIDTHS);
1019         }
1020 /* only select pen if necessary */
1021         if (linetype != HPGL2_pentype) {
1022             if (linetype >= 0) {
1023                 if (HPGL2_solid == 0) {
1024                     fprintf(gpoutfile, "PW%sLT%d%s", HPGL2_pw[linetype / HPGL2_LINETYPES], HPGL2_dashed,
1025                             HPGL2_lt[linetype % HPGL2_LINETYPES]);
1026                 } else
1027                     fprintf(gpoutfile, "PW%sLT", HPGL2_pw[linetype / HPGL2_LINETYPES]);
1028 /* Borders and Tics */
1029             } else if (linetype == LT_BLACK) {
1030                 fprintf(gpoutfile, "PW.2LT");
1031 /* Axes and Grids */
1032             } else if (linetype == LT_AXIS)
1033                 fprintf(gpoutfile, "PW.1LT1,.25");
1034             HPGL2_pentype = linetype;
1035         }
1036     }
1037 }
1038
1039 TERM_PUBLIC void
1040 HPGL_put_text(unsigned int x, unsigned int y, const char *str)
1041 {
1042     if (HPGL_ang == 1)
1043         HPGL_move(x + HPGL_VCHAR / 4, y);
1044     else
1045         HPGL_move(x, y - HPGL_VCHAR / 4);
1046     if (encoding == S_ENC_CP850) {
1047         unsigned char *s;
1048         fputs("LB", gpoutfile);
1049         for (s = (unsigned char *) str; *s; ++s)
1050             if (*s >= 128 && hpgl_cp_850[*s - 128][0])
1051                 fputs(hpgl_cp_850[*s - 128], gpoutfile);
1052             else
1053                 putc(*s, gpoutfile);
1054         fputs("\003\n", gpoutfile);
1055     } else if (encoding == S_ENC_ISO8859_1) {
1056         unsigned char *s;
1057         fputs("LB", gpoutfile);
1058         for (s = (unsigned char *) str; *s; ++s)
1059             if (*s >= 128 && hpgl_iso_8859_1[*s - 128][0])
1060                 fputs(hpgl_iso_8859_1[*s - 128], gpoutfile);
1061             else
1062                 putc(*s, gpoutfile);
1063         fputs("\003\n", gpoutfile);
1064     } else
1065         fprintf(gpoutfile, "LB%s\003\n", str);
1066 }
1067
1068 TERM_PUBLIC void
1069 HPGL2_put_text(unsigned int x, unsigned int y, const char *str)
1070 {
1071     struct termentry *t = term;
1072 /*
1073  * Position the pen
1074  */
1075     if (HPGL_ang == 1)
1076         HPGL2_move(x + t->v_char / 4, y);
1077     else
1078         HPGL2_move(x, y - t->v_char / 4);
1079 /*
1080  * If in Polyline Encoded command, leave Polyline Encoded command
1081  */
1082     if (HPGL2_in_pe) {
1083         fputs(";\n", gpoutfile);
1084         HPGL2_in_pe = 0;
1085     }
1086 /*
1087  * Print the text string
1088  */
1089     fprintf(gpoutfile, "LB%s\003\n", str);
1090     HPGL2_lost = 1;
1091 }
1092
1093 /*
1094  * Some early HPGL plotters (e.g. HP7220C) require the
1095  * Pen Up/Down and Pen (move) Absolute commands to be separate.
1096  */
1097
1098 TERM_PUBLIC void
1099 HPGL_move(unsigned int x, unsigned int y)
1100 {
1101     if (HPGL_x != x || HPGL_y != y) {   /* only move if necessary */
1102         fprintf(gpoutfile, "PU;PA%d,%d;\n", x, y);
1103         HPGL_penstate = UP;
1104         HPGL_x = x;
1105         HPGL_y = y;
1106     }
1107 }
1108
1109 TERM_PUBLIC void
1110 HPGL_vector(unsigned int x, unsigned int y)
1111 {
1112     if (HPGL_penstate != DOWN) {
1113         fprintf(gpoutfile, "PD;PA%d,%d;\n", x, y);
1114         HPGL_penstate = DOWN;
1115     } else
1116         fprintf(gpoutfile, "PA%d,%d;\n", x, y);
1117     HPGL_x = x;
1118     HPGL_y = y;
1119 }
1120
1121 TERM_PUBLIC void
1122 HPGL2_move(unsigned int x, unsigned int y)
1123 {
1124     int dx, dy;
1125     if (HPGL2_in_pe) {
1126         dx = x - HPGL_x;
1127         dy = y - HPGL_y;
1128         fputs("<", gpoutfile);
1129     } else {
1130 #if HPGL2_BASE64
1131         fputs("PE<", gpoutfile);
1132 #else
1133         fputs("PE7<", gpoutfile);
1134 #endif
1135         if (HPGL2_lost) {
1136             dx = x;
1137             dy = y;
1138             HPGL2_lost = 0;
1139             fputs("=", gpoutfile);
1140         } else {
1141             dx = x - HPGL_x;
1142             dy = y - HPGL_y;
1143         }
1144         HPGL2_in_pe = 1;
1145     }
1146 #if HPGL2_EXPLICIT_PD
1147     if (HPGL_penstate == DOWN)
1148         HPGL_penstate = UP;
1149 #endif
1150     HPGL2_encode(dx);
1151     HPGL2_encode(dy);
1152     fputs("\n", gpoutfile);
1153     HPGL_x = x;
1154     HPGL_y = y;
1155 }
1156
1157 TERM_PUBLIC void
1158 HPGL2_vector(unsigned int x, unsigned int y)
1159 {
1160     int dx, dy;
1161     if (HPGL2_in_pe) {
1162         dx = x - HPGL_x;
1163         dy = y - HPGL_y;
1164     } else {
1165 #if HPGL2_BASE64
1166         fputs("PE", gpoutfile);
1167 #else
1168         fputs("PE7", gpoutfile);
1169 #endif
1170         if (HPGL2_lost) {
1171             dx = x;
1172             dy = y;
1173             HPGL2_lost = 0;
1174             fputs("=", gpoutfile);
1175         } else {
1176             dx = x - HPGL_x;
1177             dy = y - HPGL_y;
1178         }
1179         HPGL2_in_pe = 1;
1180     }
1181 #if HPGL2_EXPLICIT_PD
1182 /*
1183  * Put the pen down in the current position,
1184  * relative vector of 0,0.
1185  */
1186     if (HPGL_penstate == UP) {
1187         fputc((char) HPGL2_HIGH_OFFS, gpoutfile);
1188         fputc((char) HPGL2_HIGH_OFFS, gpoutfile);
1189         HPGL_penstate = DOWN;
1190     }
1191 #endif
1192     HPGL2_encode(dx);
1193     HPGL2_encode(dy);
1194     fputs("\n", gpoutfile);
1195     HPGL_x = x;
1196     HPGL_y = y;
1197 }
1198
1199 /*
1200  * Routine to encode position in base 32 or base 64 characters
1201  */
1202
1203 TERM_PUBLIC void
1204 HPGL2_encode(int d)
1205 {
1206     int c;
1207
1208     if ((d <<= 1) < 0)
1209         d = 1 - d;
1210     do {
1211         c = d & HPGL2_MASK;
1212         d >>= HPGL2_BITS;
1213         if (d > 0)
1214             fputc((char) (c + HPGL2_LOW_OFFS), gpoutfile);
1215         else
1216             fputc((char) (c + HPGL2_HIGH_OFFS), gpoutfile);
1217     } while (d > 0);
1218 }
1219
1220 TERM_PUBLIC int
1221 HPGL_text_angle(int ang)
1222 {
1223     if (ang == -90 || ang == 270)
1224         HPGL_ang = -1;
1225     else
1226         HPGL_ang = (ang ? 1 : 0);
1227
1228     if (HPGL_ang == 0)                  /* Horizontal */
1229         fputs("DI1,0;\n", gpoutfile);
1230     else if (HPGL_ang == -1)            /* Vertical Down */
1231         fputs("DI0,-1;\n", gpoutfile);
1232     else                                /* Vertical Up */
1233         fputs("DI0,1;\n", gpoutfile);
1234     return TRUE;
1235 }
1236
1237 TERM_PUBLIC int
1238 HPGL2_text_angle(int ang)
1239 {
1240 /*
1241  * If in Polyline Encoded command, leave Polyline Encoded command
1242  */
1243     if (ang == -90 || ang == 270)
1244         HPGL_ang = -1;
1245     else
1246         HPGL_ang = (ang ? 1 : 0);
1247
1248     if (HPGL2_in_pe) {
1249         fputs(";", gpoutfile);
1250         HPGL2_in_pe = 0;
1251     }
1252     if (HPGL_ang == 1)                  /* Vertical Up */
1253         fputs("DI0,1", gpoutfile);
1254     else if (HPGL_ang == -1)            /* Vertical Down */
1255         fputs("DI0,-1", gpoutfile);
1256     else                                /* Horizontal */
1257         fputs("DI1,0", gpoutfile);
1258     return TRUE;
1259 }
1260
1261 TERM_PUBLIC void
1262 HPGL_reset()
1263 {
1264 /*
1265  * do nothing
1266  */
1267 }
1268
1269 #if 0
1270 void
1271 HPGL2_reset()
1272 {
1273 /*
1274  * Park the pen
1275  * Advance a page
1276  * End with ";"
1277  */
1278     fputs("SP0PG;\n", gpoutfile);
1279 }
1280
1281 #endif
1282
1283 TERM_PUBLIC void
1284 PCL_reset()
1285 {
1286 /*
1287  * Return to PCL mode
1288  * Printer reset (conditional eject)
1289  */
1290     fputs("\033%0A\033E\n", gpoutfile);
1291 }
1292
1293 TERM_PUBLIC int
1294 HPGL2_justify_text(enum JUSTIFY just)
1295 {
1296 /*
1297  * If in Polyline Encoded command, leave Polyline Encoded command
1298  */
1299     if (HPGL2_in_pe) {
1300         fputs(";\n", gpoutfile);
1301         HPGL2_in_pe = 0;
1302     }
1303     switch (just) {
1304     case LEFT:
1305         fputs("LO1", gpoutfile);
1306         break;
1307     case CENTRE:
1308         fputs("LO4", gpoutfile);
1309         break;
1310     case RIGHT:
1311         fputs("LO7", gpoutfile);
1312         break;
1313     default:
1314         return 0;
1315     }
1316     return 1;
1317 }
1318
1319 TERM_PUBLIC int
1320 HPGL2_set_font(const char *font)
1321 {
1322     struct termentry *t = term;
1323     char name[MAX_ID_LEN + 1];
1324     int i, sep, int_size, sep2;
1325     double size;
1326 /*
1327  * If in Polyline Encoded command, leave Polyline Encoded command
1328  */
1329     if (HPGL2_in_pe) {
1330         fputs(";\n", gpoutfile);
1331         HPGL2_in_pe = 0;
1332     }
1333 /* determine font, use default from options if invalid */
1334     sep = strcspn(font, ",");
1335     strncpy(name, font, sep);
1336     name[sep] = NUL;
1337     for (i = 0; i < HPGL2_FONTS; i++) {
1338         sep2 = strcspn(HPGL2_font_table[i].compare, "$");
1339         if (strncmp(name, HPGL2_font_table[i].compare, sep2) == 0)
1340             break;
1341     }
1342     if (i >= HPGL2_FONTS)
1343         i = HPGL2_font_num;
1344 /* determine font size, use default from options if invalid */
1345     int_size = 0;
1346     sscanf(&(font[sep + 1]), "%d", &int_size);
1347     if (int_size > 0) {
1348         size = int_size;
1349     } else
1350         size = HPGL2_point_size;
1351 /* apply font changes only if necessary */
1352     if (size == HPGL2_point_size_current && i == HPGL2_font_num_current)
1353         return FALSE;
1354     HPGL2_font = &HPGL2_font_table[i];
1355     HPGL2_font_num_current = i;
1356     HPGL2_point_size_current = size;
1357     t->v_char = (int) HPGL_PUPI *HPGL2_point_size_current / 72;
1358     t->h_char = t->v_char * 2 / 3;
1359     fprintf(gpoutfile, "SD1,%d,2,%d,", HPGL2_font->symbol_set, HPGL2_font->spacing);
1360     if (HPGL2_font->spacing) {
1361         HPGL2_font->height = HPGL2_point_size_current;
1362         fprintf(gpoutfile, "4,%f,", HPGL2_font->height);
1363     } else {
1364         HPGL2_font->pitch = 72 * 3 / (HPGL2_point_size_current * 2);
1365         fprintf(gpoutfile, "3,%f,", HPGL2_font->pitch);
1366     }
1367     fprintf(gpoutfile, "5,%d,6,%d,7,%d;SS;\n", HPGL2_font->posture, HPGL2_font->stroke_weight, HPGL2_font->typeface);
1368     return TRUE;
1369 }
1370
1371 TERM_PUBLIC void
1372 HPGL2_point(unsigned int x, unsigned int y, int number)
1373 {
1374     int htic, vtic;
1375     if (pspointset) {           /* postscript style points */
1376         if (number < 0) {
1377             HPGL2_neg_point(x, y, number);
1378         } else {
1379             htic = (int) (HPGL2_psize * PCL_HTIC / 2);
1380             vtic = (int) (HPGL2_psize * PCL_VTIC / 2);
1381             number %= HPGL2_NUM_PSPOINTS;
1382             switch (number) {
1383             case 0:             /* plus */
1384                 HPGL2_move(x - htic, y);
1385                 HPGL2_vector(x - htic, y);
1386                 HPGL2_vector(x + htic, y);
1387                 HPGL2_move(x, y - vtic);
1388                 HPGL2_vector(x, y - vtic);
1389                 HPGL2_vector(x, y + vtic);
1390                 break;
1391             case 1:             /* X */
1392                 HPGL2_move(x - htic, y - vtic);
1393                 HPGL2_vector(x - htic, y - vtic);
1394                 HPGL2_vector(x + htic, y + vtic);
1395                 HPGL2_move(x - htic, y + vtic);
1396                 HPGL2_vector(x - htic, y + vtic);
1397                 HPGL2_vector(x + htic, y - vtic);
1398                 break;
1399             case 2:             /* star */
1400                 HPGL2_move(x - htic, y);
1401                 HPGL2_vector(x - htic, y);
1402                 HPGL2_vector(x + htic, y);
1403                 HPGL2_move(x, y - vtic);
1404                 HPGL2_vector(x, y - vtic);
1405                 HPGL2_vector(x, y + vtic);
1406                 HPGL2_move(x - htic, y - vtic);
1407                 HPGL2_vector(x - htic, y - vtic);
1408                 HPGL2_vector(x + htic, y + vtic);
1409                 HPGL2_move(x - htic, y + vtic);
1410                 HPGL2_vector(x - htic, y + vtic);
1411                 HPGL2_vector(x + htic, y - vtic);
1412                 break;
1413             case 3:             /* hollow square 1 */
1414                 HPGL2_move(x - (3 * htic / 4), y - (3 * vtic / 4));
1415                 HPGL2_vector(x + (3 * htic / 4), y - (3 * vtic / 4));
1416                 HPGL2_vector(x + (3 * htic / 4), y + (3 * vtic / 4));
1417                 HPGL2_vector(x - (3 * htic / 4), y + (3 * vtic / 4));
1418                 HPGL2_vector(x - (3 * htic / 4), y - (3 * vtic / 4));
1419                 HPGL2_move(x, y);
1420                 HPGL2_vector(x, y);
1421                 break;
1422             case 4:             /* solid square 1 */
1423                 HPGL2_move(x - (3 * htic / 4), y - (3 * vtic / 4));
1424                 fputs(";\n", gpoutfile);
1425                 HPGL2_in_pe = 0;
1426                 fprintf(gpoutfile, "RA%.2f,%.2f;EP;\n", ((double) x + (3 * htic / 4)), ((double) y + (3 * vtic / 4)));
1427                 break;
1428             case 5:             /* hollow circle 1 */
1429                 HPGL2_move(x, y);
1430                 HPGL2_vector(x, y);
1431                 fputs(";\n", gpoutfile);
1432                 HPGL2_in_pe = 0;
1433                 fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
1434                 break;
1435             case 6:             /* solid circle 1 */
1436                 HPGL2_move(x, y);
1437                 fputs(";\n", gpoutfile);
1438                 HPGL2_in_pe = 0;
1439                 fprintf(gpoutfile, "WG%.2f,0,360;EP;\n", ((double) 3 * (htic) / 4));
1440                 break;
1441             case 7:             /* hollow triangle 1 */
1442                 HPGL2_move(x, y + (3 * vtic / 4));
1443                 HPGL2_vector(x - (3 * sqrt(3) * htic / 8), y - (3 * vtic / 8));
1444                 HPGL2_vector(x + (3 * sqrt(3) * htic / 8), y - (3 * vtic / 8));
1445                 HPGL2_vector(x, y + (3 * vtic / 4));
1446                 HPGL2_move(x, y);
1447                 HPGL2_vector(x, y);
1448                 break;
1449             case 8:             /* solid triangle 1 */
1450                 HPGL2_move(x, y + (3 * vtic / 4));
1451                 fputs(";\n", gpoutfile);
1452                 HPGL2_in_pe = 0;
1453                 fprintf(gpoutfile, "PM0;\n");
1454                 HPGL2_vector(x - (3 * sqrt(3) * htic / 8), y - (3 * vtic / 8));
1455                 HPGL2_vector(x + (3 * sqrt(3) * htic / 8), y - (3 * vtic / 8));
1456                 HPGL2_vector(x, y + (3 * vtic / 4));
1457                 fputs(";\n", gpoutfile);
1458                 HPGL2_in_pe = 0;
1459                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1460                 break;
1461             case 9:             /* hollow triangle 2 */
1462                 HPGL2_move(x, y - (3 * vtic / 4));
1463                 HPGL2_vector(x - (3 * sqrt(3) * htic / 8), y + (3 * vtic / 8));
1464                 HPGL2_vector(x + (3 * sqrt(3) * htic / 8), y + (3 * vtic / 8));
1465                 HPGL2_vector(x, y - (3 * vtic / 4));
1466                 HPGL2_move(x, y);
1467                 HPGL2_vector(x, y);
1468                 break;
1469             case 10:            /* solid triangle 2 */
1470                 HPGL2_move(x, y - (3 * vtic / 4));
1471                 fputs(";\n", gpoutfile);
1472                 HPGL2_in_pe = 0;
1473                 fprintf(gpoutfile, "PM0;\n");
1474                 HPGL2_vector(x - (3 * sqrt(3) * htic / 8), y + (3 * vtic / 8));
1475                 HPGL2_vector(x + (3 * sqrt(3) * htic / 8), y + (3 * vtic / 8));
1476                 HPGL2_vector(x, y - (3 * vtic / 4));
1477                 fputs(";\n", gpoutfile);
1478                 HPGL2_in_pe = 0;
1479                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1480                 break;
1481             case 11:            /* hollow diamond 1 */
1482                 HPGL2_move(x - (3 * htic / 4), y);
1483                 HPGL2_vector(x, y - (3 * vtic / 4));
1484                 HPGL2_vector(x + (3 * htic / 4), y);
1485                 HPGL2_vector(x, y + (3 * vtic / 4));
1486                 HPGL2_vector(x - (3 * htic / 4), y);
1487                 HPGL2_move(x, y);
1488                 HPGL2_vector(x, y);
1489                 break;
1490             case 12:            /* solid diamond 1 */
1491                 HPGL2_move(x - (3 * htic / 4), y);
1492                 fputs(";\n", gpoutfile);
1493                 HPGL2_in_pe = 0;
1494                 fprintf(gpoutfile, "PM0;\n");
1495                 HPGL2_vector(x, y - (3 * vtic / 4));
1496                 HPGL2_vector(x + (3 * htic / 4), y);
1497                 HPGL2_vector(x, y + (3 * vtic / 4));
1498                 HPGL2_vector(x - (3 * htic / 4), y);
1499                 fputs(";\n", gpoutfile);
1500                 HPGL2_in_pe = 0;
1501                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1502                 break;
1503             case 13:            /* hollow pentagon 1 */
1504                 HPGL2_move(x, y + (3 * vtic / 4));
1505                 HPGL2_vector(x - (cos(.1 * acos(-1)) * 3 * htic / 4), y + (sin(.1 * acos(-1)) * 3 * vtic / 4));
1506                 HPGL2_vector(x - (sin(.2 * acos(-1)) * 3 * htic / 4), y - (cos(.2 * acos(-1)) * 3 * vtic / 4));
1507                 HPGL2_vector(x + (sin(.2 * acos(-1)) * 3 * htic / 4), y - (cos(.2 * acos(-1)) * 3 * vtic / 4));
1508                 HPGL2_vector(x + (cos(.1 * acos(-1)) * 3 * htic / 4), y + (sin(.1 * acos(-1)) * 3 * vtic / 4));
1509                 HPGL2_vector(x, y + (3 * vtic / 4));
1510                 HPGL2_move(x, y);
1511                 HPGL2_vector(x, y);
1512                 break;
1513             case 14:            /* solid pentagon */
1514                 HPGL2_move(x, y + (3 * vtic / 4));
1515                 fputs(";\n", gpoutfile);
1516                 HPGL2_in_pe = 0;
1517                 fprintf(gpoutfile, "PM0;\n");
1518                 HPGL2_vector(x - (cos(.1 * acos(-1)) * 3 * htic / 4), y + (sin(.1 * acos(-1)) * 3 * vtic / 4));
1519                 HPGL2_vector(x - (sin(.2 * acos(-1)) * 3 * htic / 4), y - (cos(.2 * acos(-1)) * 3 * vtic / 4));
1520                 HPGL2_vector(x + (sin(.2 * acos(-1)) * 3 * htic / 4), y - (cos(.2 * acos(-1)) * 3 * vtic / 4));
1521                 HPGL2_vector(x + (cos(.1 * acos(-1)) * 3 * htic / 4), y + (sin(.1 * acos(-1)) * 3 * vtic / 4));
1522                 HPGL2_vector(x, y + (3 * vtic / 4));
1523                 fputs(";\n", gpoutfile);
1524                 HPGL2_in_pe = 0;
1525                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1526                 break;
1527             case 15:            /* hollow circle 2 */
1528                 HPGL2_move(x, y + vtic);
1529                 HPGL2_vector(x, y);
1530                 fputs(";\n", gpoutfile);
1531                 HPGL2_in_pe = 0;
1532                 fprintf(gpoutfile, "CI%d;\n", htic);
1533                 break;
1534             case 16:            /* semisolid circle 1 */
1535                 HPGL2_move(x, y);
1536                 fputs(";\n", gpoutfile);
1537                 HPGL2_in_pe = 0;
1538                 fprintf(gpoutfile, "WG%d,0,90;EP;EW%d,90,270;\n", htic, htic);
1539                 break;
1540             case 17:            /* semisolid circle 2 */
1541                 HPGL2_move(x, y);
1542                 fputs(";\n", gpoutfile);
1543                 HPGL2_in_pe = 0;
1544                 fprintf(gpoutfile, "WG%d,90,90;EP;EW%d,180,270;\n", htic, htic);
1545                 break;
1546             case 18:            /* semisolid circle 3 */
1547                 HPGL2_move(x, y);
1548                 fputs(";\n", gpoutfile);
1549                 HPGL2_in_pe = 0;
1550                 fprintf(gpoutfile, "WG%d,0,180;EP;EW%d,180,180;\n", htic, htic);
1551                 break;
1552             case 19:            /* semisolid circle 4 */
1553                 HPGL2_move(x, y);
1554                 fputs(";\n", gpoutfile);
1555                 HPGL2_in_pe = 0;
1556                 fprintf(gpoutfile, "WG%d,180,90;EP;EW%d,270,270;\n", htic, htic);
1557                 break;
1558             case 20:            /* semisolid circle 5 */
1559                 HPGL2_move(x, y);
1560                 fputs(";\n", gpoutfile);
1561                 HPGL2_in_pe = 0;
1562                 fprintf(gpoutfile, "WG%d,0,90;EP;EW%d,90,90;WG%d,180,90;EP;EW%d,270,90;\n", htic, htic, htic, htic);
1563                 break;
1564             case 21:            /* semisolid circle 6 */
1565                 HPGL2_move(x, y);
1566                 fputs(";\n", gpoutfile);
1567                 HPGL2_in_pe = 0;
1568                 fprintf(gpoutfile, "WG%d,90,180;EP;EW%d,270,180;\n", htic, htic);
1569                 break;
1570             case 22:            /* semisolid circle 7 */
1571                 HPGL2_move(x, y);
1572                 fputs(";\n", gpoutfile);
1573                 HPGL2_in_pe = 0;
1574                 fprintf(gpoutfile, "WG%d,0,270;EP;EW%d,270,90;\n", htic, htic);
1575                 break;
1576             case 23:            /* semisolid circle 8 */
1577                 HPGL2_move(x, y);
1578                 fputs(";\n", gpoutfile);
1579                 HPGL2_in_pe = 0;
1580                 fprintf(gpoutfile, "WG%d,270,90;EP;EW%d,0,270;\n", htic, htic);
1581                 break;
1582             case 24:            /* semisolid circle 9 */
1583                 HPGL2_move(x, y);
1584                 fputs(";\n", gpoutfile);
1585                 HPGL2_in_pe = 0;
1586                 fprintf(gpoutfile, "WG%d,270,180;EP;EW%d,90,180;\n", htic, htic);
1587                 break;
1588             case 25:            /* semisolid circle 10 */
1589                 HPGL2_move(x, y);
1590                 fputs(";\n", gpoutfile);
1591                 HPGL2_in_pe = 0;
1592                 fprintf(gpoutfile, "WG%d,90,90;EP;EW%d,180,90;WG%d,270,90;EP;EW%d,0,90;\n", htic, htic, htic, htic);
1593                 break;
1594             case 26:            /* semisolid circle 11 */
1595                 HPGL2_move(x, y);
1596                 fputs(";\n", gpoutfile);
1597                 HPGL2_in_pe = 0;
1598                 fprintf(gpoutfile, "WG%d,270,270;EP;EW%d,180,90;\n", htic, htic);
1599                 break;
1600             case 27:            /* semisolid circle 12 */
1601                 HPGL2_move(x, y);
1602                 fputs(";\n", gpoutfile);
1603                 HPGL2_in_pe = 0;
1604                 fprintf(gpoutfile, "WG%d,180,180;EP;EW%d,0,180;\n", htic, htic);
1605                 break;
1606             case 28:            /* semisolid circle 13 */
1607                 HPGL2_move(x, y);
1608                 fputs(";\n", gpoutfile);
1609                 HPGL2_in_pe = 0;
1610                 fprintf(gpoutfile, "WG%d,180,270;EP;EW%d,90,90;\n", htic, htic);
1611                 break;
1612             case 29:            /* semisolid circle 14 */
1613                 HPGL2_move(x, y);
1614                 fputs(";\n", gpoutfile);
1615                 HPGL2_in_pe = 0;
1616                 fprintf(gpoutfile, "WG%d,90,270;EP;EW%d,0,90;\n", htic, htic);
1617                 break;
1618             case 30:            /* solid circle 2 */
1619                 HPGL2_move(x, y);
1620                 fputs(";\n", gpoutfile);
1621                 HPGL2_in_pe = 0;
1622                 fprintf(gpoutfile, "WG%d,0,360;EP;\n", htic);
1623                 break;
1624             case 31:            /* hollow square 2 */
1625                 HPGL2_move(x - htic, y - vtic);
1626                 HPGL2_vector(x + htic, y - vtic);
1627                 HPGL2_vector(x + htic, y + vtic);
1628                 HPGL2_vector(x - htic, y + vtic);
1629                 HPGL2_vector(x - htic, y - vtic);
1630                 HPGL2_move(x, y + vtic);
1631                 HPGL2_vector(x, y);
1632                 break;
1633             case 32:            /* semisolid square 1 */
1634                 HPGL2_move(x, y + vtic);
1635                 HPGL2_vector(x - htic, y + vtic);
1636                 HPGL2_vector(x - htic, y - vtic);
1637                 HPGL2_vector(x + htic, y - vtic);
1638                 HPGL2_vector(x + htic, y);
1639                 HPGL2_move(x, y);
1640                 fputs(";\n", gpoutfile);
1641                 HPGL2_in_pe = 0;
1642                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y + vtic);
1643                 break;
1644             case 33:            /* semisolid square 2 */
1645                 HPGL2_move(x - htic, y);
1646                 HPGL2_vector(x - htic, y - vtic);
1647                 HPGL2_vector(x + htic, y - vtic);
1648                 HPGL2_vector(x + htic, y + vtic);
1649                 HPGL2_vector(x, y + vtic);
1650                 HPGL2_move(x - htic, y);
1651                 fputs(";\n", gpoutfile);
1652                 HPGL2_in_pe = 0;
1653                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x, y + vtic);
1654                 break;
1655             case 34:            /* semisolid square 3 */
1656                 HPGL2_move(x - htic, y);
1657                 HPGL2_vector(x - htic, y - vtic);
1658                 HPGL2_vector(x + htic, y - vtic);
1659                 HPGL2_vector(x + htic, y);
1660                 HPGL2_move(x - htic, y);
1661                 fputs(";\n", gpoutfile);
1662                 HPGL2_in_pe = 0;
1663                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y + vtic);
1664                 break;
1665             case 35:            /* semisolid square 4 */
1666                 HPGL2_move(x, y - vtic);
1667                 HPGL2_vector(x + htic, y - vtic);
1668                 HPGL2_vector(x + htic, y + vtic);
1669                 HPGL2_vector(x - htic, y + vtic);
1670                 HPGL2_vector(x - htic, y);
1671                 HPGL2_move(x - htic, y - vtic);
1672                 fputs(";\n", gpoutfile);
1673                 HPGL2_in_pe = 0;
1674                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x, y);
1675                 break;
1676             case 36:            /* semisolid square 5 */
1677                 HPGL2_move(x, y - vtic);
1678                 HPGL2_vector(x + htic, y - vtic);
1679                 HPGL2_vector(x + htic, y);
1680                 HPGL2_move(x, y + vtic);
1681                 HPGL2_vector(x - htic, y + vtic);
1682                 HPGL2_vector(x - htic, y);
1683                 HPGL2_move(x - htic, y - vtic);
1684                 fputs(";\n", gpoutfile);
1685                 HPGL2_in_pe = 0;
1686                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x, y);
1687                 HPGL2_move(x, y);
1688                 fputs(";\n", gpoutfile);
1689                 HPGL2_in_pe = 0;
1690                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y + vtic);
1691                 break;
1692             case 37:            /* semisolid square 6 */
1693                 HPGL2_move(x, y - vtic);
1694                 HPGL2_vector(x + htic, y - vtic);
1695                 HPGL2_vector(x + htic, y + vtic);
1696                 HPGL2_vector(x, y + vtic);
1697                 HPGL2_move(x - htic, y - vtic);
1698                 fputs(";\n", gpoutfile);
1699                 HPGL2_in_pe = 0;
1700                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x, y + vtic);
1701                 break;
1702             case 38:            /* semisolid square 7 */
1703                 HPGL2_move(x, y - vtic);
1704                 HPGL2_vector(x + htic, y - vtic);
1705                 HPGL2_vector(x + htic, y);
1706                 HPGL2_move(x - htic, y - vtic);
1707                 fputs(";\n", gpoutfile);
1708                 HPGL2_in_pe = 0;
1709                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x, y + vtic);
1710                 HPGL2_move(x, y);
1711                 fputs(";\n", gpoutfile);
1712                 HPGL2_in_pe = 0;
1713                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y + vtic);
1714                 break;
1715             case 39:            /* semisolid square 8 */
1716                 HPGL2_move(x + htic, y);
1717                 HPGL2_vector(x + htic, y + vtic);
1718                 HPGL2_vector(x - htic, y + vtic);
1719                 HPGL2_vector(x - htic, y - vtic);
1720                 HPGL2_vector(x, y - vtic);
1721                 fputs(";\n", gpoutfile);
1722                 HPGL2_in_pe = 0;
1723                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y);
1724                 break;
1725             case 40:            /* semisolid square 9 */
1726                 HPGL2_move(x, y + vtic);
1727                 HPGL2_vector(x - htic, y + vtic);
1728                 HPGL2_vector(x - htic, y - vtic);
1729                 HPGL2_vector(x, y - vtic);
1730                 fputs(";\n", gpoutfile);
1731                 HPGL2_in_pe = 0;
1732                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y + vtic);
1733                 break;
1734             case 41:            /* semisolid square 10 */
1735                 HPGL2_move(x - htic, y);
1736                 HPGL2_vector(x - htic, y - vtic);
1737                 HPGL2_vector(x, y - vtic);
1738                 HPGL2_move(x + htic, y);
1739                 HPGL2_vector(x + htic, y + vtic);
1740                 HPGL2_vector(x, y + vtic);
1741                 HPGL2_move(x - htic, y);
1742                 fputs(";\n", gpoutfile);
1743                 HPGL2_in_pe = 0;
1744                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x, y + vtic);
1745                 HPGL2_move(x, y - vtic);
1746                 fputs(";\n", gpoutfile);
1747                 HPGL2_in_pe = 0;
1748                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y);
1749                 break;
1750             case 42:            /* semisolid square 11 */
1751                 HPGL2_move(x - htic, y);
1752                 HPGL2_vector(x - htic, y - vtic);
1753                 HPGL2_vector(x, y - vtic);
1754                 fputs(";\n", gpoutfile);
1755                 HPGL2_in_pe = 0;
1756                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y + vtic);
1757                 HPGL2_move(x - htic, y);
1758                 fputs(";\n", gpoutfile);
1759                 HPGL2_in_pe = 0;
1760                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x, y + vtic);
1761                 break;
1762             case 43:            /* semisolid square 12 */
1763                 HPGL2_move(x + htic, y);
1764                 HPGL2_vector(x + htic, y + vtic);
1765                 HPGL2_vector(x - htic, y + vtic);
1766                 HPGL2_vector(x - htic, y);
1767                 HPGL2_move(x - htic, y - vtic);
1768                 fputs(";\n", gpoutfile);
1769                 HPGL2_in_pe = 0;
1770                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y);
1771                 break;
1772             case 44:            /* semisolid square 13 */
1773                 HPGL2_move(x, y + vtic);
1774                 HPGL2_vector(x - htic, y + vtic);
1775                 HPGL2_vector(x - htic, y);
1776                 HPGL2_move(x - htic, y - vtic);
1777                 fputs(";\n", gpoutfile);
1778                 HPGL2_in_pe = 0;
1779                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y);
1780                 HPGL2_move(x, y);
1781                 fputs(";\n", gpoutfile);
1782                 HPGL2_in_pe = 0;
1783                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y + vtic);
1784                 break;
1785             case 45:            /* semisolid square 14 */
1786                 HPGL2_move(x + htic, y);
1787                 HPGL2_vector(x + htic, y + vtic);
1788                 HPGL2_vector(x, y + vtic);
1789                 HPGL2_move(x - htic, y - vtic);
1790                 fputs(";\n", gpoutfile);
1791                 HPGL2_in_pe = 0;
1792                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y);
1793                 HPGL2_move(x - htic, y);
1794                 fputs(";\n", gpoutfile);
1795                 HPGL2_in_pe = 0;
1796                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x, y + vtic);
1797                 break;
1798             case 46:            /* solid square 2 */
1799                 HPGL2_move(x - htic, y - vtic);
1800                 fputs(";\n", gpoutfile);
1801                 HPGL2_in_pe = 0;
1802                 fprintf(gpoutfile, "RA%d,%d;EP;\n", x + htic, y + vtic);
1803                 break;
1804             case 47:            /* hollow diamond 2 */
1805                 HPGL2_move(x - htic, y);
1806                 HPGL2_vector(x, y - vtic);
1807                 HPGL2_vector(x + htic, y);
1808                 HPGL2_vector(x, y + vtic);
1809                 HPGL2_vector(x - htic, y);
1810                 HPGL2_move(x - (htic / 2), y + (vtic / 2));
1811                 HPGL2_vector(x, y);
1812                 break;
1813             case 48:            /* semisolid diamond 1 */
1814                 HPGL2_move(x - (htic / 2), y + (vtic / 2));
1815                 HPGL2_vector(x - htic, y);
1816                 HPGL2_vector(x, y - vtic);
1817                 HPGL2_vector(x + htic, y);
1818                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1819                 fputs(";\n", gpoutfile);
1820                 HPGL2_in_pe = 0;
1821                 fprintf(gpoutfile, "PM0;\n");
1822                 HPGL2_vector(x, y + vtic);
1823                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1824                 HPGL2_vector(x, y);
1825                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1826                 fputs(";\n", gpoutfile);
1827                 HPGL2_in_pe = 0;
1828                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1829                 break;
1830             case 49:            /* semisolid diamond 2 */
1831                 HPGL2_move(x - (htic / 2), y - (vtic / 2));
1832                 HPGL2_vector(x, y - vtic);
1833                 HPGL2_vector(x + htic, y);
1834                 HPGL2_vector(x, y + vtic);
1835                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1836                 fputs(";\n", gpoutfile);
1837                 HPGL2_in_pe = 0;
1838                 fprintf(gpoutfile, "PM0;\n");
1839                 HPGL2_vector(x - htic, y);
1840                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
1841                 HPGL2_vector(x, y);
1842                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1843                 fputs(";\n", gpoutfile);
1844                 HPGL2_in_pe = 0;
1845                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1846                 break;
1847             case 50:            /* semisolid diamond 3 */
1848                 HPGL2_move(x - (htic / 2), y - (vtic / 2));
1849                 HPGL2_vector(x, y - vtic);
1850                 HPGL2_vector(x + htic, y);
1851                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1852                 fputs(";\n", gpoutfile);
1853                 HPGL2_in_pe = 0;
1854                 fprintf(gpoutfile, "PM0;\n");
1855                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
1856                 HPGL2_vector(x - htic, y);
1857                 HPGL2_vector(x, y + vtic);
1858                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1859                 fputs(";\n", gpoutfile);
1860                 HPGL2_in_pe = 0;
1861                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1862                 break;
1863             case 51:            /* semisolid diamond 4 */
1864                 HPGL2_move(x + (htic / 2), y - (vtic / 2));
1865                 HPGL2_vector(x + htic, y);
1866                 HPGL2_vector(x, y + vtic);
1867                 HPGL2_vector(x - htic, y);
1868                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
1869                 fputs(";\n", gpoutfile);
1870                 HPGL2_in_pe = 0;
1871                 fprintf(gpoutfile, "PM0;\n");
1872                 HPGL2_vector(x, y);
1873                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1874                 HPGL2_vector(x, y - vtic);
1875                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
1876                 fputs(";\n", gpoutfile);
1877                 HPGL2_in_pe = 0;
1878                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1879                 break;
1880             case 52:            /* semisolid diamond 5 */
1881                 HPGL2_move(x - (htic / 2), y + (vtic / 2));
1882                 HPGL2_vector(x - htic, y);
1883                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
1884                 fputs(";\n", gpoutfile);
1885                 HPGL2_in_pe = 0;
1886                 fprintf(gpoutfile, "PM0;\n");
1887                 HPGL2_vector(x, y);
1888                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1889                 HPGL2_vector(x, y - vtic);
1890                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
1891                 fputs(";\n", gpoutfile);
1892                 HPGL2_in_pe = 0;
1893                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1894                 HPGL2_move(x + (htic / 2), y - (vtic / 2));
1895                 HPGL2_vector(x + htic, y);
1896                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1897                 fputs(";\n", gpoutfile);
1898                 HPGL2_in_pe = 0;
1899                 fprintf(gpoutfile, "PM0;\n");
1900                 HPGL2_vector(x, y + vtic);
1901                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1902                 HPGL2_vector(x, y);
1903                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1904                 fputs(";\n", gpoutfile);
1905                 HPGL2_in_pe = 0;
1906                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1907                 break;
1908             case 53:            /* semisolid diamond 6 */
1909                 HPGL2_move(x + (htic / 2), y - (vtic / 2));
1910                 HPGL2_vector(x + htic, y);
1911                 HPGL2_vector(x, y + vtic);
1912                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1913                 fputs(";\n", gpoutfile);
1914                 HPGL2_in_pe = 0;
1915                 fprintf(gpoutfile, "PM0;\n");
1916                 HPGL2_vector(x - htic, y);
1917                 HPGL2_vector(x, y - vtic);
1918                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1919                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1920                 fputs(";\n", gpoutfile);
1921                 HPGL2_in_pe = 0;
1922                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1923                 break;
1924             case 54:            /* semisolid diamond 7 */
1925                 HPGL2_move(x + (htic / 2), y - (vtic / 2));
1926                 HPGL2_vector(x + htic, y);
1927                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1928                 fputs(";\n", gpoutfile);
1929                 HPGL2_in_pe = 0;
1930                 fprintf(gpoutfile, "PM0;\n");
1931                 HPGL2_vector(x, y + vtic);
1932                 HPGL2_vector(x - htic, y);
1933                 HPGL2_vector(x, y - vtic);
1934                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1935                 HPGL2_vector(x, y);
1936                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1937                 fputs(";\n", gpoutfile);
1938                 HPGL2_in_pe = 0;
1939                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1940                 break;
1941             case 55:            /* semisolid diamond 8 */
1942                 HPGL2_move(x + (htic / 2), y + (vtic / 2));
1943                 HPGL2_vector(x, y + vtic);
1944                 HPGL2_vector(x - htic, y);
1945                 HPGL2_vector(x, y - vtic);
1946                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1947                 fputs(";\n", gpoutfile);
1948                 HPGL2_in_pe = 0;
1949                 fprintf(gpoutfile, "PM0;\n");
1950                 HPGL2_vector(x, y);
1951                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1952                 HPGL2_vector(x + htic, y);
1953                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1954                 fputs(";\n", gpoutfile);
1955                 HPGL2_in_pe = 0;
1956                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1957                 break;
1958             case 56:            /* semisolid diamond 9 */
1959                 HPGL2_move(x - (htic / 2), y + (vtic / 2));
1960                 HPGL2_vector(x - htic, y);
1961                 HPGL2_vector(x, y - vtic);
1962                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1963                 fputs(";\n", gpoutfile);
1964                 HPGL2_in_pe = 0;
1965                 fprintf(gpoutfile, "PM0;\n");
1966                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1967                 HPGL2_vector(x, y + vtic);
1968                 HPGL2_vector(x + htic, y);
1969                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1970                 fputs(";\n", gpoutfile);
1971                 HPGL2_in_pe = 0;
1972                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1973                 break;
1974             case 57:            /* semisolid diamond 10 */
1975                 HPGL2_move(x + (htic / 2), y + (vtic / 2));
1976                 HPGL2_vector(x, y + vtic);
1977                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1978                 fputs(";\n", gpoutfile);
1979                 HPGL2_in_pe = 0;
1980                 fprintf(gpoutfile, "PM0;\n");
1981                 HPGL2_vector(x, y);
1982                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
1983                 HPGL2_vector(x - htic, y);
1984                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
1985                 fputs(";\n", gpoutfile);
1986                 HPGL2_in_pe = 0;
1987                 fprintf(gpoutfile, "PM2;FP;EP;\n");
1988                 HPGL2_move(x - (htic / 2), y - (vtic / 2));
1989                 HPGL2_vector(x, y - vtic);
1990                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1991                 fputs(";\n", gpoutfile);
1992                 HPGL2_in_pe = 0;
1993                 fprintf(gpoutfile, "PM0;\n");
1994                 HPGL2_vector(x, y);
1995                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
1996                 HPGL2_vector(x + htic, y);
1997                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
1998                 fputs(";\n", gpoutfile);
1999                 HPGL2_in_pe = 0;
2000                 fprintf(gpoutfile, "PM2;FP;EP;\n");
2001                 break;
2002             case 58:            /* semisolid diamond 11 */
2003                 HPGL2_move(x - (htic / 2), y - (vtic / 2));
2004                 HPGL2_vector(x, y - vtic);
2005                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
2006                 fputs(";\n", gpoutfile);
2007                 HPGL2_in_pe = 0;
2008                 fprintf(gpoutfile, "PM0;\n");
2009                 HPGL2_vector(x, y);
2010                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
2011                 HPGL2_vector(x - htic, y);
2012                 HPGL2_vector(x, y + vtic);
2013                 HPGL2_vector(x + htic, y);
2014                 HPGL2_vector(x + (htic / 2), y - (vtic / 2));
2015                 fputs(";\n", gpoutfile);
2016                 HPGL2_in_pe = 0;
2017                 fprintf(gpoutfile, "PM2;FP;EP;\n");
2018                 break;
2019             case 59:            /* semisolid diamond 12 */
2020                 HPGL2_move(x + (htic / 2), y + (vtic / 2));
2021                 HPGL2_vector(x, y + vtic);
2022                 HPGL2_vector(x - htic, y);
2023                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
2024                 fputs(";\n", gpoutfile);
2025                 HPGL2_in_pe = 0;
2026                 fprintf(gpoutfile, "PM0;\n");
2027                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
2028                 HPGL2_vector(x + htic, y);
2029                 HPGL2_vector(x, y - vtic);
2030                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
2031                 fputs(";\n", gpoutfile);
2032                 HPGL2_in_pe = 0;
2033                 fprintf(gpoutfile, "PM2;FP;EP;\n");
2034                 break;
2035             case 60:            /* semisolid diamond 13 */
2036                 HPGL2_move(x - (htic / 2), y + (vtic / 2));
2037                 HPGL2_vector(x - htic, y);
2038                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
2039                 fputs(";\n", gpoutfile);
2040                 HPGL2_in_pe = 0;
2041                 fprintf(gpoutfile, "PM0;\n");
2042                 HPGL2_vector(x, y - vtic);
2043                 HPGL2_vector(x + htic, y);
2044                 HPGL2_vector(x, y + vtic);
2045                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
2046                 HPGL2_vector(x, y);
2047                 HPGL2_vector(x - (htic / 2), y - (vtic / 2));
2048                 fputs(";\n", gpoutfile);
2049                 HPGL2_in_pe = 0;
2050                 fprintf(gpoutfile, "PM2;FP;EP;\n");
2051                 break;
2052             case 61:            /* semisolid diamond 14 */
2053                 HPGL2_move(x + (htic / 2), y + (vtic / 2));
2054                 HPGL2_vector(x, y + vtic);
2055                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
2056                 fputs(";\n", gpoutfile);
2057                 HPGL2_in_pe = 0;
2058                 fprintf(gpoutfile, "PM0;\n");
2059                 HPGL2_vector(x - htic, y);
2060                 HPGL2_vector(x, y - vtic);
2061                 HPGL2_vector(x + htic, y);
2062                 HPGL2_vector(x + (htic / 2), y + (vtic / 2));
2063                 HPGL2_vector(x, y);
2064                 HPGL2_vector(x - (htic / 2), y + (vtic / 2));
2065                 fputs(";\n", gpoutfile);
2066                 HPGL2_in_pe = 0;
2067                 fprintf(gpoutfile, "PM2;FP;EP;\n");
2068                 break;
2069             case 62:            /* solid diamond 2 */
2070                 HPGL2_move(x - htic, y);
2071                 fputs(";\n", gpoutfile);
2072                 HPGL2_in_pe = 0;
2073                 fprintf(gpoutfile, "PM0;\n");
2074                 HPGL2_vector(x, y - vtic);
2075                 HPGL2_vector(x + htic, y);
2076                 HPGL2_vector(x, y + vtic);
2077                 HPGL2_vector(x - htic, y);
2078                 fputs(";\n", gpoutfile);
2079                 HPGL2_in_pe = 0;
2080                 fprintf(gpoutfile, "PM2;FP;EP;\n");
2081                 break;
2082             case 63:            /* hollow square 3 */
2083                 HPGL2_move(x - (3 * htic / 4), y - (3 * vtic / 4));
2084                 HPGL2_vector(x + (3 * htic / 4), y - (3 * vtic / 4));
2085                 HPGL2_vector(x + (3 * htic / 4), y + (3 * vtic / 4));
2086                 HPGL2_vector(x - (3 * htic / 4), y + (3 * vtic / 4));
2087                 HPGL2_vector(x - (3 * htic / 4), y - (3 * vtic / 4));
2088                 break;
2089             case 64:            /* hollow circle 3 */
2090                 HPGL2_move(x, y);
2091                 fputs(";\n", gpoutfile);
2092                 HPGL2_in_pe = 0;
2093                 fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
2094                 break;
2095             case 65:            /* hollow triangle 3 */
2096                 HPGL2_move(x, y + (3 * vtic / 4));
2097                 HPGL2_vector(x - (3 * sqrt(3) * htic / 8), y - (3 * vtic / 8));
2098                 HPGL2_vector(x + (3 * sqrt(3) * htic / 8), y - (3 * vtic / 8));
2099                 HPGL2_vector(x, y + (3 * vtic / 4));
2100                 break;
2101             case 66:            /* hollow triangle 4 */
2102                 HPGL2_move(x, y - (3 * vtic / 4));
2103                 HPGL2_vector(x - (3 * sqrt(3) * htic / 8), y + (3 * vtic / 8));
2104                 HPGL2_vector(x + (3 * sqrt(3) * htic / 8), y + (3 * vtic / 8));
2105                 HPGL2_vector(x, y - (3 * vtic / 4));
2106                 break;
2107             case 67:            /* hollow diamond 3 */
2108                 HPGL2_move(x - (3 * htic / 4), y);
2109                 HPGL2_vector(x, y - (3 * vtic / 4));
2110                 HPGL2_vector(x + (3 * htic / 4), y);
2111                 HPGL2_vector(x, y + (3 * vtic / 4));
2112                 HPGL2_vector(x - (3 * htic / 4), y);
2113                 break;
2114             case 68:            /* hollow pentagon 2 */
2115                 HPGL2_move(x, y + (3 * vtic / 4));
2116                 HPGL2_vector(x - (cos(.1 * acos(-1)) * 3 * htic / 4), y + (sin(.1 * acos(-1)) * 3 * vtic / 4));
2117                 HPGL2_vector(x - (sin(.2 * acos(-1)) * 3 * htic / 4), y - (cos(.2 * acos(-1)) * 3 * vtic / 4));
2118                 HPGL2_vector(x + (sin(.2 * acos(-1)) * 3 * htic / 4), y - (cos(.2 * acos(-1)) * 3 * vtic / 4));
2119                 HPGL2_vector(x + (cos(.1 * acos(-1)) * 3 * htic / 4), y + (sin(.1 * acos(-1)) * 3 * vtic / 4));
2120                 HPGL2_vector(x, y + (3 * vtic / 4));
2121                 break;
2122             case 69:            /* opaque square */
2123                 HPGL2_move(x - htic, y - vtic);
2124                 fputs(";\n", gpoutfile);
2125                 HPGL2_in_pe = 0;
2126                 fprintf(gpoutfile, "FT10,30;RA%d,%d;EP;FT;\n", x + (3 * htic / 4), y + (3 * vtic / 4));
2127                 break;
2128             case 70:            /* opaque circle */
2129                 HPGL2_move(x, y);
2130                 fputs(";\n", gpoutfile);
2131                 HPGL2_in_pe = 0;
2132                 fprintf(gpoutfile, "FT10,30;WG%.2f,0,360;EP;FT;\n", ((double) 3 * (htic) / 4));
2133                 break;
2134             case 71:            /* opaque triangle 1 */
2135                 HPGL2_move(x, y + (3 * vtic / 4));
2136                 fputs(";\n", gpoutfile);
2137                 HPGL2_in_pe = 0;
2138                 fprintf(gpoutfile, "PM0;\n");
2139                 HPGL2_vector(x - (3 * sqrt(3) * htic / 8), y - (3 * vtic / 8));
2140                 HPGL2_vector(x + (3 * sqrt(3) * htic / 8), y - (3 * vtic / 8));
2141                 HPGL2_vector(x, y + (3 * vtic / 4));
2142                 fputs(";\n", gpoutfile);
2143                 HPGL2_in_pe = 0;
2144                 fprintf(gpoutfile, "PM2;FT10,30;FP;EP;FT;\n");
2145                 break;
2146             case 72:            /* opaque triangle 2 */
2147                 HPGL2_move(x, y - (3 * vtic / 4));
2148                 fputs(";\n", gpoutfile);
2149                 HPGL2_in_pe = 0;
2150                 fprintf(gpoutfile, "PM0;\n");
2151                 HPGL2_vector(x - (3 * sqrt(3) * htic / 8), y + (3 * vtic / 8));
2152                 HPGL2_vector(x + (3 * sqrt(3) * htic / 8), y + (3 * vtic / 8));
2153                 HPGL2_vector(x, y - (3 * vtic / 4));
2154                 fputs(";\n", gpoutfile);
2155                 HPGL2_in_pe = 0;
2156                 fprintf(gpoutfile, "PM2;FT10,30;FP;EP;FT;\n");
2157                 break;
2158             case 73:            /* opaque diamond */
2159                 HPGL2_move(x - (3 * htic / 4), y);
2160                 fputs(";\n", gpoutfile);
2161                 HPGL2_in_pe = 0;
2162                 fprintf(gpoutfile, "PM0;\n");
2163                 HPGL2_vector(x, y - (3 * vtic / 4));
2164                 HPGL2_vector(x + (3 * htic / 4), y);
2165                 HPGL2_vector(x, y + (3 * vtic / 4));
2166                 HPGL2_vector(x - (3 * htic / 4), y);
2167                 fputs(";\n", gpoutfile);
2168                 HPGL2_in_pe = 0;
2169                 fprintf(gpoutfile, "PM2;FT10,30;FP;EP;FT;\n");
2170                 break;
2171             case 74:            /* opaque pentagon */
2172                 HPGL2_move(x, y + (3 * vtic / 4));
2173                 fputs(";\n", gpoutfile);
2174                 HPGL2_in_pe = 0;
2175                 fprintf(gpoutfile, "PM0;\n");
2176                 HPGL2_vector(x - (cos(.1 * acos(-1)) * 3 * htic / 4), y + (sin(.1 * acos(-1)) * 3 * vtic / 4));
2177                 HPGL2_vector(x - (sin(.2 * acos(-1)) * 3 * htic / 4), y - (cos(.2 * acos(-1)) * 3 * vtic / 4));
2178                 HPGL2_vector(x + (sin(.2 * acos(-1)) * 3 * htic / 4), y - (cos(.2 * acos(-1)) * 3 * vtic / 4));
2179                 HPGL2_vector(x + (cos(.1 * acos(-1)) * 3 * htic / 4), y + (sin(.1 * acos(-1)) * 3 * vtic / 4));
2180                 HPGL2_vector(x, y + (3 * vtic / 4));
2181                 fputs(";\n", gpoutfile);
2182                 HPGL2_in_pe = 0;
2183                 fprintf(gpoutfile, "PM2;FT10,30;FP;EP;FT;\n");
2184                 break;
2185             }
2186         }
2187     } else {                    /* default style points */
2188         if (number < 0) {
2189             HPGL2_neg_point(x, y, number);
2190         } else {
2191             htic = (int) (HPGL2_psize * PCL_HTIC / 2);
2192             vtic = (int) (HPGL2_psize * PCL_VTIC / 2);
2193             number %= HPGL2_NUM_NOPSPOINTS;
2194             switch (number) {
2195             case 0:             /* diamond */
2196                 HPGL2_move(x - htic, y);
2197                 HPGL2_vector(x, y - vtic);
2198                 HPGL2_vector(x + htic, y);
2199                 HPGL2_vector(x, y + vtic);
2200                 HPGL2_vector(x - htic, y);
2201                 HPGL2_move(x, y);
2202                 HPGL2_vector(x, y);
2203                 break;
2204             case 1:             /* plus */
2205                 HPGL2_move(x - htic, y);
2206                 HPGL2_vector(x - htic, y);
2207                 HPGL2_vector(x + htic, y);
2208                 HPGL2_move(x, y - vtic);
2209                 HPGL2_vector(x, y - vtic);
2210                 HPGL2_vector(x, y + vtic);
2211                 break;
2212             case 2:             /* box */
2213                 HPGL2_move(x - htic, y - vtic);
2214                 HPGL2_vector(x - htic, y - vtic);
2215                 HPGL2_vector(x + htic, y - vtic);
2216                 HPGL2_vector(x + htic, y + vtic);
2217                 HPGL2_vector(x - htic, y + vtic);
2218                 HPGL2_vector(x - htic, y - vtic);
2219                 HPGL2_move(x, y);
2220                 HPGL2_vector(x, y);
2221                 break;
2222             case 3:             /* X */
2223                 HPGL2_move(x - htic, y - vtic);
2224                 HPGL2_vector(x - htic, y - vtic);
2225                 HPGL2_vector(x + htic, y + vtic);
2226                 HPGL2_move(x - htic, y + vtic);
2227                 HPGL2_vector(x - htic, y + vtic);
2228                 HPGL2_vector(x + htic, y - vtic);
2229                 break;
2230             case 4:             /* triangle */
2231                 HPGL2_move(x, y + (4 * vtic / 3));
2232                 HPGL2_vector(x - (4 * htic / 3), y - (2 * vtic / 3));
2233                 HPGL2_vector(x + (4 * htic / 3), y - (2 * vtic / 3));
2234                 HPGL2_vector(x, y + (4 * vtic / 3));
2235                 HPGL2_move(x, y);
2236                 HPGL2_vector(x, y);
2237                 break;
2238             case 5:             /* star */
2239                 HPGL2_move(x - htic, y);
2240                 HPGL2_vector(x - htic, y);
2241                 HPGL2_vector(x + htic, y);
2242                 HPGL2_move(x, y - vtic);
2243                 HPGL2_vector(x, y - vtic);
2244                 HPGL2_vector(x, y + vtic);
2245                 HPGL2_move(x - htic, y - vtic);
2246                 HPGL2_vector(x - htic, y - vtic);
2247                 HPGL2_vector(x + htic, y + vtic);
2248                 HPGL2_move(x - htic, y + vtic);
2249                 HPGL2_vector(x - htic, y + vtic);
2250                 HPGL2_vector(x + htic, y - vtic);
2251                 break;
2252             }
2253         }
2254     }
2255 }
2256
2257 /*
2258  * This is for special purpose negative point types. If they are not needed,
2259  * they should be safely ignorable, but the special pointypes can be omitted
2260  * if necessary, leaving only the dot (which is -1).
2261  */
2262
2263 TERM_PUBLIC void
2264 HPGL2_neg_point(unsigned int x, unsigned int y, int number)
2265 {
2266     int htic, vtic;
2267     htic = (int) (HPGL2_psize * PCL_HTIC / 2);
2268     vtic = (int) (HPGL2_psize * PCL_VTIC / 2);
2269     switch (number) {
2270     case -20:                   /* well 18 */
2271         HPGL2_move(x - htic, y - vtic);
2272         HPGL2_vector(x + htic, y + vtic);
2273         HPGL2_move(x, y);
2274         fputs(";\n", gpoutfile);
2275         HPGL2_in_pe = 0;
2276         fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
2277         break;
2278     case -19:                   /* well 17 */
2279         HPGL2_move(x, y - vtic);
2280         HPGL2_vector(x, y - (vtic / 2));
2281         HPGL2_move(x, y + (vtic / 2));
2282         HPGL2_vector(x, y + vtic);
2283         HPGL2_move(x, y - vtic);
2284         HPGL2_vector(x - (htic / 4), y - (3 * vtic / 4));
2285         HPGL2_move(x, y - vtic);
2286         HPGL2_vector(x + (htic / 4), y - (3 * vtic / 4));
2287         HPGL2_move(x, y);
2288         fputs(";\n", gpoutfile);
2289         HPGL2_in_pe = 0;
2290         fprintf(gpoutfile, "CI%.2f;\n", ((double) (htic) / 2));
2291         break;
2292     case -18:                   /* well 16 */
2293         HPGL2_move(x - htic, y);
2294         HPGL2_vector(x + htic, y);
2295         HPGL2_move(x, y - vtic);
2296         HPGL2_vector(x, y + vtic);
2297         HPGL2_move(x, y);
2298         fputs(";\n", gpoutfile);
2299         HPGL2_in_pe = 0;
2300         fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
2301         break;
2302     case -17:                   /* well 15 */
2303         HPGL2_move(x - htic, y - vtic);
2304         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2305         HPGL2_move(x + (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2306         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2307         HPGL2_move(x + htic, y + vtic);
2308         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2309         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2310         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2311         HPGL2_move(x - htic, y);
2312         HPGL2_vector(x - (3 * htic / 4), y);
2313         HPGL2_move(x + (3 * htic / 4), y);
2314         HPGL2_vector(x + htic, y);
2315         HPGL2_move(x, y - vtic);
2316         HPGL2_vector(x, y - (3 * vtic / 4));
2317         HPGL2_move(x, y + (3 * vtic / 4));
2318         HPGL2_vector(x, y + vtic);
2319         HPGL2_move(x, y);
2320         fputs(";\n", gpoutfile);
2321         HPGL2_in_pe = 0;
2322         fprintf(gpoutfile, "EW%.2f,0,180;\n", ((double) 3 * (htic) / 4));
2323         fprintf(gpoutfile, "WG%.2f,180,180;EP;\n", ((double) 3 * (htic) / 4));
2324         break;
2325     case -16:                   /* well 14 */
2326         HPGL2_move(x - htic, y - vtic);
2327         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2328         HPGL2_move(x + htic, y + vtic);
2329         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2330         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2331         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2332         HPGL2_move(x - htic, y);
2333         HPGL2_vector(x - (3 * htic / 4), y);
2334         HPGL2_move(x + (3 * htic / 4), y);
2335         HPGL2_vector(x + htic, y);
2336         HPGL2_move(x, y + (3 * vtic / 4));
2337         HPGL2_vector(x, y + vtic);
2338         HPGL2_move(x, y);
2339         fputs(";\n", gpoutfile);
2340         HPGL2_in_pe = 0;
2341         fprintf(gpoutfile, "WG%.2f,0,360;EP;\n", ((double) 3 * (htic) / 4));
2342         break;
2343     case -15:                   /* well 13 */
2344         HPGL2_move(x - htic, y - vtic);
2345         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2346         HPGL2_move(x + (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2347         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2348         HPGL2_move(x + htic, y + vtic);
2349         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2350         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2351         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2352         HPGL2_move(x - htic, y);
2353         HPGL2_vector(x - (3 * htic / 4), y);
2354         HPGL2_move(x + (3 * htic / 4), y);
2355         HPGL2_vector(x + htic, y);
2356         HPGL2_move(x, y - vtic);
2357         HPGL2_vector(x, y - (3 * vtic / 4));
2358         HPGL2_move(x, y + (3 * vtic / 4));
2359         HPGL2_vector(x, y + vtic);
2360         HPGL2_move(x, y);
2361         fputs(";\n", gpoutfile);
2362         HPGL2_in_pe = 0;
2363         fprintf(gpoutfile, "WG%.2f,0,360;EP;\n", ((double) 3 * (htic) / 4));
2364         break;
2365     case -14:                   /* well 12 */
2366         HPGL2_move(x - htic, y - vtic);
2367         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2368         HPGL2_move(x + (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2369         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2370         HPGL2_move(x + htic, y + vtic);
2371         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2372         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2373         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2374         HPGL2_move(x - htic, y);
2375         HPGL2_vector(x - (3 * htic / 4), y);
2376         HPGL2_move(x + (3 * htic / 4), y);
2377         HPGL2_vector(x + htic, y);
2378         HPGL2_move(x, y - vtic);
2379         HPGL2_vector(x, y - (3 * vtic / 4));
2380         HPGL2_move(x, y + (3 * vtic / 4));
2381         HPGL2_vector(x, y + vtic);
2382         HPGL2_move(x, y);
2383         fputs(";\n", gpoutfile);
2384         HPGL2_in_pe = 0;
2385         fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
2386         break;
2387     case -13:                   /* well 11 */
2388         HPGL2_move(x - htic, y - vtic);
2389         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2390         HPGL2_move(x + htic, y + vtic);
2391         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2392         HPGL2_move(x, y);
2393         fputs(";\n", gpoutfile);
2394         HPGL2_in_pe = 0;
2395         fprintf(gpoutfile, "WG%.2f,0,360;EP;\n", ((double) 3 * (htic) / 4));
2396         break;
2397     case -12:                   /* well 10 */
2398         HPGL2_move(x + (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2399         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2400         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2401         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2402         HPGL2_move(x - htic, y);
2403         HPGL2_vector(x - (3 * htic / 4), y);
2404         HPGL2_move(x + (3 * htic / 4), y);
2405         HPGL2_vector(x + htic, y);
2406         HPGL2_move(x, y - vtic);
2407         HPGL2_vector(x, y - (3 * vtic / 4));
2408         HPGL2_move(x, y + (3 * vtic / 4));
2409         HPGL2_vector(x, y + vtic);
2410         HPGL2_move(x, y);
2411         fputs(";\n", gpoutfile);
2412         HPGL2_in_pe = 0;
2413         fprintf(gpoutfile, "EW%.2f,0,180;\n", ((double) 3 * (htic) / 4));
2414         fprintf(gpoutfile, "WG%.2f,180,180;EP;\n", ((double) 3 * (htic) / 4));
2415         break;
2416     case -11:                   /* well 9 */
2417         HPGL2_move(x + (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2418         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2419         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2420         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2421         HPGL2_move(x - htic, y);
2422         HPGL2_vector(x - (3 * htic / 4), y);
2423         HPGL2_move(x + (3 * htic / 4), y);
2424         HPGL2_vector(x + htic, y);
2425         HPGL2_move(x, y - vtic);
2426         HPGL2_vector(x, y - (3 * vtic / 4));
2427         HPGL2_move(x, y + (3 * vtic / 4));
2428         HPGL2_vector(x, y + vtic);
2429         HPGL2_move(x, y);
2430         fputs(";\n", gpoutfile);
2431         HPGL2_in_pe = 0;
2432         fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
2433         break;
2434     case -10:                   /* well 8 */
2435         HPGL2_move(x - htic, y);
2436         HPGL2_vector(x - (3 * htic / 4), y);
2437         HPGL2_move(x + (3 * htic / 4), y);
2438         HPGL2_vector(x + htic, y);
2439         HPGL2_move(x, y - vtic);
2440         HPGL2_vector(x, y - (3 * vtic / 4));
2441         HPGL2_move(x, y + (3 * vtic / 4));
2442         HPGL2_vector(x, y + vtic);
2443         HPGL2_move(x, y);
2444         fputs(";\n", gpoutfile);
2445         HPGL2_in_pe = 0;
2446         fprintf(gpoutfile, "EW%.2f,0,180;\n", ((double) 3 * (htic) / 4));
2447         fprintf(gpoutfile, "WG%.2f,180,180;EP;\n", ((double) 3 * (htic) / 4));
2448         break;
2449     case -9:                    /* well 7 */
2450         HPGL2_move(x - (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2451         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2452         HPGL2_move(x + (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2453         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2454         HPGL2_move(x + (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2455         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2456         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2457         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2458         HPGL2_move(x - htic, y);
2459         HPGL2_vector(x - (3 * htic / 4), y);
2460         HPGL2_move(x + (3 * htic / 4), y);
2461         HPGL2_vector(x + htic, y);
2462         HPGL2_move(x, y - vtic);
2463         HPGL2_vector(x, y - (3 * vtic / 4));
2464         HPGL2_move(x, y + (3 * vtic / 4));
2465         HPGL2_vector(x, y + vtic);
2466         HPGL2_move(x, y);
2467         fputs(";\n", gpoutfile);
2468         HPGL2_in_pe = 0;
2469         fprintf(gpoutfile, "EW%.2f,0,180;\n", ((double) 3 * (htic) / 4));
2470         fprintf(gpoutfile, "WG%.2f,180,180;EP;\n", ((double) 3 * (htic) / 4));
2471         break;
2472     case -8:                    /* well 6 */
2473         HPGL2_move(x + (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2474         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2475         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2476         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2477         HPGL2_move(x - htic, y);
2478         HPGL2_vector(x - (3 * htic / 4), y);
2479         HPGL2_move(x + (3 * htic / 4), y);
2480         HPGL2_vector(x + htic, y);
2481         HPGL2_move(x, y + (3 * vtic / 4));
2482         HPGL2_vector(x, y + vtic);
2483         HPGL2_move(x, y);
2484         fputs(";\n", gpoutfile);
2485         HPGL2_in_pe = 0;
2486         fprintf(gpoutfile, "WG%.2f,0,360;EP;\n", ((double) 3 * (htic) / 4));
2487         break;
2488     case -7:                    /* well 5 */
2489         HPGL2_move(x - (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2490         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2491         HPGL2_move(x + (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2492         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2493         HPGL2_move(x + (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2494         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2495         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2496         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2497         HPGL2_move(x - htic, y);
2498         HPGL2_vector(x - (3 * htic / 4), y);
2499         HPGL2_move(x + (3 * htic / 4), y);
2500         HPGL2_vector(x + htic, y);
2501         HPGL2_move(x, y - vtic);
2502         HPGL2_vector(x, y - (3 * vtic / 4));
2503         HPGL2_move(x, y + (3 * vtic / 4));
2504         HPGL2_vector(x, y + vtic);
2505         HPGL2_move(x, y);
2506         fputs(";\n", gpoutfile);
2507         HPGL2_in_pe = 0;
2508         fprintf(gpoutfile, "WG%.2f,0,360;EP;\n", ((double) 3 * (htic) / 4));
2509         break;
2510     case -6:                    /* well 4 */
2511         HPGL2_move(x - (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2512         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2513         HPGL2_move(x + (sqrt(2) * htic / 2), y - (sqrt(2) * vtic / 2));
2514         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y - (3 * sqrt(2) * vtic / 8));
2515         HPGL2_move(x + (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2516         HPGL2_vector(x + (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2517         HPGL2_move(x - (sqrt(2) * htic / 2), y + (sqrt(2) * vtic / 2));
2518         HPGL2_vector(x - (3 * sqrt(2) * htic / 8), y + (3 * sqrt(2) * vtic / 8));
2519         HPGL2_move(x - htic, y);
2520         HPGL2_vector(x - (3 * htic / 4), y);
2521         HPGL2_move(x + (3 * htic / 4), y);
2522         HPGL2_vector(x + htic, y);
2523         HPGL2_move(x, y - vtic);
2524         HPGL2_vector(x, y - (3 * vtic / 4));
2525         HPGL2_move(x, y + (3 * vtic / 4));
2526         HPGL2_vector(x, y + vtic);
2527         HPGL2_move(x, y);
2528         fputs(";\n", gpoutfile);
2529         HPGL2_in_pe = 0;
2530         fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
2531         break;
2532     case -5:                    /* well 3 */
2533         HPGL2_move(x, y);
2534         fputs(";\n", gpoutfile);
2535         HPGL2_in_pe = 0;
2536         fprintf(gpoutfile, "WG%.2f,0,360;EP;\n", ((double) 3 * (htic) / 4));
2537         break;
2538     case -4:                    /* well 2 */
2539         HPGL2_move(x - htic, y);
2540         HPGL2_vector(x - (3 * htic / 4), y);
2541         HPGL2_move(x + (3 * htic / 4), y);
2542         HPGL2_vector(x + htic, y);
2543         HPGL2_move(x, y - vtic);
2544         HPGL2_vector(x, y - (3 * vtic / 4));
2545         HPGL2_move(x, y + (3 * vtic / 4));
2546         HPGL2_vector(x, y + vtic);
2547         HPGL2_move(x, y);
2548         fputs(";\n", gpoutfile);
2549         HPGL2_in_pe = 0;
2550         fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
2551         break;
2552     case -3:                    /* well 1 */
2553         HPGL2_move(x, y);
2554         fputs(";\n", gpoutfile);
2555         HPGL2_in_pe = 0;
2556         fprintf(gpoutfile, "CI%.2f;\n", ((double) 3 * (htic) / 4));
2557         break;
2558     case -2:                    /* v box */
2559         HPGL2_move(x - htic, y);
2560         HPGL2_vector(x - (3 * htic / 4), y);
2561         HPGL2_move(x + (3 * htic / 4), y);
2562         HPGL2_vector(x + htic, y);
2563         HPGL2_move(x, y - vtic);
2564         HPGL2_vector(x, y - (3 * vtic / 4));
2565         HPGL2_move(x, y + (3 * vtic / 4));
2566         HPGL2_vector(x, y + vtic);
2567         HPGL2_move(x - (3 * htic / 4), y - (3 * vtic / 4));
2568         HPGL2_vector(x + (3 * htic / 4), y - (3 * vtic / 4));
2569         HPGL2_vector(x + (3 * htic / 4), y + (3 * vtic / 4));
2570         HPGL2_vector(x - (3 * htic / 4), y + (3 * vtic / 4));
2571         HPGL2_vector(x - (3 * htic / 4), y - (3 * vtic / 4));
2572         HPGL2_move(x - (htic / 2), y + (vtic / 2));
2573         HPGL2_vector(x, y - (vtic / 2));
2574         HPGL2_vector(x + (htic / 2), y + (vtic / 2));
2575         break;
2576     default:                    /* dot */
2577         HPGL2_move(x, y);
2578         HPGL2_vector(x, y);
2579         break;
2580         return;
2581     }
2582 }
2583
2584 TERM_PUBLIC void
2585 HPGL2_pointsize(double size)
2586 {
2587     HPGL2_psize = (size >= 0 ? size : 1);
2588 }
2589
2590 #endif /* TERM_BODY */
2591
2592 #ifdef TERM_TABLE
2593 TERM_TABLE_START(hpgl_driver)
2594     "hpgl", "HP7475 and relatives [number of pens] [eject]",
2595     HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
2596     HPGL_VTIC, HPGL_HTIC, HPGL_options, HPGL_init, HPGL_reset,
2597     HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
2598     HPGL_linetype, HPGL_put_text, HPGL_text_angle, null_justify_text, do_point, do_arrow, set_font_null TERM_TABLE_END(hpgl_driver)
2599 #undef LAST_TERM
2600 #define LAST_TERM hpgl_driver
2601     TERM_TABLE_START(pcl5_driver)
2602     "pcl5", "HP Designjet 750C, HP Laserjet III/IV, etc. (many options)",
2603     PCL_XMAX, PCL_YMAX, HPGL2_VCHAR, HPGL2_HCHAR,
2604     PCL_VTIC, PCL_HTIC, PCL_options, PCL_init, PCL_reset,
2605     PCL_text, null_scale, PCL_graphics, HPGL2_move, HPGL2_vector,
2606     HPGL2_linetype, HPGL2_put_text, HPGL2_text_angle,
2607     HPGL2_justify_text, HPGL2_point, do_arrow, HPGL2_set_font, HPGL2_pointsize TERM_TABLE_END(pcl5_driver)
2608 #undef LAST_TERM
2609 #define LAST_TERM pcl5_driver
2610 #endif /* TERM_TABLE */
2611 #endif /* TERM_PROTO_ONLY */
2612 #ifdef TERM_HELP
2613 START_HELP(hpgl)
2614 "1 hpgl",
2615 "?commands set terminal hpgl",
2616 "?set terminal hpgl",
2617 "?set term hpgl",
2618 "?terminal hpgl",
2619 "?term hpgl",
2620 "?hpgl",
2621 "?commands set terminal pcl5",
2622 "?set terminal pcl5",
2623 "?set term pcl5",
2624 "?terminal pcl5",
2625 "?term pcl5",
2626 "?pcl5",
2627 " The `hpgl` driver produces HPGL output for devices like the HP7475A plotter.",
2628 " There are two options which can be set: the number of pens and `eject`,",
2629 " which tells the plotter to eject a page when done.  The default is to use 6",
2630 " pens and not to eject the page when done.",
2631 "",
2632 " The international character sets ISO-8859-1 and CP850 are recognized via",
2633 " `set encoding iso_8859_1` or `set encoding cp850` (see `set encoding` for",
2634 " details).",
2635 "",
2636 " Syntax:",
2637 "       set terminal hpgl {<number_of_pens>} {eject}",
2638 "",
2639 " The selection",
2640 "",
2641 "       set terminal hpgl 8 eject",
2642 "",
2643 " is equivalent to the previous `hp7550` terminal, and the selection",
2644 "",
2645 "       set terminal hpgl 4",
2646 "",
2647 " is equivalent to the previous `hp7580b` terminal.",
2648 "",
2649 " The `pcl5` driver supports plotters such as the Hewlett-Packard Designjet",
2650 " 750C, the Hewlett-Packard Laserjet III, and the Hewlett-Packard Laserjet IV.",
2651 " It actually uses HPGL-2, but there is a name conflict among the terminal",
2652 " devices.  It has several options which must be specified in the order",
2653 " indicated below:",
2654 "",
2655 " Syntax:",
2656 "       set terminal pcl5 {mode <mode>} {<plotsize>}",
2657 "           {{color {<number_of_pens>}} | monochrome} {solid | dashed}",
2658 "           {font <font>} {size <fontsize>} {pspoints | nopspoints}",
2659 "",
2660 " <mode> is `landscape` or `portrait`. <plotsize> is the physical",
2661 " plotting size of the plot, which is one of the following: `letter` for",
2662 " standard (8 1/2\" X 11\") displays, `legal` for (8 1/2\" X 14\") displays,",
2663 " `noextended` for (36\" X 48\") displays (a letter size ratio) or,",
2664 " `extended` for (36\" X 55\") displays (almost a legal size ratio).",
2665 " `color` is for multi-pen (i.e. color) plots, and <number_of_pens> is",
2666 " the number of pens (i.e. colors) used in color plots. `monochrome` is for",
2667 " one (e.g. black) pen plots. `solid` draws all lines as solid lines, or",
2668 " `dashed` will draw lines with different dashed and dotted line patterns.",
2669 " <font> is `stick`, `univers`, `cg_times`, `zapf_dingbats`, `antique_olive`,",
2670 " `arial`, `courier`, `garamond_antigua`, `letter_gothic`, `cg_omega`,",
2671 " `albertus`, `times_new_roman`, `clarendon`, `coronet`, `marigold`,",
2672 " `truetype_symbols`, or `wingdings`. <fontsize> is the font size in points.",
2673 " The point type selection can be the standard default set by specifying",
2674 " `nopspoints`, or the same set of point types found in the postscript terminal",
2675 " by specifying `pspoints`.",
2676 "",
2677 " Note that built-in support of some of these options is printer device",
2678 " dependent. For instance, all the fonts are supposedly supported by the HP",
2679 " Laserjet IV, but only a few (e.g. univers, stick) may be supported by the HP",
2680 " Laserjet III and the Designjet 750C. Also, color obviously won't work on the",
2681 " the laserjets since they are monochrome devices.",
2682 "",
2683 " Defaults: landscape, noextended, color (6 pens), solid, univers, 12 point,",
2684 "           and nopspoints.",
2685 "",
2686 " With `pcl5` international characters are handled by the printer; you just put",
2687 " the appropriate 8-bit character codes into the text strings.  You don't need",
2688 " to bother with `set encoding`.",
2689 "",
2690 " HPGL graphics can be imported by many software packages."
2691 END_HELP(hpgl)
2692 #endif /* TERM_HELP */