FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
gnuplot-old/term/post.trm at master · gnuplot/gnuplot-old · GitHub
gnuplot
gnuplot-old
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
gnuplot-old
/
term
/
post.trm
Copy path
More file actions
More file actions
Latest commit
History
History
History
5031 lines (4564 loc) · 164 KB
Breadcrumbs
gnuplot-old
/
term
/
post.trm
Copy path
File metadata and controls
5031 lines (4564 loc) · 164 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Hello, Emacs: this is -*-C-*- !
* $Id: post.trm,v 1.300 2017-07-17 05:40:46 sfeam Exp $
*/
/* GNUPLOT - post.trm */
/*[
* Copyright 1990 - 1993, 1998, 1999, 2000, 2001, 2004
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the complete modified source code. Modifications are to
* be distributed as patches to the released version. Permission to
* distribute binaries produced by compiling modified sources is granted,
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
]*/
/*
* This terminal driver supports:
* postscript
*
* AUTHORS
* Russell Lang <rjl@monu1.cc.monash.edu.au>
*
* modified 10/5/95 by drd - put in support for other postscript drivers
* (enhpost, pslatex, ...) so they dont have to work quite so hard
*
* send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
*
* The 'postscript' driver produces landscape output 10" wide and 7" high.
* To change font to Times-Roman and font size to 20pts use
* 'set term postscript "Times-Roman" 20'.
* To get a smaller (5" x 3.5") eps output use 'set term post eps'
* and make only one plot per file. Font size for eps will be half
* the specified size.
*
* Erik Luijten 30/5/97: added %%CreationDate, made %%DocumentFonts conform
* to DSC, added version no. and patchl. to %%Creator
* Petr Mikulik, Jan 1999: terminal entries for PM3D functionality
*
* Dick Crawford 24/5/00: added 'a{}{}' syntax to allow for overprinting
*
* Dan Sebald, 7 March 2003: terminal entry for image functionality
*
* Harald Harders (h.harders@tu-bs.de), 2004-12-02:
* Moved all terminal settings into a single structure.
*
* Harald Harders (h.harders@tu-bs.de), 2005-02-08:
* Merged functionality of postscript, pslatex, pstex, and epslatex terminals.
*
* Ethan Merritt Mar 2006: Break out prolog and character encodings into
* separate files loaded at runtime
*
* Thomas Henlich Sep 2007: Add support for UTF-8 encoding via the glyphshow
* operator. It supports PostScript Type1 fonts that use glyph names according
* to the Adobe Glyph List For New Fonts.
*
* Christoph Bersch Nov 2011 (cvs Apr 2013): Add support for Level 3 /FlateDecode
* filter for plotstyle 'with image'.
*
* Ethan Merritt Sep 2016: Support rotatation of boxed text, including text
* strings using the glyphshow mechanism. Special-case the 'minus sign' glyph
* at U+2212 by unconditionally mapping it to /minus.
*/
#include
"driver.h"
#ifdef
TERM_PROTO
#include
"variable.h"
/* For loadpath_handler used in PS_dump_prologue_file */
#endif
#ifdef
TERM_REGISTER
register_term
(
post
)
#endif
#ifdef
TERM_PROTO
TERM_PUBLIC
void
PS_options
__PROTO
((
void
));
TERM_PUBLIC
void
PS_common_init
__PROTO
((
TBOOLEAN
uses_fonts
,
unsigned
int
xoff
,
unsigned
int
yoff
,
unsigned
int
bb_xmin
,
unsigned
int
bb_ymin
,
unsigned
int
bb_xmax
,
unsigned
int
bb_ymax
,
const
char
*
*
dict
));
TERM_PUBLIC
void
PS_init
__PROTO
((
void
));
TERM_PUBLIC
void
PS_graphics
__PROTO
((
void
));
TERM_PUBLIC
void
PS_text
__PROTO
((
void
));
TERM_PUBLIC
void
PS_reset
__PROTO
((
void
));
TERM_PUBLIC
void
PS_linetype
__PROTO
((
int
linetype
));
TERM_PUBLIC
void
PS_dashtype
__PROTO
((
int
type
,
t_dashtype
*
custom_dash_type
));
TERM_PUBLIC
void
PS_move
__PROTO
((
unsigned
int
x
,
unsigned
int
y
));
TERM_PUBLIC
void
PS_vector
__PROTO
((
unsigned
int
x
,
unsigned
int
y
));
TERM_PUBLIC
void
PS_put_text
__PROTO
((
unsigned
int
x
,
unsigned
int
y
,
const
char
*
str
));
TERM_PUBLIC
int
PS_text_angle
__PROTO
((
int
ang
));
TERM_PUBLIC
int
PS_justify_text
__PROTO
((
enum
JUSTIFY
mode
));
TERM_PUBLIC
void
PS_point
__PROTO
((
unsigned
int
x
,
unsigned
int
y
,
int
number
));
TERM_PUBLIC
void
PS_arrow
__PROTO
((
unsigned
int
sx
,
unsigned
int
sy
,
unsigned
int
ex
,
unsigned
int
ey
,
int
head
));
TERM_PUBLIC
int
PS_set_font
__PROTO
((
const
char
*
font
));
TERM_PUBLIC
void
PS_fillbox
__PROTO
((
int
style
,
unsigned
int
x1
,
unsigned
int
y1
,
unsigned
int
width
,
unsigned
int
height
));
TERM_PUBLIC
void
PS_linewidth
__PROTO
((
double
linewidth
));
/* JFi [linewidth] */
TERM_PUBLIC
void
PS_pointsize
__PROTO
((
double
ptsize
));
/* JFi [pointsize] */
TERM_PUBLIC
int
PS_make_palette
(
t_sm_palette
*
);
TERM_PUBLIC
void
PS_previous_palette
(
void
);
TERM_PUBLIC
void
PS_set_color
(
t_colorspec
*
);
TERM_PUBLIC
void
PS_filled_polygon
(
int
,
gpiPoint
*
);
TERM_PUBLIC
void
PS_image
__PROTO
((
unsigned
int
,
unsigned
int
,
coordval
*
,
gpiPoint
*
,
t_imagecolor
));
/* To support "set term post enhanced" */
TERM_PUBLIC
void
ENHPS_put_text
__PROTO
((
unsigned
int
x
,
unsigned
int
y
,
const
char
*
str
));
TERM_PUBLIC
int
ENHPS_set_font
__PROTO
((
const
char
*
font
));
TERM_PUBLIC
void
ENHPS_OPEN
__PROTO
((
char
*
fontname
,
double
fontsize
,
double
base
,
TBOOLEAN
widthflag
,
TBOOLEAN
showflag
,
int
overprint
));
TERM_PUBLIC
void
ENHPS_FLUSH
__PROTO
((
void
));
TERM_PUBLIC
void
ENHPS_WRITEC
__PROTO
((
int
c
));
static
void
PS_RememberFont
__PROTO
((
char
*
fname
));
TERM_PUBLIC
char
*
PS_escape_string
__PROTO
((
char
*
origstr
,
char
*
escapelist
));
TERM_PUBLIC
void
PS_path
__PROTO
((
int
p
));
static
TBOOLEAN
PS_newpath
=
FALSE;
static
TBOOLEAN
ENHps_opened_string
=
FALSE;
/* try to cut out empty ()'s */
TERM_PUBLIC
void
PS_layer
__PROTO
((
t_termlayer
syncpoint
));
#ifdef
EAM_BOXED_TEXT
TERM_PUBLIC
void
ENHPS_boxed_text
__PROTO
((
unsigned
int
,
unsigned
int
,
int
));
#endif
static
int
PS_in_textbox
=
0
;
#endif
/* TERM_PROTO */
#ifndef
TERM_PROTO_ONLY
#ifdef
TERM_BODY
#include
"post.h"
#ifdef
HAVE_GD_PNG
#include
"gd.h"
#define
HAVE_DEFLATE_ENCODER
#else
#ifdef
HAVE_CAIROPDF
#include
"wxterminal/gp_cairo.h"
#define
HAVE_DEFLATE_ENCODER
#endif
#endif
#define
PS_FLUSH_PATH
do { \
if (ps_path_count) { \
fputs("stroke\n", gppsfile); \
ps_path_count = 0; \
PS_relative_ok = FALSE; \
} \
} while (0)
/* Data structure implementing inclusion of font files */
struct
ps_fontfile_def
{
struct
ps_fontfile_def
*
next
;
/* pointer to next fontfile in linked list */
char
*
fontfile_name
;
char
*
fontfile_fullname
;
char
*
fontname
;
};
/* Terminal type of postscript dialect */
enum
PS_TERMINALTYPE
{
PSTERM_PSTEX
,
PSTERM_PSLATEX
,
PSTERM_EPSLATEX
,
PSTERM_POSTSCRIPT
};
enum
PS_PSFORMAT
{
PSTERM_EPS
,
PSTERM_PORTRAIT
,
PSTERM_LANDSCAPE
};
/* One struct that takes all terminal parameters
* by Harald Harders <h.harders@tu-bs.de> */
typedef
struct
ps_params_t
{
enum
PS_TERMINALTYPE
terminal
;
int
xoff
;
int
yoff
;
enum
PS_PSFORMAT
psformat
;
TBOOLEAN
level1
;
TBOOLEAN
level3
;
TBOOLEAN
color
;
TBOOLEAN
blacktext
;
TBOOLEAN
solid
;
float
dash_length
;
float
linewidth_factor
;
float
pointscale_factor
;
TBOOLEAN
duplex_option
;
/* one of duplex or simplex specified? */
TBOOLEAN
duplex_state
;
TBOOLEAN
rounded
;
/* rounded linecaps and linejoins */
TBOOLEAN
clipped
;
/* path clipped to BoundingBox? */
struct
ps_fontfile_def
*
first_fontfile
;
char
font
[
MAX_ID_LEN
+
1
];
/* name of font */
float
fontsize
;
/* size of font in pts */
float
fontscale
;
/* multiplier for nominal font size */
TBOOLEAN
useauxfile
;
/* only necessary for ps(la)tex */
TBOOLEAN
rotate
;
/* only necessary for ps(la)tex */
int
palfunc_samples
;
/* setable via "palf$uncparam" */
double
palfunc_deviation
;
/* terminal option */
TBOOLEAN
oldstyle
;
TBOOLEAN
epslatex_standalone
;
TBOOLEAN
adobeglyphnames
;
/* Choice of output names for UTF8 */
rgb_color
background
;
}
ps_params_t
;
#define
POST_PARAMS_DEFAULT
{ \
PSTERM_POSTSCRIPT, 50, 50, \
PSTERM_LANDSCAPE, FALSE, FALSE, FALSE, FALSE, FALSE, 1.0, 1.0, 1.0, FALSE, \
FALSE, FALSE, FALSE, NULL, "Helvetica", 14., 1., FALSE, FALSE, 2000, 0.003, \
FALSE, TRUE, FALSE, {-1.,-1.,-1.} \
}
static
ps_params_t
post_params
=
POST_PARAMS_DEFAULT
;
static
const
ps_params_t
post_params_default
=
POST_PARAMS_DEFAULT
;
#define
EPSLATEX_PARAMS_DEFAULT
{ \
PSTERM_EPSLATEX, 50, 50, \
PSTERM_EPS, FALSE, FALSE, FALSE, TRUE, FALSE, 1.0, 1.0, 1.0, FALSE, \
FALSE, FALSE, FALSE, NULL, "", 11., 1., TRUE, FALSE, 2000, 0.003, \
FALSE, FALSE, FALSE, {-1.,-1.,-1.} \
}
static
ps_params_t
epslatex_params
=
EPSLATEX_PARAMS_DEFAULT
;
static
const
ps_params_t
epslatex_params_default
=
EPSLATEX_PARAMS_DEFAULT
;
#define
PSLATEX_PARAMS_DEFAULT
{ \
PSTERM_PSLATEX, 0, 0, \
PSTERM_EPS, FALSE, FALSE, FALSE, TRUE, FALSE, 1.0, 1.0, 1.0, FALSE, \
FALSE, FALSE, FALSE, NULL, "", 0., 1., FALSE, TRUE, 2000, 0.003, \
FALSE, FALSE, FALSE, {-1.,-1.,-1.} \
}
static
ps_params_t
pslatex_params
=
PSLATEX_PARAMS_DEFAULT
;
static
const
ps_params_t
pslatex_params_default
=
PSLATEX_PARAMS_DEFAULT
;
#define
PSTEX_PARAMS_DEFAULT
{ \
PSTERM_PSTEX, 0, 0, \
PSTERM_EPS, FALSE, FALSE, FALSE, TRUE, FALSE, 1.0, 1.0, 1.0, FALSE, \
FALSE, FALSE, FALSE, NULL, "", 0., 1., FALSE, TRUE, 2000, 0.003, \
FALSE, FALSE, FALSE, {-1.,-1.,-1.} \
}
static
ps_params_t
pstex_params
=
PSTEX_PARAMS_DEFAULT
;
static
const
ps_params_t
pstex_params_default
=
PSTEX_PARAMS_DEFAULT
;
static
ps_params_t
*
ps_params
=
&
post_params
;
static
void
make_interpolation_code
__PROTO
((
void
));
static
void
make_color_model_code
__PROTO
((
void
));
static
char
*
save_space
__PROTO
((
double
gray
));
static
void
write_component_array
__PROTO
((
const
char
*
text
,
gradient_struct
*
grad
,
int
cnt
,
int
offset
));
static
void
write_gradient_definition
__PROTO
((
gradient_struct
*
gradient
,
int
cnt
));
static
void
write_color_space
__PROTO
((
t_sm_palette
*
palette
));
static
void
make_palette_formulae
__PROTO
((
void
));
static
void
PS_make_header
__PROTO
((
t_sm_palette
*
palette
));
static
void
PS_skip_image
__PROTO
((
int
bytes
,
int
x0
,
int
y0
,
int
dx
,
int
dy
));
#ifndef
GNUPLOT_PS_DIR
static
void
PS_dump_header_to_file
__PROTO
((
char
*
name
));
#endif
static
float
ps_fontsize
;
static
float
ps_fontsize_previous
;
/* for enhanced mode, we keep a separate font name and size, which
* is restored to the default value on font of ""
*/
static
char
ps_enh_font
[
MAX_ID_LEN
+
1
];
static
float
ps_enh_fontsize
;
static
int
ENHPS_initialized
;
static
int
ps_page
=
0
;
/* page count */
static
int
ps_path_count
=
0
;
/* count of lines in path */
static
int
ps_ang
=
0
;
/* text angle */
static
enum
JUSTIFY
ps_justify
=
LEFT
;
/* text is flush left */
static
void
delete_ps_fontfile
__PROTO
((
struct
ps_fontfile_def
*
,
struct
ps_fontfile_def
*
));
TERM_PUBLIC
void
PS_load_fontfile
__PROTO
((
struct
ps_fontfile_def
*
,
TBOOLEAN
));
TERM_PUBLIC
void
PS_load_fontfiles
__PROTO
((
TBOOLEAN
));
static
TBOOLEAN
ps_explicit_size
=
FALSE;
static
size_units
ps_explicit_units
=
INCHES
;
static
int
eps_explicit_x
=
0
;
static
int
eps_explicit_y
=
0
;
static
TBOOLEAN
PS_border
=
FALSE;
#define
DOTS_PER_INCH
(300)
/* resolution of printer we expect to use */
/* name of auxiliary file */
static
char
*
pslatex_auxname
=
NULL
;
/* Routine to copy pre-existing prolog files into output stream */
static
FILE
*
PS_open_prologue_file
__PROTO
((
char
*
));
static
void
PS_dump_prologue_file
__PROTO
((
char
*
));
static
void
PS_load_glyphlist
__PROTO
((
void
));
static
const
char
GPFAR
*
GPFAR
OldEPSL_linetypes
[]
=
{
/* Line Types */
"% Redefine line types to match old epslatex driver\n"
,
"/LTw { PL [] 1 setgray } def\n"
,
/* background (assumed white) */
"/LTb { BL [] 0 0 0 DL } def\n"
,
/* border */
"/LTa { AL [1 udl mul 2 udl mul] 0 setdash 0 0 0 setrgbcolor } def\n"
,
/* axes */
"/LT0 { PL [] 1 0 0 DL } def\n"
,
"/LT1 { PL [8 dl1 5 dl1] 0 0 1 DL } def\n"
,
"/LT2 { PL [4 dl1 4 dl1] 0 1 1 DL } def\n"
,
"/LT3 { PL [8 dl1 5 dl1 0.5 dl1 5 dl1] 1 0 1 DL } def\n"
,
NULL
};
static
const
char
GPFAR
*
GPFAR
ENHPS_header
[]
=
{
/* For MFshow and MFwidth the tos is an array with the string and font info: */
/* [<fontname (a string)> <fontsize> <vertical offset> <width significant?> <printed?> <overprint> <text string>] */
/* EAM Mar 2004 - Add in a special case overprint 3 = save, overprint 4 = restore */
/* EAM Nov 2007 - Accommodate UTF-8 support (Gshow) */
/* EAM Sep 2016 - rotatable textbox */
"/Metrics {ExtendTextBox Gswidth} def\n"
,
"/Lwidth {currentpoint stroke M 0 vshift R Metrics} def\n"
,
"/Rwidth {currentpoint stroke M dup stringwidth pop neg vshift R Metrics} def\n"
,
"/Cwidth {currentpoint stroke M dup stringwidth pop -2 div vshift R Metrics} def\n"
,
"/GLwidth {currentpoint stroke M 0 vshift R {ExtendTextBox} forall} def\n"
,
"/GRwidth {currentpoint stroke M dup Gwidth vshift R {ExtendTextBox} forall} def\n"
,
"/GCwidth {currentpoint stroke M dup Gwidth 2 div vshift R {ExtendTextBox} forall} def\n"
,
"/GLwidth2 {0 Gwidth AddGlyphWidth} def\n"
,
"/GRwidth2 {Gwidth -1 mul 0 AddGlyphWidth} def\n"
,
"/GCwidth2 {Gwidth 2 div dup -1 mul AddGlyphWidth} def\n"
,
"/AddGlyphWidth { dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse\n"
,
" dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse } def\n"
,
"/MFshow {\n"
,
" { dup 5 get 3 ge\n"
,
/* EAM test for overprint 3 or 4 */
" { 5 get 3 eq {gsave} {grestore} ifelse }\n"
,
/* EAM */
" {dup dup 0 get findfont exch 1 get scalefont setfont\n"
,
" [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6\n"
,
" get exch 4 get {textshow} {Metrics pop 0 R} ifelse }if dup 5 get 0 eq\n"
,
" {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5\n"
,
" get 1 eq {dup 2 get exch dup 3 get exch 6 get Gswidth pop -2 div\n"
,
" dup 0 R} {dup 6 get Gswidth pop -2 div 0 R 6 get\n"
,
" textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop\n"
,
" pop aload pop M} ifelse }ifelse }ifelse }\n"
,
" ifelse }\n"
,
/* EAM */
" forall} def\n"
,
/* get the width of the text */
/* HH 2005-07-24 - Add in a special case overprint 3 = save, 4 = restore
* also for estimation of string width. This is done by interposing an
* additional value on the stack. between XYsave and XYrestore,
* this number is increased by the strings. By pop'ing this number, all
* strings between XYsave and XYrestore are ignored. */
/* EAM Nov 2007 - GSwidth is to allow the operator to work either with a string
* or with a glyph. Needed for UTF-8 support. Gwidth may do it better. */
"/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def\n"
,
"/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }\n"
,
" {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont\n"
,
" 6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def\n"
,
/* flush left show */
"/MLshow { currentpoint stroke M\n"
,
" 0 exch R\n Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def\n"
,
/* flush right show */
"/MRshow { currentpoint stroke M\n"
,
" exch dup MFwidth neg 3 -1 roll R\n Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def\n"
,
/* centred show */
"/MCshow { currentpoint stroke M\n"
,
" exch dup MFwidth -2 div 3 -1 roll R\n Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def\n"
,
/* Save and restore for @-text (phantom box) */
"/XYsave { [( ) 1 2 true false 3 ()] } bind def\n"
,
"/XYrestore { [( ) 1 2 true false 4 ()] } bind def\n"
,
NULL
};
#ifdef
EAM_BOXED_TEXT
static
const
char
GPFAR
psi4
[]
=
"\
%%\n\
%% Support for boxed text - Ethan A Merritt Sep 2016\n%%\n\
/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put\n\
userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put\n\
/Boxing true def } def\n\
/ExtendTextBox { dup type /stringtype eq\n\
{ Boxing { gsave dup false charpath pathbbox\n\
dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse\n\
dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse\n\
dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse\n\
dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse\n\
grestore } if }\n\
{} ifelse} def\n\
/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M\n\
TBx1 TBxmargin sub TBy2 TBymargin add L\n\
TBx2 TBxmargin add TBy2 TBymargin add L\n\
TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def\n\
/DrawTextBox { PopTextBox stroke /Boxing false def} def\n\
/FillTextBox { gsave PopTextBox fill grestore /Boxing false def} def\n\
0 0 0 0 InitTextBox\n\
/TBxmargin 20 def\n\
/TBymargin 20 def\n\
/Boxing false def\n\
/textshow { ExtendTextBox Gshow } def\n%%\n"
;
#endif
/* external/internal prologue files machinery */
#if
defined(
GNUPLOT_PS_DIR
)
# if
defined(
_WIN32
)
# include
"win/winmain.h"
# elif
defined(
OS2
)
# define
INCL_DOSPROCESS
# define
INCL_DOSMODULEMGR
# include
<os2.h>
# endif
/* _WIN32 || OS2 */
#else
/* GNUPLOT_PS_DIR */
# include
"PostScript/prologues.h"
#endif
/* GNUPLOT_PS_DIR */
/* added to enhpost by Matt Heffron <heffron@falstaff.css.beckman.com> */
/* moved to post.trm by drd */
static
struct
PS_FontName
{
char
*
name
;
struct
PS_FontName
*
next
;
}
*
PS_DocFonts
=
NULL
;
static
char
PS_default_font
[
MAX_ID_LEN
+
1
]
=
{
'H'
,
'e'
,
'l'
,
'v'
,
'e'
,
't'
,
'i'
,
'c'
,
'a'
,
','
,
'1'
,
'4'
,
'\0'
};
/* given a font, look in store to see if it is there already
* if so, return NULL. If not, reencode it if allowed to, otherwise
* return an appropriate re-encode string
*/
static
void
PS_RememberFont
(
char
*
fname
)
{
struct
PS_FontName
*
fnp
;
char
*
recode
=
NULL
;
char
*
myfname
=
"Symbol"
;
if
(
strcmp
(
fname
,
"Symbol-Oblique"
)
!=
0
)
myfname
=
fname
;
for
(
fnp
=
PS_DocFonts
;
fnp
;
fnp
=
fnp
->
next
)
if
(
strcmp
(
fnp
->
name
,
myfname
)
==
0
)
return
;
/* Ignore it if illegal characters will corrupt the PostScript syntax */
if
(
strpbrk
(
myfname
,
"{}[]() "
))
return
;
/* we have not seen this font before; store name and apply encoding */
fnp
=
(
struct
PS_FontName
*
)
gp_alloc
(
sizeof
(
struct
PS_FontName
),
"PostScript Font record"
);
fnp
->
name
=
gp_strdup
(
myfname
);
fnp
->
next
=
PS_DocFonts
;
PS_DocFonts
=
fnp
;
switch
(
encoding
) {
case
S_ENC_ISO8859_1
:
case
S_ENC_UTF8
:
recode
=
"reencodeISO def\n"
;
break
;
case
S_ENC_ISO8859_2
:
recode
=
"reencodeISO2 def\n"
;
break
;
case
S_ENC_ISO8859_9
:
/* ISO8859-9 is Latin5 */
case
S_ENC_CP1254
:
recode
=
"reencodeISO9 def\n"
;
break
;
case
S_ENC_ISO8859_15
:
/* ISO8859-15 is Latin9 */
recode
=
"reencodeISO15 def\n"
;
break
;
case
S_ENC_CP437
:
recode
=
"reencodeCP437 def\n"
;
break
;
case
S_ENC_CP850
:
recode
=
"reencodeCP850 def\n"
;
break
;
case
S_ENC_CP852
:
recode
=
"reencodeCP852 def\n"
;
break
;
case
S_ENC_KOI8_R
:
recode
=
"reencodeKOI8R def\n"
;
break
;
case
S_ENC_CP1250
:
recode
=
"reencodeCP1250 def\n"
;
break
;
case
S_ENC_CP1251
:
recode
=
"reencodeCP1251 def\n"
;
break
;
case
S_ENC_CP1252
:
recode
=
"reencodeCP1252 def\n"
;
break
;
case
S_ENC_KOI8_U
:
recode
=
"reencodeKOI8U def\n"
;
break
;
default
:
/* do nothing */
break
;
}
if
(
recode
) {
if
(
ENHps_opened_string
)
ENHPS_FLUSH
();
fprintf
(
gppsfile
,
"/%s %s"
,
fnp
->
name
,
recode
);
}
return
;
}
char
*
PS_escape_string
(
char
*
origstr
,
char
*
escapelist
)
{
char
*
newstr
;
char
*
n
;
if
(!
origstr
||
!
*
origstr
)
return
NULL
;
newstr
=
gp_alloc
(
2
*
strlen
(
origstr
)
+
1
,
"PS_escape_string"
);
for
(
n
=
newstr
;
*
origstr
;
*
n
++
=
*
origstr
++
) {
if
(
strchr
(
escapelist
,
*
origstr
))
*
n
++
=
'\\'
;
}
*
n
=
'\0'
;
return
newstr
;
}
static
int
PS_pen_x
,
PS_pen_y
;
static
int
PS_taken
;
static
int
PS_linetype_last
;
static
double
PS_linewidth_last
;
static
double
PS_linewidth_current
;
static
TBOOLEAN
PS_relative_ok
;
/* HBB 990914: PS_SOLID is already used by the WIN32 API headers.
* Renamed to PS_SOLIDE, therefore... */
enum
PS_id
{
PS_PORTRAIT
,
PS_LANDSCAPE
,
PS_EPSF
,
PS_DEFAULT
,
PS_ENHANCED
,
PS_NOENHANCED
,
PS_LATEX
,
EPSLATEX_STANDALONE
,
EPSLATEX_INPUT
,
PS_MONOCHROME
,
PS_COLOR
,
PS_BLACKTEXT
,
PS_COLORTEXT
,
PS_SOLIDE
,
PS_DASHED
,
PS_DASHLENGTH
,
PS_LINEWIDTH
,
PS_POINTSCALE
,
PS_SIMPLEX
,
PS_DUPLEX
,
PS_DEFAULTPLEX
,
PS_ROUNDED
,
PS_NOROUNDED
,
PS_CLIP
,
PS_NOCLIP
,
PS_FONTFILE
,
PS_NOFONTFILES
,
PS_PALFUNCPARAM
,
PS_LEVEL1
,
PS_LEVELDEFAULT
,
PS_LEVEL3
,
PS_FONT
,
PS_FONTSCALE
,
PSLATEX_ROTATE
,
PSLATEX_NOROTATE
,
PSLATEX_AUXFILE
,
PSLATEX_NOAUXFILE
,
PSLATEX_OLDSTYLE
,
PSLATEX_NEWSTYLE
,
EPSLATEX_HEADER
,
EPSLATEX_NOHEADER
,
PS_SIZE
,
PS_ADOBEGLYPHNAMES
,
PS_NOADOBEGLYPHNAMES
,
PS_BACKGROUND
,
PS_NOBACKGROUND
,
PS_OTHER
};
static
struct
gen_table
PS_opts
[]
=
{
{
"d$efault"
,
PS_DEFAULT
},
{
"p$ortrait"
,
PS_PORTRAIT
},
{
"l$andscape"
,
PS_LANDSCAPE
},
{
"ep$sf"
,
PS_EPSF
},
{
"enh$anced"
,
PS_ENHANCED
},
{
"noenh$anced"
,
PS_NOENHANCED
},
{
"m$onochrome"
,
PS_MONOCHROME
},
{
"c$olor"
,
PS_COLOR
},
{
"c$olour"
,
PS_COLOR
},
{
"b$lacktext"
,
PS_BLACKTEXT
},
{
"colort$ext"
,
PS_COLORTEXT
},
{
"colourt$ext"
,
PS_COLORTEXT
},
{
"so$lid"
,
PS_SOLIDE
},
{
"da$shed"
,
PS_DASHED
},
{
"dashl$ength"
,
PS_DASHLENGTH
},
{
"dl"
,
PS_DASHLENGTH
},
{
"linew$idth"
,
PS_LINEWIDTH
},
{
"lw"
,
PS_LINEWIDTH
},
{
"pointscale"
,
PS_POINTSCALE
},
{
"ps"
,
PS_POINTSCALE
},
{
"size"
,
PS_SIZE
},
{
"si$mplex"
,
PS_SIMPLEX
},
{
"du$plex"
,
PS_DUPLEX
},
{
"defaultp$lex"
,
PS_DEFAULTPLEX
},
{
"butt"
,
PS_NOROUNDED
},
{
"rou$nded"
,
PS_ROUNDED
},
{
"clip"
,
PS_CLIP
},
{
"noclip"
,
PS_NOCLIP
},
{
"fontf$ile"
,
PS_FONTFILE
},
{
"fontscale"
,
PS_FONTSCALE
},
{
"nofontf$iles"
,
PS_NOFONTFILES
},
{
"palf$uncparam"
,
PS_PALFUNCPARAM
},
{
"level1"
,
PS_LEVEL1
},
{
"leveldefault"
,
PS_LEVELDEFAULT
},
{
"level3"
,
PS_LEVEL3
},
{
"font"
,
PS_FONT
},
{
"stand$alone"
,
EPSLATEX_STANDALONE
},
{
"inp$ut"
,
EPSLATEX_INPUT
},
{
"header"
,
EPSLATEX_HEADER
},
{
"noheader"
,
EPSLATEX_NOHEADER
},
{
"r$otate"
,
PSLATEX_ROTATE
},
{
"n$orotate"
,
PSLATEX_NOROTATE
},
{
"a$uxfile"
,
PSLATEX_AUXFILE
},
{
"noa$uxfile"
,
PSLATEX_NOAUXFILE
},
{
"old$style"
,
PSLATEX_OLDSTYLE
},
{
"new$style"
,
PSLATEX_NEWSTYLE
},
{
"adobe$glyphnames"
,
PS_ADOBEGLYPHNAMES
},
{
"noadobe$glyphnames"
,
PS_NOADOBEGLYPHNAMES
},
{
"backg$round"
,
PS_BACKGROUND
},
{
"nobackg$round"
,
PS_NOBACKGROUND
},
{
NULL
,
PS_OTHER
}
};
TERM_PUBLIC
void
PS_options
()
{
char
*
s
;
char
*
ps_fontfile_char
=
NULL
;
char
tmp_term_options
[
MAX_LINE_LEN
+
1
]
=
""
;
TBOOLEAN
set_orientation
=
FALSE,
set_enhanced
=
FALSE,
set_plex
=
FALSE;
TBOOLEAN
set_level
=
FALSE,
set_color
=
FALSE;
TBOOLEAN
set_dashlen
=
FALSE,
set_linewidth
=
FALSE,
set_round
=
FALSE;
TBOOLEAN
set_pointscale
=
FALSE;
TBOOLEAN
set_clip
=
FALSE,
set_palfunc
=
FALSE,
set_colortext
=
FALSE;
TBOOLEAN
set_standalone
=
FALSE,
set_epslheader
=
FALSE;
TBOOLEAN
set_pslrotate
=
FALSE,
set_pslauxfile
=
FALSE;
TBOOLEAN
set_psloldstyle
=
FALSE,
set_font
=
FALSE,
set_fontsize
=
FALSE;
TBOOLEAN
set_fontscale
=
FALSE;
/* Annoying hack to handle the case of 'set termoption' after */
/* we have already initialized the terminal. */
if
(!
almost_equals
(
c_token
-
1
,
"termopt$ion"
))
ps_explicit_size
=
FALSE;
if
(
strcmp
(
term
->
name
,
"pstex"
)
==
0
)
ps_params
=
&
pstex_params
;
else
if
(
strcmp
(
term
->
name
,
"pslatex"
)
==
0
)
ps_params
=
&
pslatex_params
;
else
if
(
strcmp
(
term
->
name
,
"epslatex"
)
==
0
)
ps_params
=
&
epslatex_params
;
else
ps_params
=
&
post_params
;
if
(
ps_params
->
terminal
==
PSTERM_POSTSCRIPT
) {
if
(
pslatex_auxname
)
free
(
pslatex_auxname
);
pslatex_auxname
=
NULL
;
}
if
(!
END_OF_COMMAND
) {
if
(
lookup_table
(
&
PS_opts
[
0
],
c_token
)
==
PS_DEFAULT
) {
switch
(
ps_params
->
terminal
) {
case
PSTERM_POSTSCRIPT
:
while
(
ps_params
->
first_fontfile
!=
NULL
)
delete_ps_fontfile
((
struct
ps_fontfile_def
*
)
NULL
,
ps_params
->
first_fontfile
);
*
ps_params
=
post_params_default
;
break
;
case
PSTERM_EPSLATEX
:
*
ps_params
=
epslatex_params_default
;
break
;
case
PSTERM_PSLATEX
:
*
ps_params
=
pslatex_params_default
;
break
;
case
PSTERM_PSTEX
:
*
ps_params
=
pstex_params_default
;
break
;
}
c_token
++
;
if
(!
END_OF_COMMAND
)
goto
PS_options_error
;
}
}
/* Default to enhanced text */
if
(
ps_params
->
terminal
==
PSTERM_POSTSCRIPT
) {
term
->
put_text
=
ENHPS_put_text
;
term
->
set_font
=
ENHPS_set_font
;
term
->
flags
|=
TERM_ENHANCED_TEXT
;
}
else
{
term
->
set_font
=
PS_set_font
;
term
->
flags
&= ~
TERM_ENHANCED_TEXT
;
}
while
(!
END_OF_COMMAND
) {
switch
(
lookup_table
(
&
PS_opts
[
0
],
c_token
)) {
case
PS_PORTRAIT
:
if
(
set_orientation
||
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_orientation
=
TRUE;
ps_params
->
psformat
=
PSTERM_PORTRAIT
;
c_token
++
;
break
;
case
PS_LANDSCAPE
:
if
(
set_orientation
||
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_orientation
=
TRUE;
ps_params
->
psformat
=
PSTERM_LANDSCAPE
;
c_token
++
;
break
;
case
PS_EPSF
:
if
(
set_orientation
||
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_orientation
=
TRUE;
ps_params
->
psformat
=
PSTERM_EPS
;
c_token
++
;
break
;
case
PS_LEVEL1
:
if
(
set_level
)
goto
PS_options_error
;
set_level
=
TRUE;
ps_params
->
level1
=
TRUE;
c_token
++
;
break
;
case
PS_LEVELDEFAULT
:
if
(
set_level
)
goto
PS_options_error
;
set_level
=
TRUE;
ps_params
->
level1
=
FALSE;
ps_params
->
level3
=
FALSE;
c_token
++
;
break
;
case
PS_LEVEL3
:
if
(
set_level
)
goto
PS_options_error
;
set_level
=
TRUE;
ps_params
->
level3
=
TRUE;
#ifndef
HAVE_DEFLATE_ENCODER
int_error
(
c_token
,
"level3 output requires libgd or libcairo"
);
#endif
c_token
++
;
break
;
case
PS_DEFAULT
:
goto
PS_options_error
;
c_token
++
;
break
;
case
PS_ENHANCED
:
if
(
set_enhanced
||
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_enhanced
=
TRUE;
term
->
put_text
=
ENHPS_put_text
;
term
->
set_font
=
ENHPS_set_font
;
term
->
flags
|=
TERM_ENHANCED_TEXT
;
++
c_token
;
break
;
case
PS_NOENHANCED
:
if
(
set_enhanced
||
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_enhanced
=
TRUE;
term
->
put_text
=
PS_put_text
;
term
->
set_font
=
PS_set_font
;
term
->
flags
&= ~
TERM_ENHANCED_TEXT
;
++
c_token
;
break
;
#ifdef
PSLATEX_DRIVER
case
EPSLATEX_STANDALONE
:
if
(
set_standalone
||
ps_params
->
terminal
!=
PSTERM_EPSLATEX
)
goto
PS_options_error
;
set_standalone
=
TRUE;
ps_params
->
epslatex_standalone
=
TRUE;
++
c_token
;
break
;
case
EPSLATEX_INPUT
:
if
(
set_standalone
||
ps_params
->
terminal
!=
PSTERM_EPSLATEX
)
goto
PS_options_error
;
set_standalone
=
TRUE;
ps_params
->
epslatex_standalone
=
FALSE;
++
c_token
;
break
;
case
EPSLATEX_HEADER
:
if
(
set_epslheader
||
ps_params
->
terminal
!=
PSTERM_EPSLATEX
)
goto
PS_options_error
;
set_epslheader
=
TRUE;
++
c_token
;
free
(
epslatex_header
);
/* Protect against int_error() bail from try_to_get_string() */
epslatex_header
=
NULL
;
epslatex_header
=
try_to_get_string
();
if
(!
epslatex_header
)
int_error
(
c_token
,
"String containing header information expected"
);
break
;
case
EPSLATEX_NOHEADER
:
if
(
set_epslheader
||
ps_params
->
terminal
!=
PSTERM_EPSLATEX
)
goto
PS_options_error
;
set_epslheader
=
TRUE;
free
(
epslatex_header
);
epslatex_header
=
NULL
;
++
c_token
;
break
;
case
PSLATEX_ROTATE
:
if
(
set_pslrotate
||
((
ps_params
->
terminal
!=
PSTERM_PSLATEX
)
&&
(
ps_params
->
terminal
!=
PSTERM_PSTEX
)))
goto
PS_options_error
;
set_pslrotate
=
TRUE;
ps_params
->
rotate
=
TRUE;
++
c_token
;
break
;
case
PSLATEX_NOROTATE
:
if
(
set_pslrotate
||
((
ps_params
->
terminal
!=
PSTERM_PSLATEX
)
&&
(
ps_params
->
terminal
!=
PSTERM_PSTEX
)))
goto
PS_options_error
;
set_pslrotate
=
TRUE;
ps_params
->
rotate
=
FALSE;
++
c_token
;
break
;
case
PSLATEX_AUXFILE
:
if
(
set_pslauxfile
||
((
ps_params
->
terminal
==
PSTERM_POSTSCRIPT
)
||
(
ps_params
->
terminal
==
PSTERM_EPSLATEX
)))
goto
PS_options_error
;
set_pslauxfile
=
TRUE;
ps_params
->
useauxfile
=
TRUE;
c_token
++
;
break
;
case
PSLATEX_NOAUXFILE
:
if
(
set_pslauxfile
||
((
ps_params
->
terminal
==
PSTERM_POSTSCRIPT
)
||
(
ps_params
->
terminal
==
PSTERM_EPSLATEX
)))
goto
PS_options_error
;
set_pslauxfile
=
TRUE;
ps_params
->
useauxfile
=
FALSE;
c_token
++
;
break
;
case
PSLATEX_OLDSTYLE
:
if
(
set_psloldstyle
||
ps_params
->
terminal
==
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_psloldstyle
=
TRUE;
ps_params
->
oldstyle
=
TRUE;
if
(
ps_params
->
terminal
==
PSTERM_EPSLATEX
)
ps_params
->
rounded
=
TRUE;
c_token
++
;
break
;
case
PSLATEX_NEWSTYLE
:
if
(
set_psloldstyle
||
ps_params
->
terminal
==
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_psloldstyle
=
TRUE;
ps_params
->
oldstyle
=
FALSE;
c_token
++
;
break
;
#endif
case
PS_MONOCHROME
:
if
(
set_color
)
goto
PS_options_error
;
set_color
=
TRUE;
ps_params
->
color
=
FALSE;
term
->
flags
|=
TERM_MONOCHROME
;
c_token
++
;
break
;
case
PS_COLOR
:
if
(
set_color
)
goto
PS_options_error
;
set_color
=
TRUE;
ps_params
->
color
=
TRUE;
term
->
flags
&= ~
TERM_MONOCHROME
;
c_token
++
;
break
;
case
PS_BLACKTEXT
:
if
(
set_colortext
||
((
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
&&
(
ps_params
->
terminal
!=
PSTERM_EPSLATEX
)))
goto
PS_options_error
;
set_colortext
=
TRUE;
ps_params
->
blacktext
=
TRUE;
c_token
++
;
break
;
case
PS_COLORTEXT
:
if
(
set_colortext
||
((
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
&&
(
ps_params
->
terminal
!=
PSTERM_EPSLATEX
)))
goto
PS_options_error
;
set_colortext
=
TRUE;
ps_params
->
blacktext
=
FALSE;
c_token
++
;
break
;
case
PS_SOLIDE
:
case
PS_DASHED
:
/* Version 5 always allows dashes */
ps_params
->
solid
=
FALSE;
c_token
++
;
break
;
case
PS_DASHLENGTH
:
if
(
set_dashlen
)
goto
PS_options_error
;
set_dashlen
=
TRUE;
c_token
++
;
ps_params
->
dash_length
=
real_expression
();
if
(
ps_params
->
dash_length
<=
0.0
)
ps_params
->
dash_length
=
1.0
;
break
;
case
PS_LINEWIDTH
:
if
(
set_linewidth
)
goto
PS_options_error
;
set_linewidth
=
TRUE;
c_token
++
;
ps_params
->
linewidth_factor
=
real_expression
();
if
(
ps_params
->
linewidth_factor
<=
0.0
)
ps_params
->
linewidth_factor
=
1.0
;
break
;
case
PS_POINTSCALE
:
if
(
set_pointscale
)
goto
PS_options_error
;
set_pointscale
=
TRUE;
c_token
++
;
ps_params
->
pointscale_factor
=
real_expression
();
if
(
ps_params
->
pointscale_factor
<=
0.0
)
ps_params
->
pointscale_factor
=
1.0
;
break
;
case
PS_SIMPLEX
:
if
(
set_plex
||
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_plex
=
TRUE;
ps_params
->
duplex_state
=
FALSE;
ps_params
->
duplex_option
=
TRUE;
c_token
++
;
break
;
case
PS_DUPLEX
:
if
(
set_plex
||
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_plex
=
TRUE;
ps_params
->
duplex_state
=
TRUE;
ps_params
->
duplex_option
=
TRUE;
c_token
++
;
break
;
case
PS_DEFAULTPLEX
:
if
(
set_plex
||
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
set_plex
=
TRUE;
ps_params
->
duplex_option
=
FALSE;
c_token
++
;
break
;
case
PS_ROUNDED
:
if
(
set_round
)
goto
PS_options_error
;
set_round
=
TRUE;
ps_params
->
rounded
=
TRUE;
c_token
++
;
break
;
case
PS_NOROUNDED
:
if
(
set_round
)
goto
PS_options_error
;
set_round
=
TRUE;
ps_params
->
rounded
=
FALSE;
c_token
++
;
break
;
case
PS_CLIP
:
if
(
set_clip
)
goto
PS_options_error
;
set_clip
=
TRUE;
ps_params
->
clipped
=
TRUE;
c_token
++
;
break
;
case
PS_NOCLIP
:
if
(
set_clip
)
goto
PS_options_error
;
set_clip
=
TRUE;
ps_params
->
clipped
=
FALSE;
c_token
++
;
break
;
case
PS_FONTSCALE
:
if
(
set_fontscale
)
goto
PS_options_error
;
set_fontscale
=
TRUE;
c_token
++
;
ps_params
->
fontscale
=
END_OF_COMMAND
?
-1
:
real_expression
();
if
(
ps_params
->
fontscale
<=
0
)
ps_params
->
fontscale
=
1.0
;
break
;
case
PS_FONTFILE
: {
TBOOLEAN
deleteentry
=
FALSE;
char
*
fontfilename
=
NULL
;
c_token
++
;
if
(
ps_params
->
terminal
!=
PSTERM_POSTSCRIPT
)
goto
PS_options_error
;
if
(
equals
(
c_token
,
"add"
))
c_token
++
;
else
if
(
almost_equals
(
c_token
,
"del$ete"
)) {
deleteentry
=
TRUE;
c_token
++
;
}
if
(!(
fontfilename
=
try_to_get_string
())) {
int_error
(
c_token
,
"Font filename expected"
);
View remainder of file in raw view
Back
|
FazBrowse Home
|
New Git URL