61 These provide protocol similar to the one provided by display graphicContexts. |
61 These provide protocol similar to the one provided by display graphicContexts. |
62 Notice, that these postscript classes are derived from public domain code; |
62 Notice, that these postscript classes are derived from public domain code; |
63 there is no warranty. |
63 there is no warranty. |
64 |
64 |
65 [see also:] |
65 [see also:] |
66 PSGraphicsContext |
66 PSGraphicsContext |
67 EpsonFX1PrinterStream HPLjetIIPrinterStream PrinterStream |
67 EpsonFX1PrinterStream HPLjetIIPrinterStream PrinterStream |
68 |
68 |
69 [author:] |
69 [author:] |
70 Claus Gittinger |
70 Claus Gittinger |
71 " |
71 " |
72 ! |
72 ! |
73 |
73 |
74 examples |
74 examples |
75 " |
75 " |
76 For text printing, use: |
76 For text printing, use: |
77 [exBegin] |
77 [exBegin] |
78 |s| |
78 |s| |
79 |
79 |
80 s := Printer new. |
80 s := Printer new. |
81 s nextPutAll:'hello'; cr. |
81 s nextPutAll:'hello'; cr. |
82 s bold. |
82 s nextPutAll:'normal '. |
83 s nextPutAll:'this is bold'; cr. |
83 s bold. |
84 s normal. |
84 s nextPutAll:'this is bold'; cr. |
85 s italic. |
85 s normal. |
86 s nextPutAll:'this is italic'; cr. |
86 s nextPutAll:'normal '. |
87 s boldItalic. |
87 s italic. |
88 s nextPutAll:'this is boldItalic'; cr. |
88 s nextPutAll:'this is italic'; cr. |
89 s normal. |
89 s normal. |
90 s nextPutAll:'normal again'; cr. |
90 s nextPutAll:'normal '. |
91 s helvetica. |
91 s boldItalic. |
92 s nextPutAll:'helvetica'; cr. |
92 s nextPutAll:'this is boldItalic'; cr. |
93 s times. |
93 s normal. |
94 s nextPutAll:'times'; cr. |
94 s nextPutAll:'normal '. |
95 s courier. |
95 s underline. |
96 s nextPutAll:'courier'; cr. |
96 s nextPutAll:'this is underlined'; cr. |
97 s close |
97 s normal. |
98 [exEnd] |
98 s nextPutAll:'normal again'; cr. |
|
99 s helvetica. |
|
100 s nextPutAll:'helvetica'; cr. |
|
101 s times. |
|
102 s nextPutAll:'times'; cr. |
|
103 s courier. |
|
104 s nextPutAll:'courier'; cr. |
|
105 s close |
|
106 [exEnd] |
99 or, if you already have emphasized text at hand: |
107 or, if you already have emphasized text at hand: |
100 [exBegin] |
108 [exBegin] |
101 |s| |
109 |s| |
102 |
110 |
103 s := Printer new. |
111 s := Printer new. |
104 s nextPutAll:'hello'; cr. |
112 s nextPutAll:'hello'; cr. |
105 s nextPutAll:'this is '; |
113 s nextPutAll:'this is '; |
106 nextPutAll:(Text string:'bold' emphasis:#bold); |
114 nextPutAll:(Text string:'bold' emphasis:#bold); |
107 cr; |
115 cr; |
108 nextPutAll:'this is '; |
116 nextPutAll:'this is '; |
109 nextPutAll:(Text string:'italic' emphasis:#italic); |
117 nextPutAll:(Text string:'italic' emphasis:#italic); |
110 cr; |
118 cr; |
111 nextPutAll:'this is '; |
119 nextPutAll:'this is '; |
112 nextPutAll:(Text string:'boldItalic' emphasis:#(bold italic)); |
120 nextPutAll:(Text string:'boldItalic' emphasis:#(bold italic)); |
113 cr; |
121 cr; |
114 nextPutAll:'normal again'; |
122 nextPutAll:'normal again'; |
115 cr; |
123 cr; |
116 helvetica; |
124 helvetica; |
117 nextPutAll:'helvetica'; |
125 nextPutAll:'helvetica'; |
118 cr; |
126 cr; |
119 times; |
127 times; |
120 nextPutAll:'times'; |
128 nextPutAll:'times'; |
121 cr; |
129 cr; |
122 courier; |
130 courier; |
123 nextPutAll:'courier'; |
131 nextPutAll:'courier'; |
124 cr. |
132 cr. |
125 s close |
133 s close |
126 [exEnd] |
134 [exEnd] |
127 |
135 |
128 placing a page-hook, to add a page number: |
136 placing a page-hook, to add a page number: |
129 (page hooks require that you understand some postscript ... |
137 (page hooks require that you understand some postscript ... |
130 ... and have a look at how this class generates its postscript code) |
138 ... and have a look at how this class generates its postscript code) |
131 [exBegin] |
139 [exBegin] |
132 |s hook pageNr| |
140 |s hook pageNr| |
133 |
141 |
134 s := Printer new. |
142 s := Printer new. |
135 |
143 |
136 pageNr := 0. |
144 pageNr := 0. |
137 hook := [ |
145 hook := [ |
138 |
146 |
139 pageNr := pageNr + 1. |
147 pageNr := pageNr + 1. |
140 s placeString:('page ' , pageNr printString) at:(5500 @ 400). |
148 s placeString:('page ' , pageNr printString) at:(5500 @ 400). |
141 ]. |
149 ]. |
142 |
150 |
143 s pageEndAction:hook. |
151 s pageEndAction:hook. |
144 (1 to:200) do:[:lineNr | |
152 (1 to:200) do:[:lineNr | |
145 s nextPutAll:'line ' , lineNr printString. |
153 s nextPutAll:'line ' , lineNr printString. |
146 s cr. |
154 s cr. |
147 ]. |
155 ]. |
148 s close. |
156 s close. |
149 [exEnd] |
157 [exEnd] |
150 |
158 |
151 |
159 |
152 placing a page-hook, to add a custom frame, logo or company letter-head: |
160 placing a page-hook, to add a custom frame, logo or company letter-head: |
153 (page hooks require that you understand some postscript ... |
161 (page hooks require that you understand some postscript ... |
154 ... and have a look at how this class generates its postscript code. |
162 ... and have a look at how this class generates its postscript code. |
155 ... and notice that the code below is a q&d demo, working with letter-sized |
163 ... and notice that the code below is a q&d demo, working with letter-sized |
156 pages only; a real program should ask the printerStream about the actual |
164 pages only; a real program should ask the printerStream about the actual |
157 pageHeight/pageWidth.) |
165 pageHeight/pageWidth.) |
158 [exBegin] |
166 [exBegin] |
159 |s hook pageNr| |
167 |s hook pageNr| |
160 |
168 |
161 s := Printer new. |
169 s := Printer new. |
162 |
170 |
163 pageNr := 0. |
171 pageNr := 0. |
164 hook := [ |
172 hook := [ |
165 |
173 |
166 pageNr := pageNr + 1. |
174 pageNr := pageNr + 1. |
167 s placeString:('page ' , pageNr printString) at:(5500 @ 400). |
175 s placeString:('page ' , pageNr printString) at:(5500 @ 400). |
168 s placeString:('Document revision:') at:(900 @ 1200). |
176 s placeString:('Document revision:') at:(900 @ 1200). |
169 s placeString:('Revieved by:') at:(900 @ 900). |
177 s placeString:('Revieved by:') at:(900 @ 900). |
170 |
178 |
171 s setNative:true. |
179 s setNative:true. |
172 s nextPutAll:'0 setlinewidth'; cr. |
180 s nextPutAll:'0 setlinewidth'; cr. |
173 s nextPutAll:'800 800 moveto'; cr. |
181 s nextPutAll:'800 800 moveto'; cr. |
174 s nextPutAll:'11000 800 lineto'; cr. |
182 s nextPutAll:'11000 800 lineto'; cr. |
175 s nextPutAll:'11000 15500 lineto'; cr. |
183 s nextPutAll:'11000 15500 lineto'; cr. |
176 s nextPutAll:'800 15500 lineto'; cr. |
184 s nextPutAll:'800 15500 lineto'; cr. |
177 s nextPutAll:'800 800 lineto'; cr. |
185 s nextPutAll:'800 800 lineto'; cr. |
178 s nextPutAll:'stroke'; cr. |
186 s nextPutAll:'stroke'; cr. |
179 |
187 |
180 s nextPutAll:'800 1100 moveto'; cr. |
188 s nextPutAll:'800 1100 moveto'; cr. |
181 s nextPutAll:'11000 1100 lineto'; cr. |
189 s nextPutAll:'11000 1100 lineto'; cr. |
182 s nextPutAll:'stroke'; cr. |
190 s nextPutAll:'stroke'; cr. |
183 |
191 |
184 s nextPutAll:'800 1400 moveto'; cr. |
192 s nextPutAll:'800 1400 moveto'; cr. |
185 s nextPutAll:'11000 1400 lineto'; cr. |
193 s nextPutAll:'11000 1400 lineto'; cr. |
186 s nextPutAll:'stroke'; cr. |
194 s nextPutAll:'stroke'; cr. |
187 |
195 |
188 s setNative:false. |
196 s setNative:false. |
189 ]. |
197 ]. |
190 |
198 |
191 s pageEndAction:hook. |
199 s pageEndAction:hook. |
192 (1 to:200) do:[:lineNr | |
200 (1 to:200) do:[:lineNr | |
193 s nextPutAll:'line ' , lineNr printString. |
201 s nextPutAll:'line ' , lineNr printString. |
194 s cr. |
202 s cr. |
195 ]. |
203 ]. |
196 s close. |
204 s close. |
197 [exEnd] |
205 [exEnd] |
198 |
206 |
199 |
207 |
200 If you already have a postscript string at hand, this can be sent to |
208 If you already have a postscript string at hand, this can be sent to |
201 the printer in native mode: |
209 the printer in native mode: |
202 [exBegin] |
210 [exBegin] |
203 |s| |
211 |s| |
204 |
212 |
205 s := Printer newNative. |
213 s := Printer newNative. |
206 s nextPutAll:<your postscript string>. |
214 s nextPutAll:<your postscript string>. |
207 [exEnd] |
215 [exEnd] |
208 s close |
216 s close |
209 |
217 |
210 To output graphics, you need the PSGraphicsContext (and friend-) classes. |
218 To output graphics, you need the PSGraphicsContext (and friend-) classes. |
211 These provide protocol similar to the one provided by display graphicContexts. |
219 These provide protocol similar to the one provided by display graphicContexts. |
212 Notice, that these postscript classes are derived from public domain code; |
220 Notice, that these postscript classes are derived from public domain code; |
213 there is no warranty. |
221 there is no warranty. |
214 |
222 |
215 Usage: |
223 Usage: |
216 [exBegin] |
224 [exBegin] |
217 |drawable s| |
225 |drawable s| |
218 |
226 |
219 s := Printer newNative. |
227 s := Printer newNative. |
220 drawable := PSGraphicsContext on:s. |
228 drawable := PSGraphicsContext on:s. |
221 |
229 |
222 drawable displayLineFrom:(0@0) to:(100@100). |
230 drawable displayLineFrom:(0@0) to:(100@100). |
223 drawable displayLineFrom:(100@0) to:(0@100). |
231 drawable displayLineFrom:(100@0) to:(0@100). |
224 drawable displayCircle:(150@150) radius:50. |
232 drawable displayCircle:(150@150) radius:50. |
225 (Image fromFile:'bitmaps/SBrowser.xbm') displayOn:drawable at:(50@30). |
233 (Image fromFile:'bitmaps/SBrowser.xbm') displayOn:drawable at:(50@30). |
226 |
234 |
227 drawable close. |
235 drawable close. |
228 [exEnd] |
236 [exEnd] |
229 |
237 |
230 the same in a view: |
238 the same in a view: |
231 [exBegin] |
239 [exBegin] |
232 |drawable| |
240 |drawable| |
233 |
241 |
234 drawable := (View extent:200@200) openAndWait. |
242 drawable := (View extent:200@200) openAndWait. |
235 |
243 |
236 drawable displayLineFrom:(0@0) to:(100@100). |
244 drawable displayLineFrom:(0@0) to:(100@100). |
237 drawable displayLineFrom:(100@0) to:(0@100). |
245 drawable displayLineFrom:(100@0) to:(0@100). |
238 drawable displayCircle:(150@150) radius:50. |
246 drawable displayCircle:(150@150) radius:50. |
239 (Image fromFile:'bitmaps/SBrowser.xbm') displayOn:drawable at:(50@30). |
247 (Image fromFile:'bitmaps/SBrowser.xbm') displayOn:drawable at:(50@30). |
240 [exEnd] |
248 [exEnd] |
241 " |
249 " |
242 ! ! |
250 ! ! |
243 |
251 |
244 !PostscriptPrinterStream class methodsFor:'initialization'! |
252 !PostscriptPrinterStream class methodsFor:'initialization'! |
245 |
253 |
266 Helvetica := 0. "/ # of helvetica base font |
274 Helvetica := 0. "/ # of helvetica base font |
267 Times := 4. "/ # of times base font |
275 Times := 4. "/ # of times base font |
268 Courier := 8. "/ # of courier base font |
276 Courier := 8. "/ # of courier base font |
269 |
277 |
270 FontNames := #( |
278 FontNames := #( |
271 '/Helvetica-Oblique' |
279 '/Helvetica-Oblique' |
272 '/Helvetica-Bold' |
280 '/Helvetica-Bold' |
273 '/Helvetica-BoldOblique' |
281 '/Helvetica-BoldOblique' |
274 '/Helvetica' |
282 '/Helvetica' |
275 '/Times-Italic' |
283 '/Times-Italic' |
276 '/Times-Bold' |
284 '/Times-Bold' |
277 '/Times-BoldItalic' |
285 '/Times-BoldItalic' |
278 '/Times' |
286 '/Times' |
279 '/Courier-Oblique' |
287 '/Courier-Oblique' |
280 '/Courier-Bold' |
288 '/Courier-Bold' |
281 '/Courier-BoldOblique' |
289 '/Courier-BoldOblique' |
282 '/Courier' |
290 '/Courier' |
283 ) |
291 ) |
284 |
292 |
285 "Modified: 18.5.1996 / 09:37:48 / cg" |
293 "Modified: 18.5.1996 / 09:37:48 / cg" |
286 ! |
294 ! |
287 |
295 |
288 initPage |
296 initPage |
289 "setup the page parameters. |
297 "setup the page parameters. |
290 All coordinates are scaled by 20 w.r.t the PS coordinates (i.e. in twips)." |
298 All coordinates are scaled by 20 w.r.t the PS coordinates (i.e. in twips)." |
291 |
299 |
292 PageFormat isNil ifTrue:[ |
300 PageFormat isNil ifTrue:[ |
293 PageFormat := #letter |
301 PageFormat := #letter |
294 ]. |
302 ]. |
295 |
303 |
296 TopInset isNil ifTrue:[ |
304 TopInset isNil ifTrue:[ |
297 TopInset := 0.6. "/ inches |
305 TopInset := 0.6. "/ inches |
298 ]. |
306 ]. |
299 BottomInset isNil ifTrue:[ |
307 BottomInset isNil ifTrue:[ |
300 BottomInset := 1.2 "/ inches |
308 BottomInset := 1.2 "/ inches |
301 ]. |
309 ]. |
302 LeftInset isNil ifTrue:[ |
310 LeftInset isNil ifTrue:[ |
303 LeftInset := 0.6. "/ inches |
311 LeftInset := 0.6. "/ inches |
304 ]. |
312 ]. |
305 |
313 |
306 "/ +-----------------------------------------------+ PageHeight |
314 "/ +-----------------------------------------------+ PageHeight |
307 "/ | | |
315 "/ | | |
308 "/ | LeftX +---------------------------------------| TopY |
316 "/ | LeftX +---------------------------------------| TopY |
594 colNr := 0. |
602 colNr := 0. |
595 yPos := yPos - FontHeight. |
603 yPos := yPos - FontHeight. |
596 |
604 |
597 lineNr := lineNr + 1. |
605 lineNr := lineNr + 1. |
598 lineNr > LinesPerPage ifTrue:[ |
606 lineNr > LinesPerPage ifTrue:[ |
599 self nextPage |
607 self nextPage |
600 ] |
608 ] |
601 |
609 |
602 "Modified: 1.6.1996 / 13:09:30 / cg" |
610 "Modified: 1.6.1996 / 13:09:30 / cg" |
603 ! |
611 ! |
604 |
612 |
605 nextPut:aCharacter |
613 nextPut:aCharacter |
606 |code| |
614 |code| |
607 |
615 |
608 (aCharacter == Character cr) ifTrue:[ |
616 (aCharacter == Character cr) ifTrue:[ |
609 ^ self cr |
617 ^ self cr |
610 ]. |
618 ]. |
611 |
619 |
612 native == true ifTrue:[ |
620 native == true ifTrue:[ |
613 self flushLine. |
621 self flushLine. |
614 ^ super nextPut:aCharacter |
622 ^ super nextPut:aCharacter |
615 ]. |
623 ]. |
616 |
624 |
617 (aCharacter == $( ) ifTrue:[ |
625 (aCharacter == $( ) ifTrue:[ |
618 lineBuffer := lineBuffer , '\(' . |
626 lineBuffer := lineBuffer , '\(' . |
619 ^ self |
627 ^ self |
620 ]. |
628 ]. |
621 (aCharacter == $) ) ifTrue:[ |
629 (aCharacter == $) ) ifTrue:[ |
622 lineBuffer := lineBuffer , '\)' . |
630 lineBuffer := lineBuffer , '\)' . |
623 ^ self |
631 ^ self |
624 ]. |
632 ]. |
625 (aCharacter == $\ ) ifTrue:[ |
633 (aCharacter == $\ ) ifTrue:[ |
626 lineBuffer := lineBuffer , '\\' . |
634 lineBuffer := lineBuffer , '\\' . |
627 ^ self |
635 ^ self |
628 ]. |
636 ]. |
629 |
637 |
630 (aCharacter == Character tab ) ifTrue:[ |
638 (aCharacter == Character tab ) ifTrue:[ |
631 self flushLine. |
639 self flushLine. |
632 colNr := ((colNr + 8) // 8) * 8. |
640 colNr := ((colNr + 8) // 8) * 8. |
633 xPos := LeftX + (colNr * FontWidth). |
641 xPos := LeftX + (colNr * FontWidth). |
634 ^ self |
642 ^ self |
635 ]. |
643 ]. |
636 |
644 |
637 (code := aCharacter asciiValue) > 16r7F ifTrue:[ |
645 (code := aCharacter asciiValue) > 16r7F ifTrue:[ |
638 lineBuffer := lineBuffer , '\' , (code printStringRadix:8) |
646 lineBuffer := lineBuffer , '\' , (code printStringRadix:8) |
639 ] ifFalse:[ |
647 ] ifFalse:[ |
640 lineBuffer := lineBuffer copyWith:aCharacter |
648 lineBuffer := lineBuffer copyWith:aCharacter |
641 ]. |
649 ]. |
642 |
650 |
643 "Modified: 23.4.1996 / 20:05:59 / cg" |
651 "Modified: 23.4.1996 / 20:05:59 / cg" |
644 ! ! |
652 ! ! |
645 |
653 |
667 !PostscriptPrinterStream methodsFor:'emphasis change'! |
675 !PostscriptPrinterStream methodsFor:'emphasis change'! |
668 |
676 |
669 bold |
677 bold |
670 "further printing is in bold" |
678 "further printing is in bold" |
671 |
679 |
672 (fStyle ~~ Bold |
680 (fStyle ~~ Bold) ifTrue:[ |
673 or:[fUnderline ~~ false]) ifTrue:[ |
681 self flushLine. |
674 self flushLine. |
682 fStyle := Bold. |
675 fStyle := Bold. |
683 self setFont. |
676 self setFont. |
684 ]. |
677 fUnderline := false. |
685 |
678 ]. |
686 "Modified: 8.6.1996 / 08:17:15 / cg" |
679 |
|
680 "Modified: 3.6.1996 / 17:08:45 / cg" |
|
681 ! |
687 ! |
682 |
688 |
683 boldItalic |
689 boldItalic |
684 "further printing is in boldItalic" |
690 "further printing is in boldItalic" |
685 |
691 |
686 (fStyle ~~ BoldItalic |
692 (fStyle ~~ BoldItalic) ifTrue:[ |
687 or:[fUnderline ~~ false]) ifTrue:[ |
693 self flushLine. |
688 self flushLine. |
694 fStyle := BoldItalic. |
689 fStyle := BoldItalic. |
695 self setFont. |
690 self setFont. |
|
691 fUnderline := false. |
|
692 ]. |
696 ]. |
693 |
697 |
694 "Created: 18.5.1996 / 09:36:36 / cg" |
698 "Created: 18.5.1996 / 09:36:36 / cg" |
695 "Modified: 3.6.1996 / 17:08:27 / cg" |
699 "Modified: 8.6.1996 / 08:17:21 / cg" |
696 ! |
700 ! |
697 |
701 |
698 italic |
702 italic |
699 "further printing is in italic" |
703 "further printing is in italic" |
700 |
704 |
701 (fStyle ~~ Italic |
705 (fStyle ~~ Italic) ifTrue:[ |
702 or:[fUnderline ~~ false]) ifTrue:[ |
706 self flushLine. |
703 self flushLine. |
707 fStyle := Italic. |
704 fStyle := Italic. |
708 self setFont. |
705 self setFont. |
709 ]. |
706 fUnderline := false. |
710 |
707 ]. |
711 "Modified: 8.6.1996 / 08:17:28 / cg" |
708 |
712 ! |
709 "Modified: 3.6.1996 / 17:08:16 / cg" |
713 |
|
714 noUnderline |
|
715 "further printing is not underlined" |
|
716 |
|
717 underline ifTrue:[ |
|
718 self flushLine. |
|
719 underline := false |
|
720 ] |
|
721 |
|
722 "Created: 8.6.1996 / 08:11:07 / cg" |
|
723 "Modified: 8.6.1996 / 08:15:56 / cg" |
|
724 ! |
|
725 |
|
726 noStrikeout |
|
727 "further printing is not strikedout" |
|
728 |
|
729 strikeout ifTrue:[ |
|
730 self flushLine. |
|
731 strikeout := false |
|
732 ] |
|
733 |
|
734 "Modified: 8.6.1996 / 08:15:56 / cg" |
|
735 "Created: 8.6.1996 / 08:16:35 / cg" |
710 ! |
736 ! |
711 |
737 |
712 normal |
738 normal |
713 "further printing is in normal style (i.e. non-bold/non-italic)" |
739 "further printing is in normal style (i.e. non-bold/non-italic)" |
714 |
740 |
715 (fStyle ~~ Normal |
741 (fStyle ~~ Normal) ifTrue:[ |
716 or:[fUnderline ~~ false]) ifTrue:[ |
742 self flushLine. |
717 self flushLine. |
743 fStyle := Normal. |
718 fStyle := Normal. |
744 self setFont. |
719 self setFont. |
745 ]. |
720 fUnderline := false. |
746 |
721 ]. |
747 "Modified: 8.6.1996 / 08:17:34 / cg" |
722 |
748 ! |
723 "Modified: 3.6.1996 / 17:07:56 / cg" |
749 |
|
750 strikeout |
|
751 "further printing is strikedout" |
|
752 |
|
753 strikeout ifFalse:[ |
|
754 self flushLine. |
|
755 strikeout := true |
|
756 ] |
|
757 |
|
758 "Modified: 8.6.1996 / 08:10:49 / cg" |
|
759 "Created: 8.6.1996 / 08:16:18 / cg" |
724 ! |
760 ! |
725 |
761 |
726 underline |
762 underline |
727 "further printing is underlined" |
763 "further printing is underlined" |
728 |
764 |
729 self normal. |
765 underline ifFalse:[ |
730 fUnderline := true |
766 self flushLine. |
731 |
767 underline := true |
732 "Modified: 3.6.1996 / 17:07:25 / cg" |
768 ] |
|
769 |
|
770 "Modified: 8.6.1996 / 08:16:05 / cg" |
733 ! ! |
771 ! ! |
734 |
772 |
735 !PostscriptPrinterStream methodsFor:'font change'! |
773 !PostscriptPrinterStream methodsFor:'font change'! |
736 |
774 |
737 courier |
775 courier |
783 "start a document - send documentProlog & start a page. |
821 "start a document - send documentProlog & start a page. |
784 Send nothing if nativePrinting." |
822 Send nothing if nativePrinting." |
785 |
823 |
786 fFamily := Courier. |
824 fFamily := Courier. |
787 fStyle := Normal. |
825 fStyle := Normal. |
788 fUnderline := false. |
826 underline := false. |
|
827 strikeout := false. |
789 |
828 |
790 native == true ifFalse:[ |
829 native == true ifFalse:[ |
791 Prolog isNil ifTrue:[ |
830 Prolog isNil ifTrue:[ |
792 self class initialize |
831 self class initialize |
793 ]. |
832 ]. |
794 super writingTo:(self class printCommand). |
833 super writingTo:(self class printCommand). |
795 super nextPutAllUntranslated:Prolog. |
834 super nextPutAllUntranslated:Prolog. |
796 self startPage |
835 self startPage |
797 ] |
836 ] |
798 |
837 |
799 "Modified: 3.6.1996 / 17:03:11 / cg" |
838 "Modified: 8.6.1996 / 08:16:50 / cg" |
800 ! ! |
839 ! ! |
801 |
840 |
802 !PostscriptPrinterStream methodsFor:'private'! |
841 !PostscriptPrinterStream methodsFor:'private'! |
803 |
842 |
804 endPage |
843 endPage |
805 "end a page - flush buffered text & send pageTrailer" |
844 "end a page - flush buffered text & send pageTrailer" |
806 |
845 |
807 self flushLine. |
846 self flushLine. |
808 pageEndAction notNil ifTrue:[ |
847 pageEndAction notNil ifTrue:[ |
809 pageEndAction value |
848 pageEndAction value |
810 ]. |
849 ]. |
811 super nextPutAllUntranslated:PageTrailer |
850 super nextPutAllUntranslated:PageTrailer |
812 |
851 |
813 "Modified: 23.4.1996 / 20:00:01 / cg" |
852 "Modified: 23.4.1996 / 20:00:01 / cg" |
814 ! |
853 ! |
815 |
854 |
816 flushLine |
855 flushLine |
817 "flush buffered line text" |
856 "flush buffered line text" |
818 |
857 |
819 (lineBuffer size > 0) ifTrue:[ |
858 (lineBuffer size > 0) ifTrue:[ |
820 super nextPutAllUntranslated:(xPos printString ). |
859 colNr == 0 ifTrue:[ |
821 super nextPutAllUntranslated:' '. |
860 super nextPutAllUntranslated:(xPos printString ). |
822 super nextPutAllUntranslated:(yPos printString). |
861 super nextPutAllUntranslated:' '. |
823 super nextPutAllUntranslated:'('. |
862 super nextPutAllUntranslated:(yPos printString). |
824 super nextPutAllUntranslated:lineBuffer. |
863 ]. |
825 super nextPutAllUntranslated:')B'. |
864 super nextPutAllUntranslated:'('. |
826 fUnderline == true ifTrue:[ |
865 super nextPutAllUntranslated:lineBuffer. |
827 super nextPutAllUntranslated:'UL'. |
866 super nextPutAllUntranslated:')B'. |
828 ]. |
867 underline == true ifTrue:[ |
829 super nextPutUntranslated:(Character cr). |
868 super nextPutAllUntranslated:'UL'. |
830 xPos := xPos + (FontWidth * lineBuffer size). |
869 ]. |
831 colNr := colNr + lineBuffer size |
870 super nextPutUntranslated:(Character cr). |
|
871 xPos := xPos + (FontWidth * lineBuffer size). |
|
872 colNr := colNr + lineBuffer size |
832 ]. |
873 ]. |
833 lineBuffer := '' |
874 lineBuffer := '' |
834 |
875 |
835 "Modified: 3.6.1996 / 17:04:18 / cg" |
876 "Modified: 3.6.1996 / 17:04:18 / cg" |
836 ! |
877 ! |