python/hypothesis: update to 6.121.0
[oi-userland.git] / components / print / cups / Solaris / tsol_separator.ps
blob215dec759f1588c3b62c79401413e6e067a0f20c
1 %%
2 %% Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 %%
5 %%
6 %% This PostScript file is used as input to tsol_labeled_banner,
7 %% which will prepend code to set the values of a number of
8 %% variables.
10 %% This PostScript file may be modified for local customizations or
11 %% internationalization.  Comments marked "INTERNATIONALIZE:" show 
12 %% places where changes may be made for internationalization.  Comments
13 %% marked "CUSTOMIZE:" show places where some typical customization
14 %% changes may be made.
17 %% The following comments describe variables set by tsol_labeled_banner 
19 %% These variables are from the print job information that can be
20 %% displayed with lpstat or lpq.
21 %% 
22 %%   /Job_Classification   The classification (from the sensitivity label) to 
23 %%                    be displayed at the top and bottom of the banner
24 %%   /Job_Printer     Printer Name
25 %%   /Job_Host        Host job was submitted from
26 %%   /Job_User        User who submitted the job
27 %%   /Job_JobID       Job number
28 %%   /Job_Title       Job title
29 %% 
30 %% Job Page labels are added in pstops filter, so page labels should not be
31 %% added here.
32 %% 
33 %%   /Job_DoPageLabels Print page labels NO.
34 %% 
35 %% These variables are generated from the system clock value.
36 %% 
37 %%   /Job_Date        Date and time the job is being printed, in the
38 %%                    locale's default format
39 %%   /Job_Hash        A randomly generatred identifying number for 
40 %%                    matching up the banner and trailer pages of the job
41 %% 
42 %% 
43 %% The following variables are the job's labels
44 %% as interpreted by the bcltobanner(3TSOL) library routine.
45 %% 
46 %%   /Job_Classification   The classification (from the sensitivity label) to be
47 %%                    displayed at the top and bottom of the banner page.
48 %%   /Job_Protect     The sensitivity label to be displayed in the protect-as 
49 %%                    field.
50 %%   /Job_Caveats     The caveats from the sesitivity label.
51 %%   /Job_Channels    The channels from the sesitivity label.
52 %% 
53 %% 
54 %% The following variables are the job's Sensitivity Label and
55 %% Information Label as interpreted by the bsltos and biltos library
56 %% routines.
57 %% 
58 %%   /Job_SL_Internal The sensitivity label in internal view format.
59 %%   /Job_SL_External The sensitivity label in external view format.
61 /SeparatorPagesDict 100 dict def
62 userdict /JobDict known not {
63   userdict /JobDict 100 dict put
64 } if
66 SeparatorPagesDict
67 begin
69     %% CUSTOMIZE: To print header page label left-justified, set this to false
70     /center_label true def      
72     /center_show where {
73         pop
74     } {
75         userdict /center_show
76         {
77             dup stringwidth exch
78             2 div neg exch rmoveto show
79         } put
80     } ifelse
82     /append where
83     { pop }
84     {
85     /append
86     {
87         1 index length 1 index length add
88         1 index dup type /dicttype eq
89         {
90         pop dict
91         begin
92             exch { def } forall
93             { def } forall
94             currentdict
95         end
96         }
97         {
98         /arraytype eq { array } { string } ifelse
99         dup 4 -1 roll 1 index copy length 4 -1 roll putinterval
100         }
101         ifelse
102     } def
103     } ifelse
105     /fontheight
106     systemdict /fontheight known
107     { systemdict /fontheight get }
108     {
109         {
110         gsave
111             setfont (qf) true charpath flattenpath pathbbox
112             4 -1 roll pop exch pop exch sub
113         grestore
114         }
115     } ifelse
116     def
118     /m { moveto } def
119     /r { rmoveto } def
120     /rl { rlineto } def
122     /NewLine {
123     currentpoint exch pop
124     currentfont fontheight sub errorx0 exch moveto
125     } def
127     /clipSL {
128         /MaxWidth exch def
129         dup stringwidth pop MaxWidth gt {
130             {
131                 dup stringwidth pop (<-) stringwidth pop add MaxWidth le {exit} if
132                 dup 0 exch length 1 sub getinterval
133             } loop 
134             (<-)
135             %% Concatenate strings
136             dup length 2 index length add 1 index pop string
137             dup 0 4 index putinterval
138             dup 4 -1 roll length 4 -1 roll  putinterval
139         } if
140     } def
142     /BreakWithBlanks {
144         {restoftext ( ) search
145             {
146             /blank_nextword exch def pop
147                 /blank_restoftext exch def
148                 /blank_wordwidth blank_nextword stringwidth pop def
150                     restoftext (/) search
151                     {
152                             /slash_nextword exch def pop
153                             /slash_restoftext exch def
154                             /slash_wordwidth slash_nextword stringwidth pop def
156                             blank_wordwidth slash_wordwidth lt
157                             {
158                                     /nextword blank_nextword def
159                                     /restoftext blank_restoftext def
160                                     /wordwidth blank_wordwidth def
161                                     /breakwidth ( ) stringwidth pop def
162                             }
163                             {
164                                     /nextword slash_nextword def
165                                     /restoftext slash_restoftext def
166                                     /wordwidth slash_wordwidth def
167                                     /breakwidth (/) stringwidth pop def
168                             }ifelse
169                     }
170                     {
171                             pop
172                             /nextword blank_nextword def
173                             /restoftext blank_restoftext def
174                             /wordwidth blank_wordwidth def
175                             /breakwidth ( ) stringwidth pop def
176                     }ifelse
178             curwidth wordwidth add linewidth gt
179             {textstring startchar
180                 lastwordbreak startchar sub
181                 getinterval proc
182             /startchar lastwordbreak def
183             /curwidth wordwidth breakwidth add def }
185             {/curwidth curwidth wordwidth add
186                 breakwidth add def
187             } ifelse
188             /lastwordbreak lastwordbreak
189             nextword length add 1 add def
190             }
191             {pop BreakWithSlashes exit}
192             ifelse
193         }loop
194 }def
196     /BreakWithSlashes
197       {
198         /breakchar (/) def
199         /breakwidth breakchar stringwidth pop def
200         {restoftext breakchar search
201             {/nextword exch def pop
202             /restoftext exch def
203             /wordwidth nextword stringwidth pop def
205             curwidth wordwidth add linewidth gt
206             {textstring startchar
207                 lastwordbreak startchar sub
208                 getinterval proc
209             /startchar lastwordbreak def
210             /curwidth wordwidth breakwidth add def }
212             {/curwidth curwidth wordwidth add
213                 breakwidth add def
214             } ifelse
215             /lastwordbreak lastwordbreak
216             nextword length add 1 add def
217             }
218             {pop exit}
219             ifelse
220         }loop
221       }def
223     /BreakIntoLines
224       {/proc exch def
225         /linewidth exch 40 sub def
226         /textstring exch def
228         /curwidth 0 def
229         /lastwordbreak 0 def
230         /startchar 0 def
231         /restoftext textstring def
233     % begin scale the font if necessary
235         /allowedarea linewidth fbh 10 div mul def
236         /currentarea currentfont fontheight textstring stringwidth pop mul def
238         currentarea allowedarea gt
239         {
240                 currentfont allowedarea currentarea div scalefont setfont
241         }if
243     % end scale the font if necessary
245         BreakWithBlanks
246         /lastchar textstring length def
247         textstring startchar lastchar startchar sub
248         getinterval proc
249       }def
252     /ShowBanner {
253         JobDict /Job_Proclam? get {
254         systemdict /showpage get cvx exec
255         } if
256     } def
258     /Init {
260     initgraphics
261     /#copies 1 def
262     initmatrix
263     erasepage
265     clippath pathbbox /fbh exch def
266     /fbw exch def
267     pop pop newpath
268     0 0 moveto
269     0 fbh translate
270     0 0 moveto
272     /margin fbh 20 div def
273     /imargin margin 1.1 mul def
274     /errorx0 imargin def
275     /errorx1 fbw imargin sub def
276     /errory1 imargin def
278     gsave
279     } def
281 % this stuff is lpd dependant.
283     /lpdglue {
284     userdict
285     begin
286         JobDict
287         begin
288         % If Job_Printer is defined, assume the others are too,
289         /Job_Printer where
290         {
291             pop
292             /Job_Proclam? true def
293             /Job_Endclam? true def
295             /Printer Job_Printer def
296             /Host Job_Host def
297             /User Job_User def
298             /Title Job_Title def
299             /JobID Job_JobID def
300             /Date Job_Date def
302             %% CUSTOMIZE: To use a different string at the top and 
303             %% bottom of each page, change the following line.  For
304             %% instance, to use the sensitivity label in external view
305             %% format, change the line to: /PageLabel Job_SL_External def
306             %% To eliminate page labels completely, change this line to 
307             %% set the page label to an empty string: /PageLabel () def
308             /PageLabel Job_SL_Internal def
309             Job_Protect () eq
310                 {
311                     %% Job_Protect is empty because SLs are turned 
312                     %% off in secconf.  (Turning off SLs is actually not yet
313                     %% supported by the system.)
314                     /Protect () def
315                     /Protect_Text1 () def
316                     /Protect_Text2 () def
317                 }
318                 {
319                     %% INTERNATIONALIZE/CUSTOMIZE: Replace the text between 
320                     %% parentheses with the appropriate text to display 
321                     %% above and below the SL.
322                     /Protect Job_Protect def
323                     /Protect_Text1 (This output must be protected as:) def
324                     /Protect_Text2 (unless manually reviewed and downgraded.) def
325                 } 
326                 ifelse
328             %% CUSTOMIZE:  To not print the caveats, change 
329             %% this line to /Caveats () def
330             /Caveats Job_Caveats def
331             %% CUSTOMIZE:  To not print the channels, change 
332             %% this line to /Channels () def
333             /Channels Job_Channels def
335             %% CUSTOMIZE:  To not print the hash number, change 
336             %% this line to /Hash () def
337             /Hash Job_Hash def
339             %% CUSTOMIZE:  To not print the head label, change 
340             %% this line to /HeadLabel () def
341             %% You may also substitute another string.  For example, to use
342             %% the SL in internal view format: /HeadLabel Job_SL_Internal def
343             /HeadLabel Job_Classification def
344         } {
345             /Job_Proclam? false def
346             /Job_Endclam? false def
347         } ifelse
348         end
349     end
350     } def
352     /border {
353         gsave
354                 setlinewidth
355                 setgray
356                 30 -20 moveto
357                 0 60 fbh sub rlineto
358                 fbw 60 sub 0 rlineto
359                 0 fbh 60 sub rlineto
360                 60 currentlinewidth 2 div sub fbw sub 0 rlineto
361                 stroke
362         grestore
363     } def
365     /TSOLJobInfo {
366     gsave
368                 /fontscale fbh 50 div def
369                 /Courier-Bold findfont fontscale scalefont setfont
370                 /ClippedLabel
371                         JobDict /HeadLabel get 
372                         SeparatorPagesDict /fbw get 90 sub
373                         SeparatorPagesDict /clipSL get exec 
374                         def
376                 /head_len {
377                         ClippedLabel stringwidth pop 5 add
378                         HeadLabel () eq { pop 0 } if
379                 } def
380                 15 setlinewidth
381                 fbw 2 div head_len 2 div sub -20 moveto
382                 head_len 0 rlineto stroke
383                 1 setgray
384                 fbw 10 div -25 m gsave ClippedLabel
385                         currentpoint exch pop fbw 2 div exch moveto
386                 center_show NewLine grestore
388                 0 setgray
389                 /fontscale fbh 70 div def
391                 /Helvetica findfont fontscale scalefont setfont
392                 0 fbh 8 div neg r Protect_Text1
393                         currentpoint exch pop 
394                 center_label {
395                         fbw 2 div exch moveto center_show
396                 }
397                 {
398                         fbw 10 div exch moveto show
399                 }
400                 ifelse
401                 /fontscale fbh 60 div def
402                 /Helvetica-Bold findfont fontscale scalefont setfont
404                 0 fbh 150 div neg r
405                 Protect
406                 fbw errorx0 3 mul sub   % width minus margins
408                 center_label {
409                         {NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
410                                 BreakIntoLines
411                 }
412                 {
413                         {NewLine currentpoint exch pop fbw 10 div exch moveto show}
414                                 BreakIntoLines
415                 } 
416                 ifelse
418                 /fontscale fbh 70 div def
419                 /Helvetica findfont fontscale scalefont setfont
420                 0 fbh 50 div neg r Protect_Text2
421                         currentpoint exch pop 
422                 center_label {
423                         fbw 2 div exch moveto center_show
424                 }
425                 {
426                         fbw 10 div exch moveto show
427                 }
428                 ifelse
430                 /fontscale fbh 60 div def
431                 /Helvetica-Bold findfont fontscale scalefont setfont
432                 0 fbh 200 div neg r
434                 0 fbh 10 div neg r
436                 /fontscale fbh 40 div def
437                 /Helvetica-Bold findfont fontscale scalefont setfont
439                 0 fbh 30 div neg r gsave 
440                         %% INTERNATIONALIZE: Replace the text between
441                         %% parentheses with the appropriate text.
442                         (User:  ) User (@) Host append append append
443                         currentpoint exch pop fbw 2 div exch moveto center_show
444                         NewLine grestore
445                 0 fbh 30 div neg r gsave 
446                         %% INTERNATIONALIZE: Replace the text between
447                         %% parentheses with the appropriate text.
448                         (Job:  ) JobID append
449                         currentpoint exch pop fbw 2 div exch moveto center_show
450                         NewLine grestore
451                 0 fbh 30 div neg r gsave 
452                         Title
453                         currentpoint exch pop fbw 2 div exch moveto center_show
454                         NewLine grestore
455                 /fontscale fbh 70 div def
456                 /Helvetica findfont fontscale scalefont setfont
457                 0 fbh 30 div neg r gsave 
458                         %% INTERNATIONALIZE: Replace the text between
459                         %% parentheses with the appropriate text.
460                         (Printed at:  ) Date append
461                         currentpoint exch pop fbw 2 div exch moveto center_show
462                         NewLine grestore
463                 0 fbh 30 div neg r gsave
464                         %% INTERNATIONALIZE: Replace the text between
465                         %% parentheses with the appropriate text.
466                         (Printer queue:  ) Printer append
467                         currentpoint exch pop fbw 2 div exch moveto center_show
468                         NewLine grestore
470                 /Helvetica-Bold findfont fontscale scalefont setfont
471                 0 fbh 20 div neg r
472                 Caveats
473                 fbw errorx0 3 mul sub   % width minus margins
474                 {NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
475                 BreakIntoLines
477                 0 fbh 30 div neg r
478                 Channels
479                 fbw errorx0 3 mul sub   % width minus margins
480                 {NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
481                 BreakIntoLines
483                 /fontscale fbh 50 div def
484                 /Courier-Bold findfont fontscale scalefont setfont
485                 15 setlinewidth
486                 fbw 2 div head_len 2 div sub 40 fbh sub moveto
487                 head_len 0 rlineto stroke
488                 1 setgray
489                 fbw 10 div 35 fbh sub m gsave ClippedLabel
490                         currentpoint exch pop fbw 2 div exch moveto center_show
491             NewLine grestore
493         grestore
494     } def
496     /JobHashInfo {
497     gsave
498                 0 setgray
499                 /fontscale fbh 50 div def
500                 /Helvetica-Bold findfont fontscale scalefont setfont
502                 %% Upper left corner
503                 Hash
504                 fbw 12 div 50 neg m gsave show grestore
506                 %% Lower left corner
507                 Hash
508                 fbw 12 div fbh 60 sub neg m gsave show grestore
510                 %% Lower right corner
511                 Hash dup stringwidth pop
512                 fbw 11 mul 12 div exch sub fbh 60 sub neg m gsave show grestore
514                 %% Upper right corner
515                 Hash dup stringwidth pop
516                 fbw 11 mul 12 div exch sub 50 neg m gsave show grestore
518                 /fontscale fbh 40 div def
519                 /Helvetica-Bold findfont fontscale scalefont setfont
520                 fbw 10 div 120 fbh sub m gsave 
521                 currentpoint exch pop fbw 2 div exch moveto center_show
523         grestore
524     } def
527     /jobproclam {
528     JobDict
529     begin
530         Job_Proclam?
531         %% INTERNATIONALIZE: Replace the text between
532         %% parentheses with the appropriate text.
533         { TSOLJobInfo (JOB START) JobHashInfo}
534         { 0 -100 rmoveto }
535         ifelse
536     end
537     } def
539     /jobendclam {
540         JobDict
541         begin
542             Job_Endclam?
543         %% INTERNATIONALIZE: Replace the text between
544         %% parentheses with the appropriate text.
545         { TSOLJobInfo (JOB END) JobHashInfo}
546         { 0 -100 rmoveto }
547         ifelse
548     end
549     } def
552     /JobProclam {
553         jobproclam
554     } def
556     /JobEndclam {
557         jobendclam
558     } def
560 % A fancy box around page
562     /BannerBorder {
563        .7 16 border
564     } def
566     /TrailerBorder {
567        0 4 border
568     } def
571 % -------------------------------------------------------------------------
573 %   The structure of separator pages is defined below. This is invoked by
574 %   using a line like:
576 %   SeparatorPagesDict /Banner get exec
579     /Banner {
580     SeparatorPagesDict
581     begin
582         Init
583         lpdglue
584         BannerBorder
585         JobProclam
586     end
587     } def
589     /Trailer {
590     SeparatorPagesDict
591     begin
592         Init
593         lpdglue
594         TrailerBorder
595         JobEndclam
596     end
597     } def
599     /SkipPageLabels false def
602 SeparatorPagesDict begin
603         clippath pathbbox /fbh exch def
604         /fbw exch def
605         pop pop
606         lpdglue
610 JobDict /Job_DoPageLabels get (YES) eq 
611     JobDict /PageLabel get () ne and {
612     userdict begin
613         /showpage {
614                 systemdict /showpage get cvx exec
615         } bind def
616     end
619 %% End of tsol_separator.ps