author | Stefan Vogel <sv@exept.de> |
Fri, 05 Mar 2004 20:04:52 +0100 | |
changeset 1416 | 6b6269a08973 |
parent 1317 | 890b41076c7c |
child 1437 | e8f0a47618dc |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
71 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
13 |
"{ Package: 'stx:libbasic2' }" |
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
14 |
|
0 | 15 |
PrinterStream subclass:#PostscriptPrinterStream |
1075 | 16 |
instanceVariableNames:'xPos yPos lineStream colNr lineNr fFamily fStyle pageStartAction |
17 |
pageEndAction pageCount sendXPosition' |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
18 |
classVariableNames:'Prolog Trailer PageProlog PageTrailer FontNames FontHeight |
378 | 19 |
FontWidth LeftX TopY PageHeight LinesPerPage PhysicalPageHeight |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
20 |
Italic Bold Normal BoldItalic Courier Times Helvetica TopMargin |
437 | 21 |
LeftMargin BottomMargin RightMargin SupportsColor Resolution' |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
22 |
poolDictionaries:'' |
1317 | 23 |
category:'Streams-External-Printing' |
0 | 24 |
! |
25 |
||
467 | 26 |
!PostscriptPrinterStream class methodsFor:'documentation'! |
6 | 27 |
|
31 | 28 |
copyright |
29 |
" |
|
30 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
71 | 31 |
All Rights Reserved |
31 | 32 |
|
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
! |
|
41 |
||
6 | 42 |
documentation |
43 |
" |
|
28 | 44 |
This class provides simple text output to postscript printers; |
31 | 45 |
to use it, evaluate |
1297 | 46 |
Smalltalk at:#Printer put:PostscriptPrinterStream |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
47 |
(usually in some rc file). |
361 | 48 |
or change it via the launchers settings-menu. |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
49 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
50 |
See examples on how to send something to the printer. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
51 |
|
1297 | 52 |
For now, only Helvetica, Courier and Times fonts in italic, roman and bold are supported. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
53 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
54 |
It does not directly support graphics and other fancy features of Postscript, |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
55 |
but provides a compatible interface for simple text line-printing |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
56 |
(see other subclasses of PrinterStream). |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
57 |
|
1297 | 58 |
If you already have a postscript string at hand, this can be sent to the printer in native mode. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
59 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
60 |
To output graphics, you need the PSGraphicsContext (and friend-) classes. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
61 |
These provide protocol similar to the one provided by display graphicContexts. |
1297 | 62 |
PSGraphicsContext generates its own postscript - not caring for the margin/font settings |
63 |
here (these are only used if the printer-stream protocol is used (i.e. nextPut, cr etc.) |
|
64 |
||
65 |
Notice, that these postscript classes are derived from public domain code; there is no warranty. |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
66 |
|
1297 | 67 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
68 |
[see also:] |
1297 | 69 |
PSGraphicsContext |
70 |
EpsonFX1PrinterStream HPLjetIIPrinterStream PrinterStream |
|
259 | 71 |
|
72 |
[author:] |
|
1297 | 73 |
Claus Gittinger |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
74 |
" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
75 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
76 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
77 |
examples |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
78 |
" |
223 | 79 |
For text printing, use: |
391 | 80 |
[exBegin] |
81 |
|s| |
|
223 | 82 |
|
391 | 83 |
s := Printer new. |
84 |
s nextPutAll:'hello'; cr. |
|
85 |
s nextPutAll:'normal '. |
|
86 |
s bold; nextPutAll:'this is bold'; normal; cr. |
|
87 |
s nextPutAll:'normal '. |
|
88 |
s italic; nextPutAll:'this is italic'; normal; cr. |
|
89 |
s nextPutAll:'normal '. |
|
90 |
s boldItalic; nextPutAll:'this is boldItalic'; normal; cr. |
|
91 |
s nextPutAll:'normal '. |
|
92 |
s underline; nextPutAll:'this is underlined'; noUnderline; cr. |
|
93 |
s nextPutAll:'normal again '. |
|
94 |
s strikeout; nextPutAll:'this is strikedout'; noStrikeout; cr. |
|
95 |
s helvetica. |
|
96 |
s nextPutAll:'helvetica '. |
|
97 |
s underline; nextPutAll:' helv-underline'; noUnderline; |
|
98 |
space; strikeout; nextPutAll:'helv-strikeout'; noStrikeout; |
|
99 |
bold; nextPutAll:' helv-bold'; normal; cr. |
|
100 |
s times. |
|
101 |
s nextPutAll:'times'; cr. |
|
102 |
s courier. |
|
103 |
s nextPutAll:'courier'; cr. |
|
104 |
s close |
|
105 |
[exEnd] |
|
349 | 106 |
or, if you already have emphasized text at hand: |
391 | 107 |
[exBegin] |
108 |
|s| |
|
349 | 109 |
|
391 | 110 |
s := Printer new. |
111 |
s nextPutAll:'hello'; cr. |
|
112 |
s nextPutAll:'this is '; |
|
113 |
nextPutAll:(Text string:'bold' emphasis:#bold); |
|
114 |
cr; |
|
115 |
nextPutAll:'this is '; |
|
116 |
nextPutAll:(Text string:'italic' emphasis:#italic); |
|
117 |
cr; |
|
118 |
nextPutAll:'this is '; |
|
119 |
nextPutAll:(Text string:'boldItalic' emphasis:#(bold italic)); |
|
120 |
cr; |
|
121 |
nextPutAll:'normal again'; |
|
122 |
cr; |
|
123 |
helvetica; |
|
124 |
nextPutAll:'helvetica'; |
|
125 |
cr; |
|
126 |
times; |
|
127 |
nextPutAll:'times'; |
|
128 |
cr; |
|
129 |
courier; |
|
130 |
nextPutAll:'courier'; |
|
131 |
cr. |
|
132 |
s close |
|
133 |
[exEnd] |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
134 |
|
361 | 135 |
placing a page-hook, to add a page number: |
136 |
(page hooks require that you understand some postscript ... |
|
137 |
... and have a look at how this class generates its postscript code) |
|
391 | 138 |
[exBegin] |
139 |
|s hook pageNr| |
|
361 | 140 |
|
391 | 141 |
s := Printer new. |
361 | 142 |
|
391 | 143 |
pageNr := 0. |
144 |
hook := [ |
|
361 | 145 |
|
391 | 146 |
pageNr := pageNr + 1. |
147 |
s placeString:('page ' , pageNr printString) at:(5500 @ 400). |
|
148 |
]. |
|
361 | 149 |
|
391 | 150 |
s pageEndAction:hook. |
151 |
(1 to:200) do:[:lineNr | |
|
152 |
s nextPutAll:'line ' , lineNr printString. |
|
153 |
s cr. |
|
154 |
]. |
|
155 |
s close. |
|
156 |
[exEnd] |
|
361 | 157 |
|
158 |
||
159 |
placing a page-hook, to add a custom frame, logo or company letter-head: |
|
160 |
(page hooks require that you understand some postscript ... |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
161 |
... and have a look at how this class generates its postscript code. |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
162 |
... and notice that the code below is a q&d demo, working with letter-sized |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
163 |
pages only; a real program should ask the printerStream about the actual |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
164 |
pageHeight/pageWidth.) |
391 | 165 |
[exBegin] |
166 |
|s hook pageNr| |
|
361 | 167 |
|
391 | 168 |
s := Printer new. |
361 | 169 |
|
391 | 170 |
pageNr := 0. |
171 |
hook := [ |
|
361 | 172 |
|
391 | 173 |
pageNr := pageNr + 1. |
174 |
s placeString:('page ' , pageNr printString) at:(5500 @ 400). |
|
175 |
s placeString:('Document revision:') at:(900 @ 1200). |
|
176 |
s placeString:('Revieved by:') at:(900 @ 900). |
|
361 | 177 |
|
391 | 178 |
s setNative:true. |
179 |
s nextPutAll:'0 setlinewidth'; cr. |
|
180 |
s nextPutAll:'800 800 moveto'; cr. |
|
181 |
s nextPutAll:'11000 800 lineto'; cr. |
|
182 |
s nextPutAll:'11000 15500 lineto'; cr. |
|
183 |
s nextPutAll:'800 15500 lineto'; cr. |
|
184 |
s nextPutAll:'800 800 lineto'; cr. |
|
185 |
s nextPutAll:'stroke'; cr. |
|
361 | 186 |
|
391 | 187 |
s nextPutAll:'800 1100 moveto'; cr. |
188 |
s nextPutAll:'11000 1100 lineto'; cr. |
|
189 |
s nextPutAll:'stroke'; cr. |
|
361 | 190 |
|
391 | 191 |
s nextPutAll:'800 1400 moveto'; cr. |
192 |
s nextPutAll:'11000 1400 lineto'; cr. |
|
193 |
s nextPutAll:'stroke'; cr. |
|
361 | 194 |
|
391 | 195 |
s setNative:false. |
196 |
]. |
|
361 | 197 |
|
391 | 198 |
s pageEndAction:hook. |
199 |
(1 to:200) do:[:lineNr | |
|
200 |
s nextPutAll:'line ' , lineNr printString. |
|
201 |
s cr. |
|
202 |
]. |
|
203 |
s close. |
|
204 |
[exEnd] |
|
361 | 205 |
|
206 |
||
223 | 207 |
If you already have a postscript string at hand, this can be sent to |
208 |
the printer in native mode: |
|
391 | 209 |
[exBegin] |
210 |
|s| |
|
223 | 211 |
|
391 | 212 |
s := Printer newNative. |
213 |
s nextPutAll:<your postscript string>. |
|
214 |
[exEnd] |
|
215 |
s close |
|
223 | 216 |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
217 |
To output graphics, you need the PSGraphicsContext (and friend-) classes. |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
218 |
These provide protocol similar to the one provided by display graphicContexts. |
223 | 219 |
Notice, that these postscript classes are derived from public domain code; |
220 |
there is no warranty. |
|
221 |
||
222 |
Usage: |
|
391 | 223 |
[exBegin] |
224 |
|drawable s| |
|
223 | 225 |
|
391 | 226 |
s := Printer newNative. |
227 |
drawable := PSGraphicsContext on:s. |
|
223 | 228 |
|
391 | 229 |
drawable displayLineFrom:(0@0) to:(100@100). |
230 |
drawable displayLineFrom:(100@0) to:(0@100). |
|
231 |
drawable displayCircle:(150@150) radius:50. |
|
232 |
(Image fromFile:'bitmaps/SBrowser.xbm') displayOn:drawable at:(50@30). |
|
223 | 233 |
|
391 | 234 |
drawable close. |
235 |
[exEnd] |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
236 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
237 |
the same in a view: |
391 | 238 |
[exBegin] |
239 |
|drawable| |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
240 |
|
391 | 241 |
drawable := (View extent:200@200) openAndWait. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
242 |
|
391 | 243 |
drawable displayLineFrom:(0@0) to:(100@100). |
244 |
drawable displayLineFrom:(100@0) to:(0@100). |
|
245 |
drawable displayCircle:(150@150) radius:50. |
|
246 |
(Image fromFile:'bitmaps/SBrowser.xbm') displayOn:drawable at:(50@30). |
|
247 |
[exEnd] |
|
6 | 248 |
" |
249 |
! ! |
|
0 | 250 |
|
467 | 251 |
!PostscriptPrinterStream class methodsFor:'initialization'! |
0 | 252 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
253 |
initCharacterSize |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
254 |
"setup the character parameters" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
255 |
|
361 | 256 |
FontHeight := 200. "/ used to scale fonts - corresponds to a 10 point font size |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
257 |
FontWidth := 120. "/ used to compute width of tabs |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
258 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
259 |
"Created: 23.4.1996 / 19:53:34 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
260 |
"Modified: 23.4.1996 / 20:05:17 / cg" |
361 | 261 |
"Modified: 30.5.1996 / 17:24:05 / ca" |
0 | 262 |
! |
263 |
||
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
264 |
initFonts |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
265 |
"setup the font names. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
266 |
initProlog uses those parameters." |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
267 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
268 |
Italic := 0. "/ offset from base-font# to italic version |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
269 |
Bold := 1. "/ offset from base-font# to bold version |
349 | 270 |
BoldItalic := 2. "/ offset from base-font# to boldItalic version |
271 |
Normal := 3. "/ offset from base-font# to normal version |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
272 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
273 |
Helvetica := 0. "/ # of helvetica base font |
349 | 274 |
Times := 4. "/ # of times base font |
275 |
Courier := 8. "/ # of courier base font |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
276 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
277 |
FontNames := #( |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
278 |
'Helvetica-Oblique' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
279 |
'Helvetica-Bold' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
280 |
'Helvetica-BoldOblique' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
281 |
'Helvetica' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
282 |
'Times-Italic' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
283 |
'Times-Bold' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
284 |
'Times-BoldItalic' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
285 |
'Times' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
286 |
'Courier-Oblique' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
287 |
'Courier-Bold' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
288 |
'Courier-BoldOblique' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
289 |
'Courier' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
290 |
) |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
291 |
|
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
292 |
" |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
293 |
PostscriptPrinterStream initFonts |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
294 |
" |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
295 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
296 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
297 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
298 |
initPage |
361 | 299 |
"setup the page parameters. |
370 | 300 |
All coordinates are scaled by 20 w.r.t the PS coordinates (i.e. in twips)." |
301 |
||
302 |
PageFormat isNil ifTrue:[ |
|
1108
e5be3dd73130
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
303 |
PageFormat := #a4 |
370 | 304 |
]. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
305 |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
306 |
TopMargin isNil ifTrue:[ |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
307 |
TopMargin := 0.6. "/ inches |
370 | 308 |
]. |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
309 |
BottomMargin isNil ifTrue:[ |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
310 |
BottomMargin := 1.2 "/ inches |
370 | 311 |
]. |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
312 |
LeftMargin isNil ifTrue:[ |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
313 |
LeftMargin := 0.6. "/ inches |
370 | 314 |
]. |
437 | 315 |
RightMargin isNil ifTrue:[ |
316 |
RightMargin := 0.6. "/ inches |
|
317 |
]. |
|
318 |
Resolution isNil ifTrue:[ |
|
319 |
Resolution := 300@300. "/ DPI |
|
320 |
]. |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
321 |
|
361 | 322 |
"/ +-----------------------------------------------+ PageHeight |
437 | 323 |
"/ | TOPMARGIN | | |
361 | 324 |
"/ | LeftX +---------------------------------------| TopY |
437 | 325 |
"/ | |1st printed line | | |
326 |
"/ | | | | |
|
327 |
"/ | LEFT | |RIGHT| (only used by |
|
328 |
"/ | MARGIN| |MARG.| PSGraphicsContext) |
|
329 |
"/ | | | | |
|
330 |
"/ | |last line (linesPerPage) | | |
|
361 | 331 |
"/ | +---------------------------------------| |
437 | 332 |
"/ | BOTTOMMARGIN | | |
361 | 333 |
"/ (0/0)-------------------------------------------+ 0 |
334 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
335 |
LeftX := (UnitConverter convert:LeftMargin from:#inch to:#twip) rounded. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
336 |
|
370 | 337 |
PhysicalPageHeight := (UnitConverter convert:1 from:(PageFormat , 'H') to:#twip) rounded. |
447 | 338 |
Landscape == true ifTrue:[ |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
339 |
PageHeight := (UnitConverter convert:1 from:(PageFormat , 'lH') to:#twip) rounded. |
370 | 340 |
] ifFalse:[ |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
341 |
PageHeight := (UnitConverter convert:1 from:(PageFormat , 'H') to:#twip) rounded. |
370 | 342 |
]. |
343 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
344 |
TopY := PageHeight - (UnitConverter convert:TopMargin from:#inch to:#twip) rounded. |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
345 |
LinesPerPage := TopY - (UnitConverter convert:BottomMargin from:#inch to:#twip) rounded // 200. |
370 | 346 |
|
386 | 347 |
" |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
348 |
TopMargin := LeftMargin := BottomMargin := nil. |
386 | 349 |
self initPage |
350 |
" |
|
351 |
||
361 | 352 |
"Modified: 30.5.1996 / 17:24:55 / ca" |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
353 |
"Modified: 5.9.1996 / 21:43:00 / cg" |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
354 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
355 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
356 |
initPageProlog |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
357 |
"define the page prolog" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
358 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
359 |
PageProlog := |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
360 |
'StartPage |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
361 |
'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
362 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
363 |
"Created: 23.4.1996 / 19:56:16 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
364 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
365 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
366 |
initPageTrailer |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
367 |
"define the page epilog" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
368 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
369 |
PageTrailer := |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
370 |
'EndPage |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
371 |
'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
372 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
373 |
"Modified: 23.4.1996 / 19:55:50 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
374 |
"Created: 23.4.1996 / 19:56:30 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
375 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
376 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
377 |
initProlog |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
378 |
"define the documents prolog" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
379 |
|
0 | 380 |
|tmpString t fontNr| |
381 |
||
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
382 |
tmpString := |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
383 |
'%!!PS-Adobe-2.0 |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
384 |
%%Creator: Smalltalk/X |
438
c38453be27ae
put cleanup stuff after %%Trailer
Claus Gittinger <cg@exept.de>
parents:
437
diff
changeset
|
385 |
%%CreationDate: ' , AbsoluteTime now printString , ' |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
386 |
%%DocumentFonts: '. |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
387 |
|
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
388 |
FontNames do:[:aName | |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
389 |
tmpString := tmpString , aName , ' ' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
390 |
]. |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
391 |
|
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
392 |
tmpString := tmpString , ' |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
393 |
%%Pages: (atend) |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
394 |
%%EndComments |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
395 |
|
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
396 |
save /SmalltalkJob exch def |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
397 |
|
361 | 398 |
/OriginalState gstate def |
0 | 399 |
/StartSmalltalkDoc{$smalltalk begin}def |
400 |
/$smalltalk 50 dict def $smalltalk begin |
|
401 |
/EndSmalltalkDoc{end}def |
|
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
402 |
|
0 | 403 |
/S/show load def |
404 |
/X{exch 0 rmoveto S}def |
|
405 |
/Y{exch 0 exch rmoveto S}def |
|
406 |
/B{3 1 roll moveto S}def |
|
382 | 407 |
/SUL {gsave currentpoint currentfont /FontInfo get /UnderlinePosition get |
408 |
0 exch currentfont /FontMatrix get dtransform exch pop add newpath moveto |
|
409 |
dup stringwidth rlineto stroke grestore S} def |
|
391 | 410 |
/SSO {gsave currentpoint 300 |
411 |
0 exch currentfont /FontMatrix get dtransform exch pop add |
|
412 |
newpath moveto dup stringwidth rlineto stroke grestore S} def |
|
382 | 413 |
/BUL{3 1 roll moveto SUL}def |
391 | 414 |
/BSO{3 1 roll moveto SSO}def |
0 | 415 |
/F{$fd exch get setfont}def |
416 |
/StartPage{/svpg save def .05 dup scale}def |
|
417 |
/EndPage{svpg restore showpage}def |
|
418 |
/DoPreFeed{/statusdict where{pop |
|
419 |
statusdict/prefeed known{statusdict exch/prefeed exch put 0}if}if pop}def |
|
373 | 420 |
/Landscape{90 rotate 0 -' , PageHeight printString "15840", ' translate}def |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
421 |
/ISOrecode {findfont dup length dict begin |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
422 |
{1 index /FID ne {def} {pop pop} ifelse} forall |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
423 |
/Encoding ISOLatin1Encoding def |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
424 |
currentdict end definefont pop} def |
0 | 425 |
/SetUpFonts |
426 |
{dup/$fd exch array def{findfont exch scalefont $fd 3 1 roll put}repeat}def |
|
427 |
/InitGaudy{/TwoColumn exch def /BarLength exch def |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
428 |
/ftD /ISO-Times-Bold findfont 12 UP scalefont def |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
429 |
/ftF /ISO-Times-Roman findfont 14 UP scalefont def |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
430 |
/ftP /ISO-Helvetica-Bold findfont 30 UP scalefont def}def |
0 | 431 |
/U{1440 mul}def |
432 |
/UP{U 72 div}def |
|
433 |
/LB{/pts exch UP def /charcolor exch def /boxcolor exch def /font exch def |
|
434 |
/label exch def /dy exch def /dx exch def /lly exch def /llx exch def |
|
435 |
gsave boxcolor setgray |
|
436 |
llx lly moveto dx 0 rlineto 0 dy rlineto dx neg 0 rlineto closepath fill |
|
437 |
/lines label length def |
|
438 |
/yp lly dy add dy lines pts mul sub 2 div sub pts .85 mul sub def |
|
439 |
font setfont charcolor setgray |
|
440 |
label {dup stringwidth pop 2 div llx dx 2 div add exch sub yp moveto show |
|
441 |
/yp yp pts sub def}forall grestore}def |
|
442 |
/Gaudy{/Page exch def /Date exch def /File exch def /Comment exch def |
|
443 |
.25 U 10.2 U BarLength .1 sub U .25 U [File] ftF .97 0 14 LB |
|
444 |
.25 U 10.45 U BarLength .1 sub U .25 U [Comment] ftF 1 0 14 LB |
|
445 |
.25 U 10.2 U 1 U .5 U Date ftD .7 0 12 LB |
|
446 |
BarLength .75 sub U 10.2 U 1 U .5 U [Page] ftP .7 1 30 LB |
|
447 |
TwoColumn{BarLength 2 div .19 add U 10.2 U moveto 0 -10 U rlineto stroke}if |
|
448 |
}def |
|
449 |
end |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
450 |
StartSmalltalkDoc |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
451 |
% end of fixed prolog |
0 | 452 |
'. |
453 |
||
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
454 |
t := ''. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
455 |
FontNames do:[:aName | |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
456 |
t := t , '/ISO-' , aName , ' /' , aName , ' ISOrecode |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
457 |
'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
458 |
]. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
459 |
t := t , ' |
0 | 460 |
'. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
461 |
tmpString := tmpString , t. |
0 | 462 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
463 |
t := ''. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
464 |
fontNr := 0. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
465 |
FontNames do:[:aName | |
391 | 466 |
t := t , (fontNr printString) , ' ' |
467 |
, (FontHeight printString) , ' ' |
|
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
468 |
, '/ISO-' , aName , (Character nl) asString. |
391 | 469 |
fontNr := fontNr + 1 |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
470 |
]. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
471 |
tmpString := tmpString , t. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
472 |
tmpString := tmpString , fontNr printString , ' SetUpFonts |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
473 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
474 |
% end of prolog |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
475 |
%%EndProlog |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
476 |
'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
477 |
Prolog := tmpString. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
478 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
479 |
" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
480 |
PostscriptPrinterStream initProlog |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
481 |
" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
482 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
483 |
"Created: 23.4.1996 / 19:40:44 / cg" |
438
c38453be27ae
put cleanup stuff after %%Trailer
Claus Gittinger <cg@exept.de>
parents:
437
diff
changeset
|
484 |
"Modified: 7.9.1996 / 16:01:52 / cg" |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
485 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
486 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
487 |
initTrailer |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
488 |
"define the documents epilog" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
489 |
|
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
490 |
Trailer := |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
491 |
' |
438
c38453be27ae
put cleanup stuff after %%Trailer
Claus Gittinger <cg@exept.de>
parents:
437
diff
changeset
|
492 |
%%Trailer |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
493 |
EndSmalltalkDoc |
0 | 494 |
SmalltalkJob restore |
495 |
' |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
496 |
|
440 | 497 |
"Modified: 7.9.1996 / 16:27:49 / cg" |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
498 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
499 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
500 |
initialize |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
501 |
Normal isNil ifTrue:[ |
965
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
502 |
self initFonts. |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
503 |
self initPage. |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
504 |
self initCharacterSize. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
505 |
|
965
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
506 |
"/ self initProlog. - now done lazy |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
507 |
"/ self initTrailer. - now done lazy |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
508 |
|
965
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
509 |
self initPageProlog. |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
510 |
self initPageTrailer |
170 | 511 |
] |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
512 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
513 |
" |
349 | 514 |
Normal := nil. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
515 |
self initialize |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
516 |
" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
517 |
|
349 | 518 |
"Modified: 18.5.1996 / 09:46:15 / cg" |
370 | 519 |
! |
520 |
||
521 |
reInitPage |
|
522 |
self initPage. |
|
965
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
523 |
Prolog := nil. |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
524 |
"/ self initProlog. - now done lazy |
370 | 525 |
|
526 |
"Created: 31.5.1996 / 23:35:18 / cg" |
|
527 |
! ! |
|
528 |
||
1220 | 529 |
!PostscriptPrinterStream class methodsFor:'accessing-defaults'! |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
530 |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
531 |
bottomMargin |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
532 |
"return the bottom margin (in inches)" |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
533 |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
534 |
^ BottomMargin |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
535 |
|
378 | 536 |
"Modified: 3.6.1996 / 10:44:44 / cg" |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
537 |
"Created: 5.9.1996 / 21:42:08 / cg" |
378 | 538 |
! |
539 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
540 |
bottomMargin:inches |
378 | 541 |
"set the bottom margin (in inches)" |
542 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
543 |
BottomMargin := inches. |
378 | 544 |
self reInitPage. |
545 |
||
546 |
"Modified: 3.6.1996 / 10:47:16 / cg" |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
547 |
"Created: 5.9.1996 / 21:42:13 / cg" |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
548 |
! |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
549 |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
550 |
leftMargin |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
551 |
"return the left margin (in inches)" |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
552 |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
553 |
^ LeftMargin |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
554 |
|
378 | 555 |
"Modified: 3.6.1996 / 10:45:11 / cg" |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
556 |
"Created: 5.9.1996 / 21:42:16 / cg" |
378 | 557 |
! |
558 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
559 |
leftMargin:inches |
378 | 560 |
"set the left margin (in inches)" |
561 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
562 |
LeftMargin := inches. |
378 | 563 |
self reInitPage. |
564 |
||
565 |
"Created: 3.6.1996 / 10:46:33 / cg" |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
566 |
"Modified: 5.9.1996 / 21:42:19 / cg" |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
567 |
! |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
568 |
|
965
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
569 |
psProlog |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
570 |
Prolog isNil ifTrue:[ |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
571 |
self initProlog |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
572 |
]. |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
573 |
^ Prolog |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
574 |
! |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
575 |
|
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
576 |
psTrailer |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
577 |
Trailer isNil ifTrue:[ |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
578 |
self initTrailer |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
579 |
]. |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
580 |
^ Trailer |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
581 |
! |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
582 |
|
437 | 583 |
resolution |
584 |
"return the printers actual resolution (if known)" |
|
585 |
||
586 |
^ Resolution |
|
587 |
||
588 |
"Modified: 3.6.1996 / 10:45:17 / cg" |
|
589 |
"Created: 5.9.1996 / 21:41:49 / cg" |
|
590 |
! |
|
591 |
||
592 |
resolution:dpiValuePoint |
|
593 |
"set the printers actual resolution (if known)" |
|
594 |
||
595 |
Resolution := dpiValuePoint |
|
596 |
||
597 |
"Modified: 3.6.1996 / 10:45:17 / cg" |
|
598 |
"Created: 5.9.1996 / 21:41:49 / cg" |
|
599 |
! |
|
600 |
||
601 |
rightMargin |
|
602 |
"return the right margin (in inches)" |
|
603 |
||
604 |
^ RightMargin |
|
605 |
||
606 |
"Modified: 3.6.1996 / 10:45:11 / cg" |
|
607 |
"Created: 5.9.1996 / 21:42:16 / cg" |
|
608 |
! |
|
609 |
||
610 |
rightMargin:inches |
|
611 |
"set the right margin (in inches)" |
|
612 |
||
613 |
RightMargin := inches. |
|
614 |
self reInitPage. |
|
615 |
! |
|
616 |
||
431 | 617 |
supportsColor |
618 |
SupportsColor notNil ifTrue:[^ SupportsColor]. |
|
619 |
^ false |
|
620 |
! |
|
621 |
||
622 |
supportsColor:aBoolean |
|
623 |
SupportsColor := aBoolean. |
|
624 |
! |
|
625 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
626 |
topMargin |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
627 |
"return the top margin (in inches)" |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
628 |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
629 |
^ TopMargin |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
630 |
|
378 | 631 |
"Modified: 3.6.1996 / 10:45:17 / cg" |
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
632 |
"Created: 5.9.1996 / 21:41:49 / cg" |
378 | 633 |
! |
634 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
635 |
topMargin:inches |
378 | 636 |
"set the top margin (in inches)" |
637 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
638 |
TopMargin := inches. |
378 | 639 |
self reInitPage. |
640 |
||
641 |
"Modified: 3.6.1996 / 10:47:26 / cg" |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
432
diff
changeset
|
642 |
"Created: 5.9.1996 / 21:41:55 / cg" |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
643 |
! ! |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
644 |
|
467 | 645 |
!PostscriptPrinterStream class methodsFor:'queries'! |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
646 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
647 |
printerTypeName |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
648 |
"return a descriptive name" |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
649 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
650 |
^ 'postscript printer' |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
651 |
! |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
652 |
|
378 | 653 |
supportsMargins |
654 |
"return true if this printer supports margins" |
|
655 |
||
656 |
^ true |
|
657 |
||
658 |
"Created: 3.6.1996 / 10:48:04 / cg" |
|
659 |
! |
|
660 |
||
368
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
661 |
supportsPageSizes |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
662 |
"return true if this printer supports different page sizes" |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
663 |
|
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
664 |
^ true |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
665 |
|
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
666 |
"Created: 31.5.1996 / 22:35:39 / cg" |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
667 |
! |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
668 |
|
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
669 |
supportsPostscript |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
670 |
"return true if this is a postscript printer" |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
671 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
672 |
^ true |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
673 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
674 |
"Created: 10.2.1996 / 16:23:23 / cg" |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
675 |
! ! |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
676 |
|
879 | 677 |
!PostscriptPrinterStream methodsFor:'access-writing'! |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
678 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
679 |
cr |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
680 |
"send line termination" |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
681 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
682 |
self flushLine. |
1317 | 683 |
native == true ifTrue:[ |
684 |
stream cr. |
|
685 |
^ self |
|
686 |
]. |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
687 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
688 |
xPos := LeftX. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
689 |
colNr := 0. |
1075 | 690 |
sendXPosition := true. |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
691 |
yPos := yPos - FontHeight. |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
692 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
693 |
lineNr := lineNr + 1. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
694 |
lineNr > LinesPerPage ifTrue:[ |
1075 | 695 |
self nextPage |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
696 |
] |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
697 |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
698 |
"Modified: 1.6.1996 / 13:09:30 / cg" |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
699 |
! |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
700 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
701 |
nextPut:aCharacter |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
702 |
|code| |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
703 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
704 |
(aCharacter == Character cr) ifTrue:[ |
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
705 |
^ self cr |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
706 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
707 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
708 |
native == true ifTrue:[ |
1317 | 709 |
stream nextPut:aCharacter. |
710 |
^ self. |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
711 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
712 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
713 |
(aCharacter == $( ) ifTrue:[ |
1075 | 714 |
lineStream nextPutAll:'\(' . |
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
715 |
^ self |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
716 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
717 |
(aCharacter == $) ) ifTrue:[ |
1075 | 718 |
lineStream nextPutAll:'\)' . |
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
719 |
^ self |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
720 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
721 |
(aCharacter == $\ ) ifTrue:[ |
1075 | 722 |
lineStream nextPutAll:'\\' . |
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
723 |
^ self |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
724 |
]. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
725 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
726 |
(aCharacter == Character tab ) ifTrue:[ |
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
727 |
self flushLine. |
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
728 |
colNr := ((colNr + 8) // 8) * 8. |
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
729 |
xPos := LeftX + (colNr * FontWidth). |
1075 | 730 |
sendXPosition := true. |
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
731 |
^ self |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
732 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
733 |
|
1416
6b6269a08973
Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
1317
diff
changeset
|
734 |
(code := aCharacter codePoint) > 16r7F ifTrue:[ |
1075 | 735 |
lineStream nextPut:$\ ; nextPutAll:(code printStringRadix:8) |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
736 |
] ifFalse:[ |
1075 | 737 |
lineStream nextPut:aCharacter |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
738 |
]. |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
739 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
740 |
"Modified: 23.4.1996 / 20:05:59 / cg" |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
741 |
! ! |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
742 |
|
361 | 743 |
!PostscriptPrinterStream methodsFor:'accessing'! |
744 |
||
467 | 745 |
colNr |
746 |
"return the current column-Nr (within the line)" |
|
747 |
||
748 |
^ colNr |
|
749 |
||
750 |
"Created: 2.1.1997 / 13:29:55 / cg" |
|
751 |
! |
|
752 |
||
753 |
lineNr |
|
754 |
"return the current line-Nr (within the page)" |
|
755 |
||
756 |
^ lineNr |
|
757 |
||
758 |
"Created: 2.1.1997 / 13:29:38 / cg" |
|
759 |
! |
|
760 |
||
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
761 |
pageCount |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
762 |
"returns the number of the currently printed page" |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
763 |
|
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
764 |
^ pageCount |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
765 |
|
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
766 |
"Created: 5.9.1996 / 18:29:23 / cg" |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
767 |
! |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
768 |
|
361 | 769 |
pageEndAction:something |
770 |
"set pageEndAction - if non-nil, that will be called before |
|
771 |
and EndPage is emmitted. |
|
772 |
An example use is a private block, |
|
773 |
which draws a company frame around the page ..." |
|
774 |
||
775 |
pageEndAction := something. |
|
776 |
||
777 |
"Modified: 30.5.1996 / 16:45:09 / ca" |
|
778 |
! |
|
779 |
||
780 |
pageStartAction:something |
|
781 |
"set pageStartAction - if nonNil, that is evaluated prior to every page." |
|
782 |
||
783 |
pageStartAction := something. |
|
784 |
||
785 |
"Modified: 30.5.1996 / 16:44:20 / ca" |
|
786 |
! ! |
|
787 |
||
348 | 788 |
!PostscriptPrinterStream methodsFor:'emphasis change'! |
789 |
||
790 |
bold |
|
791 |
"further printing is in bold" |
|
792 |
||
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
793 |
(fStyle ~~ Bold) ifTrue:[ |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
794 |
self flushLine. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
795 |
fStyle := Bold. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
796 |
self setFont. |
382 | 797 |
]. |
348 | 798 |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
799 |
"Modified: 8.6.1996 / 08:17:15 / cg" |
348 | 800 |
! |
801 |
||
349 | 802 |
boldItalic |
803 |
"further printing is in boldItalic" |
|
804 |
||
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
805 |
(fStyle ~~ BoldItalic) ifTrue:[ |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
806 |
self flushLine. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
807 |
fStyle := BoldItalic. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
808 |
self setFont. |
382 | 809 |
]. |
349 | 810 |
|
811 |
"Created: 18.5.1996 / 09:36:36 / cg" |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
812 |
"Modified: 8.6.1996 / 08:17:21 / cg" |
349 | 813 |
! |
814 |
||
348 | 815 |
italic |
816 |
"further printing is in italic" |
|
817 |
||
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
818 |
(fStyle ~~ Italic) ifTrue:[ |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
819 |
self flushLine. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
820 |
fStyle := Italic. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
821 |
self setFont. |
382 | 822 |
]. |
348 | 823 |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
824 |
"Modified: 8.6.1996 / 08:17:28 / cg" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
825 |
! |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
826 |
|
391 | 827 |
noStrikeout |
828 |
"further printing is not strikedout" |
|
829 |
||
830 |
strikeout ifTrue:[ |
|
831 |
self flushLine. |
|
832 |
strikeout := false |
|
833 |
] |
|
834 |
||
835 |
"Modified: 8.6.1996 / 08:15:56 / cg" |
|
836 |
"Created: 8.6.1996 / 08:16:35 / cg" |
|
837 |
! |
|
838 |
||
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
839 |
noUnderline |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
840 |
"further printing is not underlined" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
841 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
842 |
underline ifTrue:[ |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
843 |
self flushLine. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
844 |
underline := false |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
845 |
] |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
846 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
847 |
"Created: 8.6.1996 / 08:11:07 / cg" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
848 |
"Modified: 8.6.1996 / 08:15:56 / cg" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
849 |
! |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
850 |
|
348 | 851 |
normal |
852 |
"further printing is in normal style (i.e. non-bold/non-italic)" |
|
853 |
||
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
854 |
(fStyle ~~ Normal) ifTrue:[ |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
855 |
self flushLine. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
856 |
fStyle := Normal. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
857 |
self setFont. |
380 | 858 |
]. |
348 | 859 |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
860 |
"Modified: 8.6.1996 / 08:17:34 / cg" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
861 |
! |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
862 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
863 |
strikeout |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
864 |
"further printing is strikedout" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
865 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
866 |
strikeout ifFalse:[ |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
867 |
self flushLine. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
868 |
strikeout := true |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
869 |
] |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
870 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
871 |
"Modified: 8.6.1996 / 08:10:49 / cg" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
872 |
"Created: 8.6.1996 / 08:16:18 / cg" |
382 | 873 |
! |
874 |
||
875 |
underline |
|
876 |
"further printing is underlined" |
|
877 |
||
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
878 |
underline ifFalse:[ |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
879 |
self flushLine. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
880 |
underline := true |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
881 |
] |
382 | 882 |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
883 |
"Modified: 8.6.1996 / 08:16:05 / cg" |
348 | 884 |
! ! |
885 |
||
886 |
!PostscriptPrinterStream methodsFor:'font change'! |
|
887 |
||
888 |
courier |
|
889 |
"further printing is in the courier font" |
|
890 |
||
891 |
self flushLine. |
|
892 |
fFamily := Courier. |
|
893 |
self setFont |
|
894 |
||
895 |
"Modified: 10.4.1996 / 13:34:49 / cg" |
|
896 |
! |
|
897 |
||
898 |
helvetica |
|
899 |
"further printing is in the helvetica font" |
|
900 |
||
901 |
self flushLine. |
|
902 |
fFamily := Helvetica. |
|
903 |
self setFont |
|
904 |
||
905 |
"Modified: 10.4.1996 / 13:34:58 / cg" |
|
906 |
! |
|
907 |
||
908 |
times |
|
909 |
"further printing is in the times font" |
|
910 |
||
911 |
self flushLine. |
|
912 |
fFamily := Times. |
|
913 |
self setFont |
|
914 |
||
915 |
"Modified: 10.4.1996 / 13:36:07 / cg" |
|
916 |
! ! |
|
917 |
||
126 | 918 |
!PostscriptPrinterStream methodsFor:'open/close'! |
919 |
||
920 |
endPrint |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
921 |
"finish a document - finish page; then send documentTrailer. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
922 |
Send nothing if nativePrinting." |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
923 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
924 |
native == true ifFalse:[ |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
925 |
self endPage. |
1317 | 926 |
|
927 |
self nextPutAllUntranslated:(self class psTrailer). |
|
928 |
self nextPutAllUntranslated:'%%Pages: ' , pageCount printString. |
|
929 |
self nextPutUntranslated:(Character cr). |
|
930 |
self nextPutAllUntranslated:'%%EOF'. |
|
931 |
self nextPutUntranslated:(Character cr). |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
932 |
]. |
126 | 933 |
super endPrint |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
934 |
|
440 | 935 |
"Modified: 7.9.1996 / 16:28:20 / cg" |
0 | 936 |
! |
937 |
||
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
938 |
setNative:aBoolean |
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
939 |
|
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
940 |
aBoolean ifTrue:[self flushLine]. |
965
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
941 |
super setNative:aBoolean. |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
942 |
! |
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
943 |
|
126 | 944 |
startPrint |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
945 |
"start a document - send documentProlog & start a page. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
946 |
Send nothing if nativePrinting." |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
947 |
|
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
948 |
pageCount := 1. |
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
949 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
950 |
fFamily := Courier. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
951 |
fStyle := Normal. |
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
952 |
underline := false. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
953 |
strikeout := false. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
954 |
|
914 | 955 |
super startPrint. |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
956 |
native == true ifFalse:[ |
1317 | 957 |
self nextPutAllUntranslated:(self class psProlog). |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
958 |
self startPage |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
959 |
] |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
960 |
|
965
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
961 |
"Modified: / 26.5.1999 / 16:15:27 / cg" |
21f25a87c5c6
prolog initialization now lazy (when needed, not when class is initialized)
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
962 |
! ! |
126 | 963 |
|
964 |
!PostscriptPrinterStream methodsFor:'private'! |
|
965 |
||
966 |
endPage |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
967 |
"end a page - flush buffered text & send pageTrailer" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
968 |
|
0 | 969 |
self flushLine. |
361 | 970 |
pageEndAction notNil ifTrue:[ |
1317 | 971 |
pageEndAction value |
361 | 972 |
]. |
1317 | 973 |
self nextPutAllUntranslated:PageTrailer |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
974 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
975 |
"Modified: 23.4.1996 / 20:00:01 / cg" |
0 | 976 |
! |
977 |
||
126 | 978 |
flushLine |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
979 |
"flush buffered line text" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
980 |
|
1075 | 981 |
|lineBuffer| |
982 |
||
1091 | 983 |
lineStream isNil ifTrue:[^ self]. |
984 |
||
1075 | 985 |
lineBuffer := lineStream contents. |
391 | 986 |
|
126 | 987 |
(lineBuffer size > 0) ifTrue:[ |
1075 | 988 |
sendXPosition ifTrue:[ |
989 |
self nextPutAllUntranslated:(xPos printString). |
|
990 |
self nextPutUntranslated:Character space. |
|
991 |
self nextPutAllUntranslated:(yPos printString). |
|
391 | 992 |
]. |
1075 | 993 |
self nextPutUntranslated:$(. |
994 |
self nextPutAllUntranslated:lineBuffer. |
|
995 |
self nextPutUntranslated:$). |
|
391 | 996 |
sendXPosition ifTrue:[ |
1075 | 997 |
self nextPutUntranslated:$B. |
998 |
sendXPosition := false. |
|
391 | 999 |
] ifFalse:[ |
1075 | 1000 |
self nextPutUntranslated:$S. |
391 | 1001 |
]. |
1002 |
underline == true ifTrue:[ |
|
1075 | 1003 |
self nextPutAllUntranslated:'UL'. |
391 | 1004 |
] ifFalse:[ |
1005 |
strikeout == true ifTrue:[ |
|
1075 | 1006 |
self nextPutAllUntranslated:'SO'. |
391 | 1007 |
] |
1008 |
]. |
|
1009 |
||
1075 | 1010 |
self nextPutUntranslated:(Character cr). |
391 | 1011 |
xPos := xPos + (FontWidth * lineBuffer size). |
1012 |
colNr := colNr + lineBuffer size |
|
126 | 1013 |
]. |
866 | 1014 |
self flush. |
1075 | 1015 |
lineStream reset. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1016 |
|
391 | 1017 |
"Modified: 8.6.1996 / 11:40:29 / cg" |
126 | 1018 |
! |
1019 |
||
1020 |
nextPage |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1021 |
"new page - finish previous page & start enew. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1022 |
Should not be sent when nativePrinting." |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1023 |
|
126 | 1024 |
self endPage. |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
1025 |
|
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
1026 |
pageCount := pageCount + 1. |
126 | 1027 |
self startPage |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1028 |
|
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
1029 |
"Modified: 5.9.1996 / 18:30:00 / cg" |
0 | 1030 |
! |
1031 |
||
361 | 1032 |
placeString:aString at:pos |
1033 |
"special entry: place a string at some particular position in my ps-coordinate |
|
1034 |
system. Can be used with endPageActions to place a page-number." |
|
1035 |
||
1075 | 1036 |
self flushLine; |
1037 |
nextPutAllUntranslated:(pos x printString); |
|
1038 |
nextPutUntranslated:Character space; |
|
1039 |
nextPutAllUntranslated:(pos y printString); |
|
1040 |
nextPutUntranslated:$(; |
|
1041 |
nextPutAllUntranslated:aString; |
|
1042 |
nextPutAllUntranslated:')B'; |
|
1043 |
nextPutUntranslated:(Character cr). |
|
361 | 1044 |
|
1045 |
"Created: 30.5.1996 / 17:06:36 / ca" |
|
1046 |
! |
|
1047 |
||
126 | 1048 |
setFont |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1049 |
"change the font. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1050 |
Uses current fFamily and fStyle (which give the fonts nr)" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1051 |
|
126 | 1052 |
|fontNumber| |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1053 |
|
126 | 1054 |
fontNumber := fFamily + fStyle. |
1075 | 1055 |
self nextPutAllUntranslated:fontNumber printString; |
1056 |
nextPutAllUntranslated:' F'; |
|
1057 |
nextPutUntranslated:(Character cr). |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1058 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1059 |
"Modified: 23.4.1996 / 20:01:28 / cg" |
0 | 1060 |
! |
1061 |
||
126 | 1062 |
startPage |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1063 |
"start a page - send pageProlog, reset x/y position and line/col." |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1064 |
|
1075 | 1065 |
self nextPutAllUntranslated:'%%Page: ' , pageCount printString , ' ' , pageCount printString. |
1066 |
self nextPutUntranslated:(Character cr). |
|
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
1067 |
|
361 | 1068 |
pageStartAction notNil ifTrue:[ |
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
1069 |
pageStartAction value |
361 | 1070 |
]. |
1075 | 1071 |
self nextPutAllUntranslated:PageProlog. |
373 | 1072 |
self class landscape ifTrue:[ |
1075 | 1073 |
self nextPutAllUntranslated:'Landscape |
373 | 1074 |
'. |
1075 |
]. |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1076 |
|
126 | 1077 |
self setFont. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1078 |
|
126 | 1079 |
yPos := TopY. |
1080 |
xPos := LeftX. |
|
1075 | 1081 |
lineStream isNil ifTrue:[ |
1082 |
lineStream := WriteStream on:''. |
|
1083 |
] ifFalse:[ |
|
1084 |
lineStream reset. |
|
1085 |
]. |
|
126 | 1086 |
lineNr := 1. |
1075 | 1087 |
colNr := 0. |
1088 |
sendXPosition := true. |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1089 |
|
432
c8b2fa21b747
count pages (for ghostview to be able to page)
Claus Gittinger <cg@exept.de>
parents:
431
diff
changeset
|
1090 |
"Modified: 5.9.1996 / 18:30:08 / cg" |
0 | 1091 |
! ! |
126 | 1092 |
|
361 | 1093 |
!PostscriptPrinterStream methodsFor:'queries'! |
1094 |
||
1095 |
fontHeight |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1096 |
"the used fonts height in my postscript coordinate system |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1097 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 1098 |
|
1099 |
^ FontHeight |
|
1100 |
||
1101 |
"Modified: 30.5.1996 / 16:47:37 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1102 |
"Modified: 1.6.1996 / 13:14:51 / cg" |
361 | 1103 |
! |
1104 |
||
1105 |
leftX |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1106 |
"the left x startPosition (i.e. leftMargin) in my postscript coordinate system. |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1107 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 1108 |
|
1109 |
^ LeftX |
|
1110 |
||
1111 |
"Modified: 30.5.1996 / 16:48:56 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1112 |
"Modified: 1.6.1996 / 13:14:59 / cg" |
361 | 1113 |
! |
1114 |
||
1115 |
linesPerPage |
|
1116 |
"the number of lines per page" |
|
1117 |
||
1118 |
^ LinesPerPage |
|
1119 |
||
1120 |
"Modified: 30.5.1996 / 16:48:20 / ca" |
|
1121 |
! |
|
1122 |
||
1123 |
overAllPageSize |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1124 |
"the overAll pageSize in my postscript coordinate system. |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1125 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 1126 |
|
1127 |
^ PageHeight |
|
1128 |
||
1129 |
"Created: 30.5.1996 / 16:56:51 / ca" |
|
1130 |
"Modified: 30.5.1996 / 16:58:01 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1131 |
"Modified: 1.6.1996 / 13:15:06 / cg" |
361 | 1132 |
! |
1133 |
||
1134 |
topY |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1135 |
"the top y startPosition (i.e. page-size - topMargin) in my own coordinate system |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1136 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 1137 |
|
1138 |
^ TopY |
|
1139 |
||
1140 |
"Modified: 30.5.1996 / 16:48:48 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
1141 |
"Modified: 1.6.1996 / 13:15:23 / cg" |
361 | 1142 |
! ! |
1143 |
||
467 | 1144 |
!PostscriptPrinterStream class methodsFor:'documentation'! |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
1145 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
1146 |
version |
1416
6b6269a08973
Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
1317
diff
changeset
|
1147 |
^ '$Header: /cvs/stx/stx/libbasic2/PostscriptPrinterStream.st,v 1.62 2004-03-05 19:04:52 stefan Exp $' |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
1148 |
! ! |
1091 | 1149 |
|
126 | 1150 |
PostscriptPrinterStream initialize! |