Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

boxtext.ps 43 KB

You have to be logged in to leave a comment. Sign In
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
  1. %!PS-Adobe-3.0
  2. %%BoundingBox: 0 0 612 792
  3. %%HiResBoundingBox: 0 0 612 792
  4. %%Title: GMT v5.1.2_r13201 [64-bit] Document from pstext
  5. %%Creator: GMT5
  6. %%For: pwessel
  7. %%DocumentNeededResources: font Helvetica
  8. %%CreationDate: Wed May 28 09:58:19 2014
  9. %%LanguageLevel: 2
  10. %%DocumentData: Clean7Bit
  11. %%Orientation: Portrait
  12. %%Pages: 1
  13. %%EndComments
  14. %%BeginProlog
  15. % Begin pslib header
  16. 250 dict begin
  17. /! {bind def} bind def
  18. /# {load def}!
  19. /A /setgray #
  20. /B /setdash #
  21. /C /setrgbcolor #
  22. /D /rlineto #
  23. /E {dup stringwidth pop}!
  24. /F /fill #
  25. /G /rmoveto #
  26. /H /sethsbcolor #
  27. /I /setpattern #
  28. /K /setcmykcolor #
  29. /L /lineto #
  30. /M /moveto #
  31. /N /newpath #
  32. /P /closepath #
  33. /R /rotate #
  34. /S /stroke #
  35. /T /translate #
  36. /U /grestore #
  37. /V /gsave #
  38. /W /setlinewidth #
  39. /Y {findfont exch scalefont setfont}!
  40. /Z /show #
  41. /FP {true charpath flattenpath}!
  42. /MU {matrix setmatrix}!
  43. /MS {/SMat matrix currentmatrix def}!
  44. /MR {SMat setmatrix}!
  45. /edef {exch def}!
  46. % Path fill
  47. /FS {/fc edef /fs {V fc F U} def}!
  48. /FQ {/fs {} def}!
  49. % Outline off or on
  50. /O0 {/os {N} def}!
  51. /O1 {/os {P S} def}!
  52. % Set both fill and outline
  53. /FO {fs os}!
  54. % Star: radius xc yc
  55. /Sa {M MS dup 0 exch G 0.726542528 mul -72 R dup 0 D 4 {72 R dup 0 D -144 R dup 0 D} repeat pop MR FO}!
  56. % Box: height width xll yll
  57. /Sb {M dup 0 D exch 0 exch D neg 0 D FO}!
  58. % Rounded box: height width radius xll yll
  59. /SB {MS T /BoxR edef /BoxW edef /BoxH edef BoxR 0 M
  60. BoxW 0 BoxW BoxH BoxR arct BoxW BoxH 0 BoxH BoxR arct 0 BoxH 0 0 BoxR arct 0 0 BoxW 0 BoxR arct MR FO}!
  61. % Circle: radius xc yc
  62. /Sc {N 3 -1 roll 0 360 arc FO}!
  63. % Diamond: radius xc yc
  64. /Sd {M 4 {dup} repeat 0 G neg dup dup D exch D D FO}!
  65. % Ellipse: major minor angle xc yc
  66. /Se {N MS T R scale 0 0 1 0 360 arc MR FO}!
  67. % Octagon: radius xc yc
  68. /Sg {M MS 22.5 R dup 0 exch G -22.5 R 0.765366865 mul dup 0 D 6 {-45 R dup 0 D} repeat pop MR FO}!
  69. % Hexagon: radius xc yc
  70. /Sh {M MS dup 0 G -120 R dup 0 D 4 {-60 R dup 0 D} repeat pop MR FO}!
  71. % Inverted triangle: radius xc yc
  72. /Si {M MS dup neg 0 exch G 60 R 1.732050808 mul dup 0 D 120 R 0 D MR FO}!
  73. % Rotated rectangle: height width angle xc yc
  74. /Sj {M MS R dup -2 div 2 index -2 div G dup 0 D exch 0 exch D neg 0 D MR FO}!
  75. % Pentagon: radius xc yc
  76. /Sn {M MS dup 0 exch G -36 R 1.175570505 mul dup 0 D 3 {-72 R dup 0 D} repeat pop MR FO}!
  77. % Dot: radius xc yc [hardwired as circle with no outline]
  78. /Sp {N 3 -1 roll 0 360 arc fs N}!
  79. % Patch fill: x1 y1 ... xn yn n
  80. /SP {M {D} repeat FO}!
  81. % Rectangle: height width xc yc
  82. /Sr {M dup -2 div 2 index -2 div G dup 0 D exch 0 exch D neg 0 D FO}!
  83. % Rounded rectangle: height width radius xc yc
  84. /SR {MS T /BoxR edef /BoxW edef /BoxH edef BoxR BoxW -2 div BoxH -2 div T BoxR 0 M
  85. BoxW 0 BoxW BoxH BoxR arct BoxW BoxH 0 BoxH BoxR arct 0 BoxH 0 0 BoxR arct 0 0 BoxW 0 BoxR arct MR FO}!
  86. % Square: radius xc yc
  87. /Ss {M 1.414213562 mul dup dup dup -2 div dup G 0 D 0 exch D neg 0 D FO}!
  88. % Triangle: radius xc yc
  89. /St {M MS dup 0 exch G -60 R 1.732050808 mul dup 0 D -120 R 0 D MR FO}!
  90. % Single-headed vector
  91. /SV {0 exch M 0 D D D D D 0 D FO}!
  92. % Double-headed vector
  93. /Sv {0 0 M D D 0 D D D D D 0 D D FO}!
  94. % Pie Wedge: radius angle1 angle2 xc yc
  95. /Sw {2 copy M 5 2 roll arc FO}!
  96. % Cross: radius xc yc
  97. /Sx {M 1.414213562 mul 5 {dup} repeat -2 div dup G D neg 0 G neg D S}!
  98. % Y-dash: radius xc yc
  99. /Sy {M dup 0 exch G dup -2 mul dup 0 exch D S}!
  100. % Plus: radius xc yc
  101. /S+ {M dup 0 G dup -2 mul dup 0 D exch dup G 0 exch D S}!
  102. % X-dash: radius xc yc
  103. /S- {M dup 0 G dup -2 mul dup 0 D S}!
  104. % String width, height, depth and total height (height-depth)
  105. /sw {stringwidth pop}!
  106. /sh {V MU 0 0 M FP pathbbox N 4 1 roll pop pop pop U}!
  107. /sd {V MU 0 0 M FP pathbbox N pop pop exch pop U}!
  108. /sH {V MU 0 0 M FP pathbbox N exch pop exch sub exch pop U}!
  109. /sb {E exch sh}!
  110. % To align text {bottom,middle,top}{left,center,right}
  111. /bl {}!
  112. /bc {E -2 div 0 G}!
  113. /br {E neg 0 G}!
  114. /ml {dup 0 exch sh -2 div G}!
  115. /mc {dup E -2 div exch sh -2 div G}!
  116. /mr {dup E neg exch sh -2 div G}!
  117. /tl {dup 0 exch sh neg G}!
  118. /tc {dup E -2 div exch sh neg G}!
  119. /tr {dup E neg exch sh neg G}!
  120. % Maximum of two numbers
  121. /mx {2 copy lt {exch} if pop}!
  122. % Translate and memorize advance
  123. /PSL_xorig 0 def /PSL_yorig 0 def
  124. /TM {2 copy T PSL_yorig add /PSL_yorig edef PSL_xorig add /PSL_xorig edef}!
  125. % To reencode one font with the provided encoding vector
  126. /PSL_reencode {findfont dup length dict begin
  127. {1 index /FID ne {def}{pop pop} ifelse} forall
  128. exch /Encoding edef currentdict end definefont pop
  129. }!
  130. /PSL_eps_begin { % Marks begin of EPSF inclusion
  131. /PSL_eps_state save def % Save state for cleanup
  132. /PSL_dict_count countdictstack def % Count objects on dict stack
  133. /PSL_op_count count 1 sub def % Count objects on operand stack
  134. userdict begin % Push userdict stack
  135. /showpage {} def % Deactivate showpage command
  136. 0 setgray 0 setlinecap 1 setlinewidth % Prepare clean graphics state
  137. 0 setlinejoin 10 setmiterlimit [] 0 setdash newpath
  138. /languagelevel where % If level != 1, set strokeadjust and overprint to their defaults
  139. {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if
  140. }!
  141. /PSL_eps_end { % Marks end of EPSF inclusion
  142. count PSL_op_count sub {pop} repeat % Clean up operand stack
  143. countdictstack PSL_dict_count sub {end} repeat % Clean up dict stack
  144. PSL_eps_state restore % Restore saved state
  145. }!
  146. /PSL_transp { % Set transparency
  147. /.setopacityalpha where {pop .setblendmode .setopacityalpha}{ % Using ghostscript
  148. /pdfmark where {pop [ /BM exch /CA exch dup /ca exch /SetTransparency pdfmark} % Or Adobe
  149. {pop pop} ifelse} ifelse % Or skip if neither are supported
  150. }!
  151. /ISOLatin1+_Encoding [
  152. /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  153. /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  154. /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  155. /.notdef /bullet /ellipsis /trademark /emdash /endash /fi /zcaron
  156. /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright
  157. /parenleft /parenright /asterisk /plus /comma /minus /period /slash
  158. /zero /one /two /three /four /five /six /seven
  159. /eight /nine /colon /semicolon /less /equal /greater /question
  160. /at /A /B /C /D /E /F /G
  161. /H /I /J /K /L /M /N /O
  162. /P /Q /R /S /T /U /V /W
  163. /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
  164. /quoteleft /a /b /c /d /e /f /g
  165. /h /i /j /k /l /m /n /o
  166. /p /q /r /s /t /u /v /w
  167. /x /y /z /braceleft /bar /braceright /asciitilde /scaron
  168. /OE /dagger /daggerdbl /Lslash /fraction /guilsinglleft /Scaron /guilsinglright
  169. /oe /Ydieresis /Zcaron /lslash /perthousand /quotedblbase /quotedblleft /quotedblright
  170. /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
  171. /dieresis /quotesinglbase /ring /cedilla /quotesingle /hungarumlaut /ogonek /caron
  172. /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
  173. /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron
  174. /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered
  175. /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown
  176. /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
  177. /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis
  178. /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
  179. /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
  180. /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
  181. /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis
  182. /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
  183. /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis
  184. ] def
  185. /PSL_font_encode 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 40 array astore def % Initially zero
  186. /F0 {/Helvetica Y}!
  187. /F1 {/Helvetica-Bold Y}!
  188. /F2 {/Helvetica-Oblique Y}!
  189. /F3 {/Helvetica-BoldOblique Y}!
  190. /F4 {/Times-Roman Y}!
  191. /F5 {/Times-Bold Y}!
  192. /F6 {/Times-Italic Y}!
  193. /F7 {/Times-BoldItalic Y}!
  194. /F8 {/Courier Y}!
  195. /F9 {/Courier-Bold Y}!
  196. /F10 {/Courier-Oblique Y}!
  197. /F11 {/Courier-BoldOblique Y}!
  198. /F12 {/Symbol Y}!
  199. /F13 {/AvantGarde-Book Y}!
  200. /F14 {/AvantGarde-BookOblique Y}!
  201. /F15 {/AvantGarde-Demi Y}!
  202. /F16 {/AvantGarde-DemiOblique Y}!
  203. /F17 {/Bookman-Demi Y}!
  204. /F18 {/Bookman-DemiItalic Y}!
  205. /F19 {/Bookman-Light Y}!
  206. /F20 {/Bookman-LightItalic Y}!
  207. /F21 {/Helvetica-Narrow Y}!
  208. /F22 {/Helvetica-Narrow-Bold Y}!
  209. /F23 {/Helvetica-Narrow-Oblique Y}!
  210. /F24 {/Helvetica-Narrow-BoldOblique Y}!
  211. /F25 {/NewCenturySchlbk-Roman Y}!
  212. /F26 {/NewCenturySchlbk-Italic Y}!
  213. /F27 {/NewCenturySchlbk-Bold Y}!
  214. /F28 {/NewCenturySchlbk-BoldItalic Y}!
  215. /F29 {/Palatino-Roman Y}!
  216. /F30 {/Palatino-Italic Y}!
  217. /F31 {/Palatino-Bold Y}!
  218. /F32 {/Palatino-BoldItalic Y}!
  219. /F33 {/ZapfChancery-MediumItalic Y}!
  220. /F34 {/ZapfDingbats Y}!
  221. /F35 {/Ryumin-Light-EUC-H Y}!
  222. /F36 {/Ryumin-Light-EUC-V Y}!
  223. /F37 {/GothicBBB-Medium-EUC-H Y}!
  224. /F38 {/GothicBBB-Medium-EUC-V Y}!
  225. /F39 {/LinBiolinumO Y}!
  226. /PSL_pathtextdict 26 dict def % Local storage for the procedure PSL_pathtext.
  227. /PSL_pathtext % PSL_pathtext'' will place a string
  228. {PSL_pathtextdict begin % of text along any path. It takes
  229. /ydepth exch def % a string and starting offset
  230. /textheight exch def % distance from the beginning of
  231. /just exch def % the path as its arguments. Note
  232. /offset exch def % that PSL_pathtext assumes that a
  233. /str exch def % path has already been defined
  234. % and after it places the text
  235. % along the path, it clears the
  236. % current path like the ``stroke''
  237. % and ``fill'' operators; it also
  238. % assumes that a font has been
  239. % set. ``pathtext'' begins placing
  240. % the characters along the current
  241. % path, starting at the offset
  242. % distance and continuing until
  243. % either the path length is
  244. % exhausted or the entire string
  245. % has been printed, whichever
  246. % occurs first. The results will
  247. % be more effective when a small
  248. % point size font is used with
  249. % sharp curves in the path.
  250. /pathdist 0 def % Initialize the distance we have
  251. % travelled along the path.
  252. /setdist offset def % Initialize the distance we have
  253. % covered by setting characters.
  254. /charcount 0 def % Initialize the character count.
  255. /justy just 4 idiv textheight mul 2 div neg ydepth sub def % Compute the y-shift
  256. V flattenpath % Reduce the path to a series of
  257. % straight line segments. The
  258. % characters will be placed along
  259. % the line segments in the
  260. % ``linetoproc.''
  261. {movetoproc} {linetoproc} % The basic strategy is to process
  262. {curvetoproc} {closepathproc} % the segments of the path,
  263. pathforall % keeping a running total of the
  264. % distance we have travelled so
  265. % far (pathdist). We also keep
  266. % track of the distance taken up
  267. % by the characters that have been
  268. % set so far (setdist). When the
  269. % distance we have travelled along
  270. % the path is greater than the
  271. % distance taken up by the set
  272. % characters, we are ready to set
  273. % the next character (if there are
  274. % any left to be set). This
  275. % process continues until we have
  276. % exhausted the full length of the
  277. % path.
  278. U N % Clear the current path.
  279. end
  280. } def
  281. PSL_pathtextdict begin
  282. /movetoproc % ``movetoproc'' is executed when
  283. { /newy exch def /newx exch def % a moveto component has been
  284. % encountered in the pathforall
  285. % operation.
  286. /firstx newx def /firsty newy def % Remember the ``first point'' in
  287. % the path so that when we get a
  288. % ``closepath'' component we can
  289. % properly handle the text.
  290. /ovr 0 def
  291. newx newy transform
  292. /cpy exch def /cpx exch def % Explicitly keep track of the
  293. % current position in device
  294. % space.
  295. } def
  296. /linetoproc % ``linetoproc'' is executed when
  297. % a lineto component has been
  298. % encountered in the pathforall
  299. % operation.
  300. { /oldx newx def /oldy newy def % Update the old point.
  301. /newy exch def /newx exch def % Get the new point.
  302. /dx newx oldx sub def
  303. /dy newy oldy sub def
  304. /dist dx dup mul dy dup mul add sqrt def % Calculate the distance between
  305. % the old and the new point.
  306. dist 0 ne
  307. { /dsx dx dist div ovr mul def % dsx and dsy are used to update
  308. /dsy dy dist div ovr mul def % the current position to be just
  309. % beyond the width of the previous
  310. % character.
  311. oldx dsx add oldy dsy add transform
  312. /cpy exch def /cpx exch def % Update the current position.
  313. /pathdist pathdist dist add def % Increment the distance we have
  314. % travelled along the path.
  315. {setdist pathdist le % Keep setting characters along
  316. % this path segment until we have
  317. % exhausted its length.
  318. {charcount str length lt % As long as there are still
  319. {setchar} {exit} ifelse} % characters left in the string,
  320. % set them.
  321. { /ovr setdist pathdist sub def % Keep track of how much we have
  322. exit} % overshot the path segment by
  323. ifelse % setting the previous character.
  324. % This enables us to position the
  325. % origin of the following
  326. % characters properly on the path.
  327. } loop
  328. } if
  329. } def
  330. /curvetoproc % ``curvetoproc'' is executed when
  331. { (ERROR: No curveto's after flattenpath!) % a curveto component has been
  332. print % encountered in the pathforall
  333. } def % operation. It prints an error
  334. % message since there shouldn't be
  335. % any curveto's in a path after
  336. % the flattenpath operator has
  337. % been executed.
  338. /closepathproc % ``closepathproc'' is executed
  339. {firstx firsty linetoproc % when a closepath component has
  340. firstx firsty movetoproc % been encountered in the
  341. } def % pathforall operation. It
  342. % simulates the action of the
  343. % operator ``closepath'' by
  344. % executing ``linetoproc'' with
  345. % the coordinates of the most
  346. % recent ``moveto'' and then
  347. % executing ``movetoproc'' to the
  348. % same point.
  349. /setchar % ``setchar'' sets the next
  350. { /char str charcount 1 getinterval def % character in the string along
  351. % the path and then updates the
  352. % amount of path we have
  353. % exhausted.
  354. /charcount charcount 1 add def % Increment the character count.
  355. /charwidth char stringwidth pop def % Find the width of the character.
  356. V cpx cpy itransform T % Translate to the current
  357. % position in user space.
  358. dy dx atan R % Rotate the x-axis to coincide
  359. % with the current segment.
  360. 0 justy M
  361. char show
  362. 0 justy neg G
  363. currentpoint transform
  364. /cpy exch def /cpx exch def % Update the current position
  365. % before we restore ourselves to
  366. % the untransformed state.
  367. U /setdist setdist charwidth add def % Increment the distance we have
  368. } def % covered by setting characters.
  369. end
  370. % PSL LABEL CLIP FUNCTIONS
  371. % Two main functions deals with label placement and clipping:
  372. % PSL_curved_path_labels: handles texts that must follow curved baselines
  373. % PSL_straight_path_labels: handles texts that have straight baselines
  374. %
  375. % Both functions assume that several variables have been predefined:
  376. %
  377. % First we have these two constant settings for all text boxes:
  378. %
  379. % PSL_setboxpen Function that sets the text box pen attributes (width, texture, color)
  380. % PSL_setboxrgb Function that sets the opaque text box color
  381. %
  382. % Then several arrays are placed. Since a set of several lines segments may each
  383. % have many labels along them, we end up with these variables:
  384. %
  385. % PSL_n_paths Total number of segments
  386. % PSL_path_x x coordinates of the paths (all concatenated one after another)
  387. % PSL_path_y y coordinates of the paths (all concatenated one after another)
  388. % PSL_path_n Array with number of points per segment
  389. % PSL_label_str Array with all the labels for all segments
  390. % PSL_label_n Array with number of labels per segment
  391. % PSL_angle The annotation angle for each label
  392. %
  393. % PSL_curved_path_labels expects those labels to be placed along several
  394. % lines and it needs the node numbers where to place text:
  395. %
  396. % PSL_node Array with (x,y) node number of label position
  397. %
  398. % PSL_straight_path_labels are simpler and instead expects
  399. %
  400. % PSL_txt_x (x,y) coordinates of the location of the m labels
  401. % PSL_txt_y
  402. /PSL_set_label_heights
  403. { % Create array PSL_heights with full label heights
  404. /PSL_n_labels_minus_1 PSL_n_labels 1 sub def % Upper limit in loop over labels
  405. /PSL_heights PSL_n_labels array def % Create array with text heights
  406. 0 1 PSL_n_labels_minus_1 % Loop psl_k = 0 < PSL_n_labels
  407. { /psl_k exch def % Current label index psl_k
  408. /psl_label PSL_label_str psl_k get def % Current text label
  409. PSL_label_font psl_k get cvx exec % Get and set this label's font attributes
  410. psl_label sH /PSL_height edef % Compute the height of this string
  411. PSL_heights psl_k PSL_height put % Store it in the array
  412. } for
  413. } def
  414. %%%%%%%%%%%%%%%%%%% CURVED BASELINE TEXT PLACEMENT FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  415. /PSL_curved_path_labels
  416. { /psl_bits exch def % 4 on/of bit settings as indicated below
  417. /PSL_placetext psl_bits 2 and 2 eq def % true to place text, false to just make space
  418. /PSL_clippath psl_bits 4 and 4 eq def % false inactive, true creates clippath for labels
  419. /PSL_strokeline false def % true draws line, false skips
  420. /PSL_fillbox psl_bits 128 and 128 eq def % true to paint box opaque before placing text, false gives transparent box
  421. /PSL_drawbox psl_bits 256 and 256 eq def % true to draw box outline before placing text, false gives no outline
  422. /PSL_n_paths1 PSL_n_paths 1 sub def % one less is the upper limit in for loop over the paths
  423. /PSL_usebox PSL_fillbox PSL_drawbox or def % true if we need box outline for fill or stroke or both
  424. PSL_clippath {clipsave N clippath} if % Bracket with clipsave/cliprestore and start clip path
  425. /psl_k 0 def
  426. /psl_p 0 def
  427. 0 1 PSL_n_paths1
  428. { /psl_kk exch def % Index into the PSL_n PSL_m arrays
  429. /PSL_n PSL_path_n psl_kk get def % Get the number of points in this line segment
  430. /PSL_m PSL_label_n psl_kk get def % Get the number of labels for this line segment
  431. /PSL_x PSL_path_x psl_k PSL_n getinterval def % Get the subset that is the current line segment x-coordinates
  432. /PSL_y PSL_path_y psl_k PSL_n getinterval def % Get the subset that is the current line segment y-coordinates
  433. /PSL_node PSL_label_node psl_p PSL_m getinterval def % Get the subset of note values for current line segment
  434. /PSL_angle PSL_label_angle psl_p PSL_m getinterval def % Get the subset of angle values for current line segment
  435. /PSL_str PSL_label_str psl_p PSL_m getinterval def % Get the subset of string values for current line segment
  436. /PSL_fnt PSL_label_font psl_p PSL_m getinterval def % Get the subset of font settings for current line segment
  437. PSL_curved_path_label % Operate on this segment only
  438. /psl_k psl_k PSL_n add def % Go to next segment start index for path
  439. /psl_p psl_p PSL_m add def % Go to next segment start index for nodes
  440. } for % The loop over segments
  441. PSL_clippath {PSL_clip} if N % Activate clip path and return
  442. } def
  443. /PSL_curved_path_label
  444. { % Deals with a single line segment and its labels
  445. /PSL_n1 PSL_n 1 sub def % one less is the upper limit in for loops
  446. /PSL_m1 PSL_m 1 sub def % same
  447. PSL_CT_calcstringwidth % Calculate the width of each label string
  448. PSL_CT_calclinedist % Calculate along-track distances
  449. PSL_CT_addcutpoints % Expand path to include the cut points
  450. % Now we have the final xx/yy array and we are ready to simply lay down the lines
  451. % and place the text along the line where there are labels. We will use the
  452. % new array PSL_xp/yp to store the final points prior to use
  453. /PSL_nn1 PSL_nn 1 sub def % End index in for loop
  454. /n 0 def % Toggle: 0 means line, 1 means text
  455. /k 0 def % Index of the current text string
  456. /j 0 def % Output point number counter
  457. /PSL_seg 0 def % Line segment number
  458. /PSL_xp PSL_nn array def
  459. /PSL_yp PSL_nn array def
  460. PSL_xp 0 PSL_xx 0 get put % Place first point in array
  461. PSL_yp 0 PSL_yy 0 get put
  462. 1 1 PSL_nn1 % Loop over rest of points
  463. { /i exch def % Index into PSL_xx/yy arrays
  464. /node_type PSL_kind i get def % Check what kind of point the current point is
  465. /j j 1 add def % Update point count
  466. PSL_xp j PSL_xx i get put % Add this point to the path
  467. PSL_yp j PSL_yy i get put
  468. node_type 1 eq % If this is a cut point we either stroke or place text
  469. {n 0 eq % n is 0 so this is the strokable segment
  470. {PSL_CT_drawline}
  471. { PSL_CT_reversepath % here, n = 1 so this is the segment along which text should be placed
  472. PSL_CT_textline} ifelse % Reverse path if needed to place text correctly
  473. /j 0 def
  474. PSL_xp j PSL_xx i get put % Place new first point in array
  475. PSL_yp j PSL_yy i get put
  476. } if
  477. } for
  478. n 0 eq {PSL_CT_drawline} if % Finish off the last line segment
  479. } def
  480. /PSL_CT_textline
  481. { PSL_fnt k get cvx exec % Get and set this label's font attributes
  482. /PSL_height PSL_heights k get def % Recall the height of this text
  483. PSL_placetext {PSL_CT_placelabel} if % If we want to place the text
  484. PSL_clippath {PSL_CT_clippath} if
  485. /n 0 def /k k 1 add def % Set n back to 0, goto next label
  486. } def
  487. /PSL_CT_calcstringwidth % Calculate the width of each label string
  488. { /PSL_width PSL_m array def % Assign space for distance
  489. 0 1 PSL_m1
  490. { /i exch def
  491. PSL_fnt i get cvx exec % Get and set this label's font attributes
  492. PSL_width i PSL_str i get stringwidth pop put % Compute width and store in the array
  493. } for
  494. } def
  495. /PSL_CT_calclinedist % Calculate the distance along the line
  496. { /PSL_newx PSL_x 0 get def
  497. /PSL_newy PSL_y 0 get def
  498. /dist 0.0 def % Cumulative distance at first point is 0
  499. /PSL_dist PSL_n array def % Assign array space for distance
  500. PSL_dist 0 0.0 put % Distances start at 0 and the 'th point
  501. 1 1 PSL_n1 % Loop over the remaining points
  502. { /i exch def
  503. /PSL_oldx PSL_newx def
  504. /PSL_oldy PSL_newy def
  505. /PSL_newx PSL_x i get def
  506. /PSL_newy PSL_y i get def
  507. /dx PSL_newx PSL_oldx sub def
  508. /dy PSL_newy PSL_oldy sub def
  509. /dist dist dx dx mul dy dy mul add sqrt add def
  510. PSL_dist i dist put
  511. } for
  512. } def
  513. % Initialize an array with all the original line points plus the set of 2*m
  514. % points at the transition from line to labelspace at each label
  515. % At the end of this section, the PSL_xx/yy array will be the array to use.
  516. /PSL_CT_addcutpoints
  517. { /k 0 def % Current cut point
  518. /PSL_nc PSL_m 2 mul 1 add def % 2*m points + one last acting as infinity
  519. /PSL_cuts PSL_nc array def % The array of distances to each cut
  520. /PSL_nc1 PSL_nc 1 sub def % One less to use in for loop limits
  521. 0 1 PSL_m1 % For each of the m labels
  522. { /i exch def % Index for label distance
  523. /dist PSL_dist PSL_node i get get def % Recall the distance to this label center
  524. /halfwidth PSL_width i get 2 div PSL_gap_x add def % Set the halfwidth + gap distance
  525. PSL_cuts k dist halfwidth sub put % Distance at beginning of label gap
  526. /k k 1 add def % Was at start, now go to end distance node
  527. PSL_cuts k dist halfwidth add put % Distance at the end of label gap
  528. /k k 1 add def % Was at end, move to next
  529. } for
  530. PSL_cuts k 100000.0 put % Last cut has "infinite" distance
  531. /PSL_nn PSL_n PSL_m 2 mul add def % The total path will be 2*m points longer
  532. /PSL_xx PSL_nn array def % Assign new space for x and y
  533. /PSL_yy PSL_nn array def
  534. /PSL_kind PSL_nn array def % 0 = ordinary point, 1 = added point for label gap
  535. /j 0 def % Index for new track array
  536. /k 0 def % Index for current cut distance
  537. /dist 0.0 def % Current distance along track, starting at zero
  538. 0 1 PSL_n1 % Loop over every original line point
  539. { /i exch def % Index into current point on original line xy array
  540. /last_dist dist def % Update distance to last point (initially zero)
  541. /dist PSL_dist i get def % Distance to current point
  542. k 1 PSL_nc1 % Loop over remaining cuts (starting with all)
  543. { /kk exch def % Index into current cut distance
  544. /this_cut PSL_cuts kk get def % Distance to start of this label gap
  545. dist this_cut gt % Oh, oh, we just stepped over a cut point
  546. { /ds dist last_dist sub def % Change in distance
  547. /f ds 0.0 eq {0.0} {dist this_cut sub ds div} ifelse def % Get fractional change in distance
  548. /i1 i 0 eq {0} {i 1 sub} ifelse def
  549. PSL_xx j PSL_x i get dup PSL_x i1 get sub f mul sub put % Calc (x,y) at label start (or stop) point
  550. PSL_yy j PSL_y i get dup PSL_y i1 get sub f mul sub put
  551. PSL_kind j 1 put % Set PSL_kind to 1 since it is an added cut point
  552. /j j 1 add def % Go to next output point
  553. /k k 1 add def % Done with this cut point
  554. } if
  555. } for
  556. dist PSL_cuts k get le % Having dealt with the cut, we may add the regular point
  557. {PSL_xx j PSL_x i get put PSL_yy j PSL_y i get put
  558. PSL_kind j 0 put % Ordinary (original) coordinates
  559. /j j 1 add def % Go to next output point
  560. } if
  561. } for
  562. } def
  563. /PSL_CT_reversepath
  564. {PSL_xp j get PSL_xp 0 get lt % Path must first be reversed to avoid upside-down text
  565. {0 1 j 2 idiv % Loop over half the path and swap left/right points
  566. { /left exch def % Current left point
  567. /right j left sub def % Matching right point
  568. /tmp PSL_xp left get def % Swap left and right values for x then y
  569. PSL_xp left PSL_xp right get put
  570. PSL_xp right tmp put
  571. /tmp PSL_yp left get def
  572. PSL_yp left PSL_yp right get put
  573. PSL_yp right tmp put
  574. } for
  575. } if
  576. % Now PSL_xp/yp has the correct order to give proper text angles
  577. } def
  578. /PSL_CT_placelabel
  579. { % Places the curved text label on current segment
  580. /PSL_just PSL_label_justify k get def % Get this labels justification
  581. /PSL_height PSL_heights k get def % Recall the height of this string
  582. /psl_label PSL_str k get def % Get the current label
  583. /psl_depth psl_label sd def % Determine depth beneath baseline
  584. PSL_usebox % Want to lay down box outline or fill
  585. {PSL_CT_clippath % Box path now current path
  586. PSL_fillbox % Want to paint box
  587. {V PSL_setboxrgb fill U} if
  588. PSL_drawbox % Want to draw outline of box
  589. {V PSL_setboxpen S U} if N
  590. } if
  591. PSL_CT_placeline psl_label PSL_gap_x PSL_just PSL_height psl_depth PSL_pathtext
  592. } def
  593. /PSL_CT_clippath
  594. { % Lays down a curved clipbox for one label
  595. /H PSL_height 2 div PSL_gap_y add def
  596. /xoff j 1 add array def
  597. /yoff j 1 add array def
  598. /angle 0 def % So it is at least a defined variable
  599. 0 1 j { % Loop over points along line to calculate angle and offsets
  600. /ii exch def % Index
  601. /x PSL_xp ii get def
  602. /y PSL_yp ii get def
  603. ii 0 eq { % Are we at the first point and hence must calculate angle using 0 and 1?
  604. /x1 PSL_xp 1 get def
  605. /y1 PSL_yp 1 get def
  606. /dx x1 x sub def
  607. /dy y1 y sub def
  608. }
  609. { /i1 ii 1 sub def % Previous point
  610. /x1 PSL_xp i1 get def
  611. /y1 PSL_yp i1 get def
  612. /dx x x1 sub def
  613. /dy y y1 sub def
  614. } ifelse
  615. dx 0.0 ne dy 0.0 ne and
  616. { /angle dy dx atan 90 add def} if % Only calculate new angle if not duplicates
  617. /sina angle sin def
  618. /cosa angle cos def
  619. xoff ii H cosa mul put
  620. yoff ii H sina mul put
  621. } for
  622. % Lay down next clip segment
  623. PSL_xp 0 get xoff 0 get add PSL_yp 0 get yoff 0 get add M
  624. 1 1 j { % Loop over the rest of the upper line
  625. /ii exch def
  626. PSL_xp ii get xoff ii get add PSL_yp ii get yoff ii get add L
  627. } for
  628. j -1 0 { % Loop backwards over the rest of the lower line
  629. /ii exch def
  630. PSL_xp ii get xoff ii get sub PSL_yp ii get yoff ii get sub L
  631. } for P
  632. } def
  633. /PSL_CT_drawline
  634. {
  635. /str 20 string def
  636. % PSL_strokeline PSL_seg 0 eq and % If we asked to draw lines...
  637. PSL_strokeline % If we asked to draw lines...
  638. {PSL_CT_placeline S} if % Lay down the rest of the path and stroke it
  639. /PSL_seg PSL_seg 1 add def % Goto next segment number
  640. /n 1 def % Set n to 1
  641. } def
  642. /PSL_CT_placeline
  643. {PSL_xp 0 get PSL_yp 0 get M % Set the anchor point of the path
  644. 1 1 j { /ii exch def PSL_xp ii get PSL_yp ii get L} for % Lay down the rest of the path
  645. } def
  646. %%%%%%%%%%%%%%%%%%% DRAW BASELINE TEXT SEGMENT LINES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  647. % PSL_draw_path_lines will draw the lines that have been stored in the concatenated
  648. % PSL_path_x and PSL_path_y arrays using the pen attributes in the PSL_path_pen array
  649. /PSL_draw_path_lines
  650. { % Draws the lines already stored in the PSL_path_x|y arrays
  651. /PSL_n_paths1 PSL_n_paths 1 sub def % One less is the upper limit in for loop over the paths
  652. V
  653. /psl_start 0 def % Start index of segment in concatenated path array
  654. 0 1 PSL_n_paths1 % Loop over all segments
  655. { /psl_k exch def % Index into the PSL arrays
  656. /PSL_n PSL_path_n psl_k get def % Get the number of points in this line segment
  657. /PSL_n1 PSL_n 1 sub def % One less is the upper limit in for loop over points
  658. PSL_path_pen psl_k get cvx exec % Get and set this line's pen
  659. N % Clean path
  660. PSL_path_x psl_start get PSL_path_y psl_start get M % Place anchor point of this segment
  661. 1 1 PSL_n1 % Loop over points in this segment
  662. { /psl_i exch def % Local index of next point in segment
  663. /psl_kk psl_i psl_start add def % Equivalent index in concatenated array of all segments
  664. PSL_path_x psl_kk get PSL_path_y psl_kk get L % Draw to next point
  665. } for
  666. S % Stroke this path
  667. /psl_start psl_start PSL_n add def % Go to next segment and update start index for path
  668. } for
  669. U
  670. } def
  671. %%%%%%%%%%%%%%%%%%% STRAIGHT BASELINE TEXT PLACEMENT FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  672. % PSL_straight_path_labels deals with straight text labels w/wo textboxes (rect or rounded).
  673. % Only the (x,y) location of each label is needed.
  674. % Use <flags> PSL_straight_path_labels to paint|draw textboxes and place text
  675. % Use <flags> PSL_straight_path_clip to use textboxes to define and activate clipping
  676. % Subroutines of these functions are called PSL_ST_*
  677. % Local variables are called psl_*, "global" are called PSL_*
  678. /PSL_straight_path_labels
  679. { % This function will lay down (a) text box paint, (b) text box outline, and (c) text labels
  680. % All of these are optionals specified by the bit flag.
  681. /psl_bits exch def % Single bitflag argument passed
  682. /PSL_placetext psl_bits 2 and 2 eq def % true to place text, false to just make space
  683. /PSL_rounded psl_bits 32 and 32 eq def % true for rounded box shape, false gives rectangular box
  684. /PSL_fillbox psl_bits 128 and 128 eq def % true to paint box opaque before placing text
  685. /PSL_drawbox psl_bits 256 and 256 eq def % true to draw box outline before placing text
  686. /PSL_n_labels_minus_1 PSL_n_labels 1 sub def % Upper limit in loop over labels
  687. /PSL_usebox PSL_fillbox PSL_drawbox or def % true if we need box outline for fill or stroke or both
  688. 0 1 PSL_n_labels_minus_1 % Loop psl_k = 0 < PSL_n_labels
  689. { /psl_k exch def % Current label index psl_k
  690. PSL_ST_prepare_text % Get all dimensions, coordinates, etc. for this label
  691. PSL_usebox % If a text box is requested we go in here:
  692. { PSL_rounded % Place text box path, either straight or rounded, on stack
  693. {PSL_ST_textbox_round}
  694. {PSL_ST_textbox_rect}
  695. ifelse
  696. PSL_fillbox {V PSL_setboxrgb fill U} if % Paint it, if requested
  697. PSL_drawbox {V PSL_setboxpen S U} if % Outline it, if requested
  698. N % Done, so remove path
  699. } if
  700. PSL_placetext {PSL_ST_place_label} if % Show text, if requested
  701. } for
  702. } def
  703. /PSL_straight_path_clip
  704. { % This function will create a total clip path for all the labels in PSL_txt
  705. /psl_bits exch def % Single bit flag argument passed
  706. /PSL_rounded psl_bits 32 and 32 eq def % true for rounded box shape, false gives rectangular box
  707. /PSL_n_labels_minus_1 PSL_n_labels 1 sub def % Upper limit in loop over labels
  708. N clipsave clippath % Start clip path by selecting the entire mappable area
  709. 0 1 PSL_n_labels_minus_1 % Loop over all labels
  710. { /psl_k exch def % Current label index psl_k
  711. PSL_ST_prepare_text % Get all dimensions, coordinates, etc. for this label
  712. PSL_rounded % Get either straight or rounded text box path
  713. {PSL_ST_textbox_round}
  714. {PSL_ST_textbox_rect}
  715. ifelse
  716. } for
  717. PSL_clip N % Set the new clip path, increment clip counter and clear path
  718. } def
  719. /PSL_ST_prepare_text % Compute various dimensions and coordinates for one label
  720. { % The current label has index psl_k
  721. /psl_xp PSL_txt_x psl_k get def % Get text placement x coordinate
  722. /psl_yp PSL_txt_y psl_k get def % Get text placement y coordinate
  723. /psl_label PSL_label_str psl_k get def % Current text label
  724. PSL_label_font psl_k get cvx exec % Get and set this label's font attributes
  725. /PSL_height PSL_heights psl_k get def % Recall the height of this string
  726. /psl_boxH PSL_height PSL_gap_y 2 mul add def % Set height of current label including clearance
  727. /PSL_just PSL_label_justify psl_k get def % Get text justification (1-11)
  728. /PSL_justx PSL_just 4 mod 1 sub 2 div neg def % This is 0, -0.5, or -1 for relative x-shift
  729. /PSL_justy PSL_just 4 idiv 2 div neg def % This is 0, -0.5, or -1 for relative y-shift
  730. /psl_SW psl_label stringwidth pop def % Width of current label space
  731. /psl_boxW psl_SW PSL_gap_x 2 mul add def % Width of current label space including clearance
  732. /psl_x0 psl_SW PSL_justx mul def % (psl_x0,psl_y0) is rotated/adjusted text LL point on inside rectangle relative to psl_xp,psl_yp
  733. /psl_y0 PSL_justy PSL_height mul def %
  734. /psl_angle PSL_label_angle psl_k get def % The angle of text w.r.t. baseline
  735. } def
  736. /PSL_ST_textbox_rect % Compute and place rectangular path for current label
  737. {
  738. psl_xp psl_yp T psl_angle R psl_x0 psl_y0 T % Rotate the coordinate system to follow baseline text and make (psl_x0,psl_y0) the new origin
  739. PSL_gap_x neg PSL_gap_y neg M % Set LL anchor point for rectangular box
  740. 0 psl_boxH D psl_boxW 0 D 0 psl_boxH neg D P % Draw text box going CW
  741. psl_x0 neg psl_y0 neg T psl_angle neg R psl_xp neg psl_yp neg T % Unto trans/rot above
  742. } def
  743. /PSL_ST_textbox_round % Compute and place rounded rectangular path for current label
  744. {
  745. /psl_BoxR PSL_gap_x PSL_gap_y lt {PSL_gap_x} {PSL_gap_y} ifelse def % Smallest gap distance is our corner radius
  746. /psl_xd PSL_gap_x psl_BoxR sub def % When x_gap exceeds y_gap there will be an adjustment in x, else 0
  747. /psl_yd PSL_gap_y psl_BoxR sub def % When y_gap exceeds x_gap there will be an adjustment in y, else 0
  748. /psl_xL PSL_gap_x neg def % Left-most x coordinate of text box
  749. /psl_yB PSL_gap_y neg def % Bottom y coordinate of text box
  750. /psl_yT psl_boxH psl_yB add def % Top y coordinate of text box
  751. /psl_H2 PSL_height psl_yd 2 mul add def % Inner height when adjusting for any psl_yd offset
  752. /psl_W2 psl_SW psl_xd 2 mul add def % Inner width when adjusting for any psl_xd offset
  753. /psl_xR psl_xL psl_boxW add def % Right-most x coordinate of text box
  754. /psl_x0 psl_SW PSL_justx mul def % (psl_x0,psl_y0) is rotated/adjusted text LL point on inside rectangle relative to psl_xp,psl_yp
  755. psl_xp psl_yp T psl_angle R psl_x0 psl_y0 T % Rotate the coordinate system to follow baseline text and make (psl_x0,psl_y0) the new origin
  756. psl_xL psl_yd M % LL anchor point for rounded box is on lower left side just before rounded corner
  757. psl_xL psl_yT psl_xR psl_yT psl_BoxR arct psl_W2 0 D % Draw UL rounded corner and line to start of UR rounded corner
  758. psl_xR psl_yT psl_xR psl_yB psl_BoxR arct 0 psl_H2 neg D % Draw UR rounded corner and line to LR rounded corner
  759. psl_xR psl_yB psl_xL psl_yB psl_BoxR arct psl_W2 neg 0 D % Draw LR rounded corner and line to LL rounded corner
  760. psl_xL psl_yB psl_xL psl_yd psl_BoxR arct P % Draw LL rounded corner and close the clippath segment
  761. psl_x0 neg psl_y0 neg T psl_angle neg R psl_xp neg psl_yp neg T % Unto trans/rot above
  762. } def
  763. /PSL_ST_place_label % Just place the current label
  764. {
  765. V psl_xp psl_yp T psl_angle R % Set origin at text point and rotate the coordinate system to follow baseline text
  766. psl_SW PSL_justx mul psl_y0 M % Goto LL point on label
  767. psl_label dup sd neg 0 exch G show % Place the text, adjust vertically for any depth below baseline
  768. U % Undo damage to coordinate system
  769. } def
  770. /PSL_nclip 0 def % The depth of clipping in effect
  771. /PSL_clip {clip /PSL_nclip PSL_nclip 1 add def} def % Clip and update PSL_nclip
  772. /PSL_eoclip {eoclip /PSL_nclip PSL_nclip 1 add def} def % Even-odd clip and update PSL_nclip
  773. /PSL_cliprestore {cliprestore /PSL_nclip PSL_nclip 1 sub def} def % Cliprestore and update PSL_nclip
  774. %%EndProlog
  775. %%BeginSetup
  776. /PSLevel /languagelevel where {pop languagelevel} {1} ifelse def
  777. PSLevel 1 gt { << /PageSize [612 792] /ImagingBBox null >> setpagedevice } if
  778. %%EndSetup
  779. %%Page: 1 1
  780. %%BeginPageSetup
  781. %
  782. % Init coordinate system and scales
  783. %
  784. %
  785. % Scale initialized to 0.06, so 1 inch equals 1200 Postscript units
  786. %
  787. V 0.06 0.06 scale
  788. %%EndPageSetup
  789. %
  790. % End of PSL header
  791. %
  792. /PSL_page_xsize 10200 def
  793. /PSL_page_ysize 13200 def
  794. 0 A
  795. FQ
  796. O0
  797. 1200 1200 TM
  798. % PostScript produced by:
  799. %%GMT: pstext -R0/6/0/4 -Jx1i -Ba1 -P -Dj0.5i/0.5i -F+f32p+jLB -Gyellow -W0.25p,green -TO -K -C1c
  800. %%PROJ: xy 0.00000000 6.00000000 0.00000000 4.00000000 0.000 6.000 0.000 4.000 +xy +a=6378137.000 +b=6356752.314245
  801. %%BeginObject PSL_Layer_1
  802. 0 setlinecap
  803. 0 setlinejoin
  804. 3.32551 setmiterlimit
  805. %
  806. % Activate Map clip path
  807. %
  808. %
  809. % Start of polygon clip path
  810. %
  811. clipsave
  812. 0 0 M
  813. 7200 0 D
  814. 0 4800 D
  815. -7200 0 D
  816. PSL_clip N
  817. %
  818. % End of polygon clip path. Polygon clipping is currently ON
  819. %
  820. 4 W
  821. 0 1 0 C
  822. {1 1 0 C} FS
  823. O1
  824. %
  825. % PSL_plottextbox begin:
  826. %
  827. PSL_font_encode 0 get 0 eq {ISOLatin1+_Encoding /Helvetica /Helvetica PSL_reencode PSL_font_encode 0 1 put} if % Set this font
  828. 533 F0
  829. V
  830. (TEXT) V MU 0 0 M E /PSL_dim_w edef FP pathbbox N /PSL_dim_h edef /PSL_dim_x1 edef /PSL_dim_d edef /PSL_dim_x0 edef U
  831. /PSL_dx 472 def
  832. /PSL_dy 472 def
  833. 3000 3000 T PSL_dim_h PSL_dim_d sub PSL_dy 2 mul add PSL_dim_x1 PSL_dim_x0 sub PSL_dx 2 mul add 472 PSL_dim_x0 PSL_dx sub PSL_dim_d PSL_dy sub SB
  834. U
  835. %
  836. % PSL_plottextbox end:
  837. %
  838. 0 A
  839. 3000 3000 M (TEXT) Z
  840. %
  841. % Deactivate Map clip path
  842. %
  843. PSL_cliprestore
  844. %
  845. % Clipping reduced by 1 level
  846. %
  847. 25 W
  848. %
  849. % Start of basemap
  850. %
  851. %
  852. % Map boundaries
  853. %
  854. 2 setlinecap
  855. %
  856. % Start of left y-axis
  857. %
  858. %
  859. % Axis tick marks and annotations
  860. %
  861. N 0 4800 M 0 -4800 D S
  862. /PSL_A0_y 83 def
  863. /PSL_A1_y 0 def
  864. 8 W
  865. N 0 0 M -83 0 D S
  866. N 0 1200 M -83 0 D S
  867. N 0 2400 M -83 0 D S
  868. N 0 3600 M -83 0 D S
  869. N 0 4800 M -83 0 D S
  870. /PSL_AH0 0
  871. /MM {neg exch M} def
  872. 200 F0
  873. (0) sw mx
  874. (1) sw mx
  875. (2) sw mx
  876. (3) sw mx
  877. (4) sw mx
  878. def
  879. /PSL_A0_y PSL_A0_y 83 add def
  880. 0 PSL_A0_y MM
  881. (0) mr Z
  882. 1200 PSL_A0_y MM
  883. (1) mr Z
  884. 2400 PSL_A0_y MM
  885. (2) mr Z
  886. 3600 PSL_A0_y MM
  887. (3) mr Z
  888. 4800 PSL_A0_y MM
  889. (4) mr Z
  890. /PSL_A0_y PSL_A0_y PSL_AH0 add def
  891. /PSL_LH 0 def /PSL_L_y PSL_A0_y PSL_A1_y mx def
  892. %
  893. % End of left y-axis
  894. %
  895. %
  896. % Start of right y-axis
  897. %
  898. 7200 0 T
  899. %
  900. % Axis tick marks and annotations
  901. %
  902. 25 W
  903. N 0 4800 M 0 -4800 D S
  904. /PSL_A0_y 83 def
  905. /PSL_A1_y 0 def
  906. 8 W
  907. N 0 0 M 83 0 D S
  908. N 0 1200 M 83 0 D S
  909. N 0 2400 M 83 0 D S
  910. N 0 3600 M 83 0 D S
  911. N 0 4800 M 83 0 D S
  912. /PSL_AH0 0
  913. /MM {exch M} def
  914. (0) sw mx
  915. (1) sw mx
  916. (2) sw mx
  917. (3) sw mx
  918. (4) sw mx
  919. def
  920. /PSL_A0_y PSL_A0_y 83 add PSL_AH0 add def
  921. 0 PSL_A0_y MM
  922. (0) mr Z
  923. 1200 PSL_A0_y MM
  924. (1) mr Z
  925. 2400 PSL_A0_y MM
  926. (2) mr Z
  927. 3600 PSL_A0_y MM
  928. (3) mr Z
  929. 4800 PSL_A0_y MM
  930. (4) mr Z
  931. /PSL_LH 0 def /PSL_L_y PSL_A0_y PSL_A1_y mx def
  932. %
  933. % End of right y-axis
  934. %
  935. -7200 0 T
  936. %
  937. % Start of lower x-axis
  938. %
  939. %
  940. % Axis tick marks and annotations
  941. %
  942. 25 W
  943. N 0 0 M 7200 0 D S
  944. /PSL_A0_y 83 def
  945. /PSL_A1_y 0 def
  946. 8 W
  947. N 0 0 M 0 -83 D S
  948. N 1200 0 M 0 -83 D S
  949. N 2400 0 M 0 -83 D S
  950. N 3600 0 M 0 -83 D S
  951. N 4800 0 M 0 -83 D S
  952. N 6000 0 M 0 -83 D S
  953. N 7200 0 M 0 -83 D S
  954. /PSL_AH0 0
  955. /MM {neg M} def
  956. (0) sh mx
  957. (1) sh mx
  958. (2) sh mx
  959. (3) sh mx
  960. (4) sh mx
  961. (5) sh mx
  962. (6) sh mx
  963. def
  964. /PSL_A0_y PSL_A0_y 83 add PSL_AH0 add def
  965. 0 PSL_A0_y MM
  966. (0) bc Z
  967. 1200 PSL_A0_y MM
  968. (1) bc Z
  969. 2400 PSL_A0_y MM
  970. (2) bc Z
  971. 3600 PSL_A0_y MM
  972. (3) bc Z
  973. 4800 PSL_A0_y MM
  974. (4) bc Z
  975. 6000 PSL_A0_y MM
  976. (5) bc Z
  977. 7200 PSL_A0_y MM
  978. (6) bc Z
  979. /PSL_LH 0 def /PSL_L_y PSL_A0_y PSL_A1_y mx def
  980. %
  981. % End of lower x-axis
  982. %
  983. %
  984. % Start of upper x-axis
  985. %
  986. 0 4800 T
  987. %
  988. % Axis tick marks and annotations
  989. %
  990. 25 W
  991. N 0 0 M 7200 0 D S
  992. /PSL_A0_y 83 def
  993. /PSL_A1_y 0 def
  994. 8 W
  995. N 0 0 M 0 83 D S
  996. N 1200 0 M 0 83 D S
  997. N 2400 0 M 0 83 D S
  998. N 3600 0 M 0 83 D S
  999. N 4800 0 M 0 83 D S
  1000. N 6000 0 M 0 83 D S
  1001. N 7200 0 M 0 83 D S
  1002. /PSL_AH0 0
  1003. /MM {M} def
  1004. (0) sh mx
  1005. (1) sh mx
  1006. (2) sh mx
  1007. (3) sh mx
  1008. (4) sh mx
  1009. (5) sh mx
  1010. (6) sh mx
  1011. def
  1012. /PSL_A0_y PSL_A0_y 83 add def
  1013. 0 PSL_A0_y MM
  1014. (0) bc Z
  1015. 1200 PSL_A0_y MM
  1016. (1) bc Z
  1017. 2400 PSL_A0_y MM
  1018. (2) bc Z
  1019. 3600 PSL_A0_y MM
  1020. (3) bc Z
  1021. 4800 PSL_A0_y MM
  1022. (4) bc Z
  1023. 6000 PSL_A0_y MM
  1024. (5) bc Z
  1025. 7200 PSL_A0_y MM
  1026. (6) bc Z
  1027. /PSL_A0_y PSL_A0_y PSL_AH0 add def
  1028. /PSL_LH 0 def /PSL_L_y PSL_A0_y PSL_A1_y mx def
  1029. %
  1030. % End of upper x-axis
  1031. %
  1032. 0 -4800 T
  1033. 0 setlinecap
  1034. %
  1035. % End of basemap
  1036. %
  1037. %%EndObject
  1038. 0 A
  1039. FQ
  1040. O0
  1041. 0 6000 TM
  1042. % PostScript produced by:
  1043. %%GMT: pstext -R0/6/0/4 -Jx1i -O -K -Dj0.5i/0.5i -F+f32p+jLB -Gc -C1c -TO -Y5i
  1044. %%PROJ: xy 0.00000000 6.00000000 0.00000000 4.00000000 0.000 6.000 0.000 4.000 +xy +a=6378137.000 +b=6356752.314245
  1045. %%BeginObject PSL_Layer_2
  1046. 0 setlinecap
  1047. 0 setlinejoin
  1048. 3.32551 setmiterlimit
  1049. %
  1050. % Activate Map clip path
  1051. %
  1052. %
  1053. % Start of polygon clip path
  1054. %
  1055. clipsave
  1056. 0 0 M
  1057. 7200 0 D
  1058. 0 4800 D
  1059. -7200 0 D
  1060. PSL_clip N
  1061. %
  1062. % End of polygon clip path. Polygon clipping is currently ON
  1063. %
  1064. %
  1065. % Pen and fill for text boxes (if enabled):
  1066. %
  1067. /PSL_setboxpen {4 W 0 A [] 0 B} def
  1068. /PSL_setboxrgb {} def
  1069. PSL_font_encode 0 get 0 eq {ISOLatin1+_Encoding /Helvetica /Helvetica PSL_reencode PSL_font_encode 0 1 put} if % Set this font
  1070. /PSL_label_justify [ 1 ] def
  1071. /PSL_label_font [
  1072. (0 A 533 F0)
  1073. ] def
  1074. %
  1075. % Set constants for textbox clearance:
  1076. %
  1077. /PSL_gap_x 472 def
  1078. /PSL_gap_y 472 def
  1079. %
  1080. % Set array with baseline angle for each text label:
  1081. %
  1082. /PSL_label_angle [ 0.00 ] def
  1083. %
  1084. % Set array with the text labels:
  1085. %
  1086. /PSL_label_str [
  1087. (TEXT)
  1088. ] def
  1089. /PSL_label_n [ 1 ] def
  1090. /PSL_n_paths 1 def
  1091. /PSL_n_labels 1 def
  1092. %
  1093. % Set coordinate arrays for text label placements:
  1094. %
  1095. /PSL_txt_x [ 3000 ] def
  1096. /PSL_txt_y [ 3000 ] def
  1097. /PSL_txt_n [ 1 ] def
  1098. %
  1099. % Estimate text heights:
  1100. %
  1101. PSL_set_label_heights
  1102. %
  1103. % Display the texts:
  1104. %
  1105. 34 PSL_straight_path_labels
  1106. %
  1107. % Set up text clippath and turn clipping ON:
  1108. %
  1109. 36 PSL_straight_path_clip
  1110. %%EndObject
  1111. 0 A
  1112. FQ
  1113. O0
  1114. 0 0 TM
  1115. % PostScript produced by:
  1116. %%GMT: psxy -R0/6/0/4 -Jx1i -O -K -Sri -Gred
  1117. %%PROJ: xy 0.00000000 6.00000000 0.00000000 4.00000000 0.000 6.000 0.000 4.000 +xy +a=6378137.000 +b=6356752.314245
  1118. %%BeginObject PSL_Layer_3
  1119. 0 setlinecap
  1120. 0 setlinejoin
  1121. 3.32551 setmiterlimit
  1122. %
  1123. % Activate Map clip path
  1124. %
  1125. %
  1126. % Start of polygon clip path
  1127. %
  1128. clipsave
  1129. 0 0 M
  1130. 7200 0 D
  1131. 0 4800 D
  1132. -7200 0 D
  1133. PSL_clip N
  1134. %
  1135. % End of polygon clip path. Polygon clipping is currently ON
  1136. %
  1137. 4 W
  1138. V
  1139. {1 0 0 C} FS
  1140. 4800 7200 3600 2400 Sr
  1141. U
  1142. %
  1143. % Deactivate Map clip path
  1144. %
  1145. PSL_cliprestore
  1146. %
  1147. % Clipping reduced by 1 level
  1148. %
  1149. %%EndObject
  1150. 0 A
  1151. FQ
  1152. O0
  1153. 0 0 TM
  1154. % PostScript produced by:
  1155. %%GMT: psclip -R0/6/0/4 -Jx1i -C -O -K
  1156. %%PROJ: xy 0.00000000 6.00000000 0.00000000 4.00000000 0.000 0.000 0.000 0.000 +xy +a=6378137.000 +b=6356752.314245
  1157. %%BeginObject PSL_Layer_4
  1158. 0 setlinecap
  1159. 0 setlinejoin
  1160. 3.32551 setmiterlimit
  1161. PSL_nclip {PSL_cliprestore} repeat
  1162. %
  1163. % Clipping is currently OFF
  1164. %
  1165. %%EndObject
  1166. 0 A
  1167. FQ
  1168. O0
  1169. 0 -6000 TM
  1170. % PostScript produced by:
  1171. %%GMT: psxy -R0/6/0/9 -Jx1i -O -Y-5i -W0.5p,blue
  1172. %%PROJ: xy 0.00000000 6.00000000 0.00000000 9.00000000 0.000 6.000 0.000 9.000 +xy +a=6378137.000 +b=6356752.314245
  1173. %%BeginObject PSL_Layer_5
  1174. 0 setlinecap
  1175. 0 setlinejoin
  1176. 3.32551 setmiterlimit
  1177. 8 W
  1178. 0 0 1 C
  1179. 2538 0 M
  1180. 0 10800 D
  1181. S
  1182. 4830 0 M
  1183. 0 10800 D
  1184. S
  1185. 0 2526 M
  1186. 7200 0 D
  1187. S
  1188. 0 3864 M
  1189. 7200 0 D
  1190. S
  1191. 0 8526 M
  1192. 7200 0 D
  1193. S
  1194. 0 9864 M
  1195. 7200 0 D
  1196. S
  1197. %%EndObject
  1198. %%PageTrailer
  1199. %
  1200. % Reset transformations and call showpage
  1201. %
  1202. U
  1203. showpage
  1204. %%Trailer
  1205. end
  1206. %%EOF
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...