author | Claus Gittinger <cg@exept.de> |
Mon, 03 Jun 1996 12:02:46 +0200 | |
changeset 378 | 91abcf70e0c3 |
parent 375 | ab43222a70ce |
child 380 | fa5adc326473 |
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 |
||
13 |
PrinterStream subclass:#PostscriptPrinterStream |
|
361 | 14 |
instanceVariableNames:'xPos yPos lineBuffer colNr lineNr fFamily fStyle pageStartAction |
15 |
pageEndAction' |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
16 |
classVariableNames:'Prolog Trailer PageProlog PageTrailer FontNames FontHeight |
378 | 17 |
FontWidth LeftX TopY PageHeight LinesPerPage PhysicalPageHeight |
18 |
Italic Bold Normal BoldItalic Courier Times Helvetica TopInset |
|
19 |
LeftInset BottomInset' |
|
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
20 |
poolDictionaries:'' |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
21 |
category:'Streams-External' |
0 | 22 |
! |
23 |
||
6 | 24 |
!PostscriptPrinterStream class methodsFor:'documentation'! |
25 |
||
31 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
71 | 29 |
All Rights Reserved |
31 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
6 | 40 |
documentation |
41 |
" |
|
28 | 42 |
This class provides simple text output to postscript printers; |
31 | 43 |
to use it, evaluate |
223 | 44 |
Smalltalk at:#Printer put:PostscriptPrinterStream |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
45 |
(usually in some rc file). |
361 | 46 |
or change it via the launchers settings-menu. |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
47 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
48 |
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
|
49 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
50 |
For now, only Helvetica, Courier and Times fonts in italic, roman and bold |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
51 |
are supported. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
52 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
53 |
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
|
54 |
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
|
55 |
(see other subclasses of PrinterStream). |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
56 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
57 |
If you already have a postscript string at hand, this can be sent to |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
58 |
the printer in native mode. |
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. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
62 |
Notice, that these postscript classes are derived from public domain code; |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
63 |
there is no warranty. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
64 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
65 |
[see also:] |
249 | 66 |
PSGraphicsContext |
67 |
EpsonFX1PrinterStream HPLjetIIPrinterStream PrinterStream |
|
259 | 68 |
|
69 |
[author:] |
|
70 |
Claus Gittinger |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
71 |
" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
72 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
73 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
74 |
examples |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
75 |
" |
223 | 76 |
For text printing, use: |
270 | 77 |
[exBegin] |
223 | 78 |
|s| |
79 |
||
248 | 80 |
s := Printer new. |
223 | 81 |
s nextPutAll:'hello'; cr. |
82 |
s bold. |
|
83 |
s nextPutAll:'this is bold'; cr. |
|
84 |
s normal. |
|
85 |
s italic. |
|
86 |
s nextPutAll:'this is italic'; cr. |
|
349 | 87 |
s boldItalic. |
88 |
s nextPutAll:'this is boldItalic'; cr. |
|
223 | 89 |
s normal. |
90 |
s nextPutAll:'normal again'; cr. |
|
91 |
s helvetica. |
|
248 | 92 |
s nextPutAll:'helvetica'; cr. |
223 | 93 |
s times. |
248 | 94 |
s nextPutAll:'times'; cr. |
223 | 95 |
s courier. |
248 | 96 |
s nextPutAll:'courier'; cr. |
223 | 97 |
s close |
270 | 98 |
[exEnd] |
349 | 99 |
or, if you already have emphasized text at hand: |
100 |
[exBegin] |
|
101 |
|s| |
|
102 |
||
103 |
s := Printer new. |
|
104 |
s nextPutAll:'hello'; cr. |
|
105 |
s nextPutAll:'this is '; |
|
106 |
nextPutAll:(Text string:'bold' emphasis:#bold); |
|
107 |
cr; |
|
108 |
nextPutAll:'this is '; |
|
109 |
nextPutAll:(Text string:'italic' emphasis:#italic); |
|
110 |
cr; |
|
111 |
nextPutAll:'this is '; |
|
112 |
nextPutAll:(Text string:'boldItalic' emphasis:#(bold italic)); |
|
113 |
cr; |
|
114 |
nextPutAll:'normal again'; |
|
115 |
cr; |
|
116 |
helvetica; |
|
117 |
nextPutAll:'helvetica'; |
|
118 |
cr; |
|
119 |
times; |
|
120 |
nextPutAll:'times'; |
|
121 |
cr; |
|
122 |
courier; |
|
123 |
nextPutAll:'courier'; |
|
124 |
cr. |
|
125 |
s close |
|
126 |
[exEnd] |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
127 |
|
361 | 128 |
placing a page-hook, to add a page number: |
129 |
(page hooks require that you understand some postscript ... |
|
130 |
... and have a look at how this class generates its postscript code) |
|
131 |
[exBegin] |
|
132 |
|s hook pageNr| |
|
133 |
||
134 |
s := Printer new. |
|
135 |
||
136 |
pageNr := 0. |
|
137 |
hook := [ |
|
138 |
||
139 |
pageNr := pageNr + 1. |
|
140 |
s placeString:('page ' , pageNr printString) at:(5500 @ 400). |
|
141 |
]. |
|
142 |
||
143 |
s pageEndAction:hook. |
|
144 |
(1 to:200) do:[:lineNr | |
|
145 |
s nextPutAll:'line ' , lineNr printString. |
|
146 |
s cr. |
|
147 |
]. |
|
148 |
s close. |
|
149 |
[exEnd] |
|
150 |
||
151 |
||
152 |
placing a page-hook, to add a custom frame, logo or company letter-head: |
|
153 |
(page hooks require that you understand some postscript ... |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
154 |
... 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
|
155 |
... 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
|
156 |
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
|
157 |
pageHeight/pageWidth.) |
361 | 158 |
[exBegin] |
159 |
|s hook pageNr| |
|
160 |
||
161 |
s := Printer new. |
|
162 |
||
163 |
pageNr := 0. |
|
164 |
hook := [ |
|
165 |
||
166 |
pageNr := pageNr + 1. |
|
167 |
s placeString:('page ' , pageNr printString) at:(5500 @ 400). |
|
168 |
s placeString:('Document revision:') at:(900 @ 1200). |
|
169 |
s placeString:('Revieved by:') at:(900 @ 900). |
|
170 |
||
171 |
s setNative:true. |
|
172 |
s nextPutAll:'0 setlinewidth'; cr. |
|
173 |
s nextPutAll:'800 800 moveto'; cr. |
|
174 |
s nextPutAll:'11000 800 lineto'; cr. |
|
175 |
s nextPutAll:'11000 15500 lineto'; cr. |
|
176 |
s nextPutAll:'800 15500 lineto'; cr. |
|
177 |
s nextPutAll:'800 800 lineto'; cr. |
|
178 |
s nextPutAll:'stroke'; cr. |
|
179 |
||
180 |
s nextPutAll:'800 1100 moveto'; cr. |
|
181 |
s nextPutAll:'11000 1100 lineto'; cr. |
|
182 |
s nextPutAll:'stroke'; cr. |
|
183 |
||
184 |
s nextPutAll:'800 1400 moveto'; cr. |
|
185 |
s nextPutAll:'11000 1400 lineto'; cr. |
|
186 |
s nextPutAll:'stroke'; cr. |
|
187 |
||
188 |
s setNative:false. |
|
189 |
]. |
|
190 |
||
191 |
s pageEndAction:hook. |
|
192 |
(1 to:200) do:[:lineNr | |
|
193 |
s nextPutAll:'line ' , lineNr printString. |
|
194 |
s cr. |
|
195 |
]. |
|
196 |
s close. |
|
197 |
[exEnd] |
|
198 |
||
199 |
||
223 | 200 |
If you already have a postscript string at hand, this can be sent to |
201 |
the printer in native mode: |
|
270 | 202 |
[exBegin] |
223 | 203 |
|s| |
204 |
||
248 | 205 |
s := Printer newNative. |
223 | 206 |
s nextPutAll:<your postscript string>. |
270 | 207 |
[exEnd] |
223 | 208 |
s close |
209 |
||
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
170
diff
changeset
|
210 |
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
|
211 |
These provide protocol similar to the one provided by display graphicContexts. |
223 | 212 |
Notice, that these postscript classes are derived from public domain code; |
213 |
there is no warranty. |
|
214 |
||
215 |
Usage: |
|
270 | 216 |
[exBegin] |
223 | 217 |
|drawable s| |
218 |
||
248 | 219 |
s := Printer newNative. |
223 | 220 |
drawable := PSGraphicsContext on:s. |
221 |
||
222 |
drawable displayLineFrom:(0@0) to:(100@100). |
|
348 | 223 |
drawable displayLineFrom:(100@0) to:(0@100). |
224 |
drawable displayCircle:(150@150) radius:50. |
|
223 | 225 |
(Image fromFile:'bitmaps/SBrowser.xbm') displayOn:drawable at:(50@30). |
226 |
||
227 |
drawable close. |
|
270 | 228 |
[exEnd] |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
229 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
230 |
the same in a view: |
270 | 231 |
[exBegin] |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
232 |
|drawable| |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
233 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
234 |
drawable := (View extent:200@200) openAndWait. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
235 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
236 |
drawable displayLineFrom:(0@0) to:(100@100). |
348 | 237 |
drawable displayLineFrom:(100@0) to:(0@100). |
238 |
drawable displayCircle:(150@150) radius:50. |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
239 |
(Image fromFile:'bitmaps/SBrowser.xbm') displayOn:drawable at:(50@30). |
270 | 240 |
[exEnd] |
6 | 241 |
" |
242 |
! ! |
|
0 | 243 |
|
244 |
!PostscriptPrinterStream class methodsFor:'initialization'! |
|
245 |
||
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
246 |
initCharacterSize |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
247 |
"setup the character parameters" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
248 |
|
361 | 249 |
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
|
250 |
FontWidth := 120. "/ used to compute width of tabs |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
251 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
252 |
"Created: 23.4.1996 / 19:53:34 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
253 |
"Modified: 23.4.1996 / 20:05:17 / cg" |
361 | 254 |
"Modified: 30.5.1996 / 17:24:05 / ca" |
0 | 255 |
! |
256 |
||
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
257 |
initFonts |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
258 |
"setup the font names. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
259 |
initProlog uses those parameters." |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
260 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
261 |
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
|
262 |
Bold := 1. "/ offset from base-font# to bold version |
349 | 263 |
BoldItalic := 2. "/ offset from base-font# to boldItalic version |
264 |
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
|
265 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
266 |
Helvetica := 0. "/ # of helvetica base font |
349 | 267 |
Times := 4. "/ # of times base font |
268 |
Courier := 8. "/ # of courier base font |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
269 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
270 |
FontNames := #( |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
271 |
'/Helvetica-Oblique' |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
272 |
'/Helvetica-Bold' |
349 | 273 |
'/Helvetica-BoldOblique' |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
274 |
'/Helvetica' |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
275 |
'/Times-Italic' |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
276 |
'/Times-Bold' |
349 | 277 |
'/Times-BoldItalic' |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
278 |
'/Times' |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
279 |
'/Courier-Oblique' |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
280 |
'/Courier-Bold' |
349 | 281 |
'/Courier-BoldOblique' |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
282 |
'/Courier' |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
283 |
) |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
284 |
|
349 | 285 |
"Modified: 18.5.1996 / 09:37:48 / cg" |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
286 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
287 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
288 |
initPage |
361 | 289 |
"setup the page parameters. |
370 | 290 |
All coordinates are scaled by 20 w.r.t the PS coordinates (i.e. in twips)." |
291 |
||
292 |
PageFormat isNil ifTrue:[ |
|
293 |
PageFormat := #letter |
|
294 |
]. |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
295 |
|
378 | 296 |
TopInset isNil ifTrue:[ |
297 |
TopInset := 0.652778. "/ inches |
|
370 | 298 |
]. |
378 | 299 |
BottomInset isNil ifTrue:[ |
300 |
BottomInset := 1.18056 "/ inches |
|
370 | 301 |
]. |
378 | 302 |
LeftInset isNil ifTrue:[ |
303 |
LeftInset := 0.625. "/ inches |
|
370 | 304 |
]. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
305 |
|
361 | 306 |
"/ +-----------------------------------------------+ PageHeight |
307 |
"/ | | |
|
308 |
"/ | LeftX +---------------------------------------| TopY |
|
309 |
"/ | |1st printed line | |
|
310 |
"/ | | | |
|
311 |
"/ | | | |
|
312 |
"/ | | | |
|
313 |
"/ | | | |
|
314 |
"/ | |last line (linesPerPage) | |
|
315 |
"/ | +---------------------------------------| |
|
316 |
"/ | | |
|
317 |
"/ (0/0)-------------------------------------------+ 0 |
|
318 |
||
378 | 319 |
LeftX := (UnitConverter convert:LeftInset from:#inch to:#twip) rounded. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
320 |
|
370 | 321 |
PhysicalPageHeight := (UnitConverter convert:1 from:(PageFormat , 'H') to:#twip) rounded. |
322 |
Landscape ifTrue:[ |
|
323 |
PageHeight := (UnitConverter convert:1 from:(PageFormat , 'lH') to:#twip) rounded. |
|
324 |
] ifFalse:[ |
|
325 |
PageHeight := (UnitConverter convert:1 from:(PageFormat , 'H') to:#twip) rounded. |
|
326 |
]. |
|
327 |
||
378 | 328 |
TopY := PageHeight - (UnitConverter convert:TopInset from:#inch to:#twip) rounded. |
329 |
LinesPerPage := TopY - (UnitConverter convert:BottomInset from:#inch to:#twip) rounded // 200. |
|
370 | 330 |
|
361 | 331 |
"Modified: 30.5.1996 / 17:24:55 / ca" |
378 | 332 |
"Modified: 3.6.1996 / 10:45:34 / cg" |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
333 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
334 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
335 |
initPageProlog |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
336 |
"define the page prolog" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
337 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
338 |
PageProlog := |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
339 |
'StartPage |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
340 |
'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
341 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
342 |
"Created: 23.4.1996 / 19:56:16 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
343 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
344 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
345 |
initPageTrailer |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
346 |
"define the page epilog" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
347 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
348 |
PageTrailer := |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
349 |
'EndPage |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
350 |
'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
351 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
352 |
"Modified: 23.4.1996 / 19:55:50 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
353 |
"Created: 23.4.1996 / 19:56:30 / cg" |
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 |
initProlog |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
357 |
"define the documents prolog" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
358 |
|
0 | 359 |
|tmpString t fontNr| |
360 |
||
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
361 |
tmpString := |
0 | 362 |
'%!!PS-Adobe-1.0 |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
363 |
%%Creator: Smalltalk/X |
0 | 364 |
%%DocumentFonts: Courier-Oblique Courier-Bold Courier Times-Italic Times-Bold Times |
365 |
save/SmalltalkJob exch def |
|
361 | 366 |
/OriginalState gstate def |
0 | 367 |
/StartSmalltalkDoc{$smalltalk begin}def |
368 |
/$smalltalk 50 dict def $smalltalk begin |
|
369 |
/EndSmalltalkDoc{end}def |
|
370 |
/S/show load def |
|
371 |
/X{exch 0 rmoveto S}def |
|
372 |
/Y{exch 0 exch rmoveto S}def |
|
373 |
/B{3 1 roll moveto S}def |
|
374 |
/F{$fd exch get setfont}def |
|
375 |
/StartPage{/svpg save def .05 dup scale}def |
|
376 |
/EndPage{svpg restore showpage}def |
|
377 |
/DoPreFeed{/statusdict where{pop |
|
378 |
statusdict/prefeed known{statusdict exch/prefeed exch put 0}if}if pop}def |
|
373 | 379 |
/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
|
380 |
/ISOrecode {findfont dup length dict begin |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
381 |
{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
|
382 |
/Encoding ISOLatin1Encoding def |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
383 |
currentdict end definefont pop} def |
0 | 384 |
/SetUpFonts |
385 |
{dup/$fd exch array def{findfont exch scalefont $fd 3 1 roll put}repeat}def |
|
386 |
/InitGaudy{/TwoColumn exch def /BarLength exch def |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
387 |
/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
|
388 |
/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
|
389 |
/ftP /ISO-Helvetica-Bold findfont 30 UP scalefont def}def |
0 | 390 |
/U{1440 mul}def |
391 |
/UP{U 72 div}def |
|
392 |
/LB{/pts exch UP def /charcolor exch def /boxcolor exch def /font exch def |
|
393 |
/label exch def /dy exch def /dx exch def /lly exch def /llx exch def |
|
394 |
gsave boxcolor setgray |
|
395 |
llx lly moveto dx 0 rlineto 0 dy rlineto dx neg 0 rlineto closepath fill |
|
396 |
/lines label length def |
|
397 |
/yp lly dy add dy lines pts mul sub 2 div sub pts .85 mul sub def |
|
398 |
font setfont charcolor setgray |
|
399 |
label {dup stringwidth pop 2 div llx dx 2 div add exch sub yp moveto show |
|
400 |
/yp yp pts sub def}forall grestore}def |
|
401 |
/Gaudy{/Page exch def /Date exch def /File exch def /Comment exch def |
|
402 |
.25 U 10.2 U BarLength .1 sub U .25 U [File] ftF .97 0 14 LB |
|
403 |
.25 U 10.45 U BarLength .1 sub U .25 U [Comment] ftF 1 0 14 LB |
|
404 |
.25 U 10.2 U 1 U .5 U Date ftD .7 0 12 LB |
|
405 |
BarLength .75 sub U 10.2 U 1 U .5 U [Page] ftP .7 1 30 LB |
|
406 |
TwoColumn{BarLength 2 div .19 add U 10.2 U moveto 0 -10 U rlineto stroke}if |
|
407 |
}def |
|
408 |
end |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
409 |
StartSmalltalkDoc |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
410 |
% end of fixed prolog |
0 | 411 |
'. |
412 |
||
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
413 |
t := ''. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
414 |
FontNames do:[:aName | |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
415 |
t := t , '/ISO-' , aName , ' ' , aName , ' ISOrecode |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
416 |
'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
417 |
]. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
418 |
t := t , ' |
0 | 419 |
'. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
420 |
tmpString := tmpString , t. |
0 | 421 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
422 |
t := ''. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
423 |
fontNr := 0. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
424 |
FontNames do:[:aName | |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
425 |
t := t , (fontNr printString) , ' ' |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
426 |
, (FontHeight printString) , ' ' |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
427 |
, aName , (Character nl) asString. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
428 |
fontNr := fontNr + 1 |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
429 |
]. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
430 |
tmpString := tmpString , t. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
431 |
tmpString := tmpString , fontNr printString , ' SetUpFonts |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
432 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
433 |
% end of prolog |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
434 |
'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
435 |
Prolog := tmpString. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
436 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
437 |
" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
438 |
PostscriptPrinterStream initProlog |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
439 |
" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
440 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
441 |
"Created: 23.4.1996 / 19:40:44 / cg" |
373 | 442 |
"Modified: 1.6.1996 / 00:46:20 / cg" |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
443 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
444 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
445 |
initTrailer |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
446 |
"define the documents epilog" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
447 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
448 |
Trailer := |
0 | 449 |
'EndSmalltalkDoc |
450 |
SmalltalkJob restore |
|
451 |
' |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
452 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
453 |
"Created: 23.4.1996 / 19:55:24 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
454 |
"Modified: 23.4.1996 / 19:55:38 / cg" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
455 |
! |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
456 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
457 |
initialize |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
458 |
Normal isNil ifTrue:[ |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
459 |
self initFonts. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
460 |
self initPage. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
461 |
self initCharacterSize. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
462 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
463 |
self initProlog. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
464 |
self initTrailer. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
465 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
466 |
self initPageProlog. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
467 |
self initPageTrailer |
170 | 468 |
] |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
469 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
470 |
" |
349 | 471 |
Normal := nil. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
472 |
self initialize |
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 |
|
349 | 475 |
"Modified: 18.5.1996 / 09:46:15 / cg" |
370 | 476 |
! |
477 |
||
478 |
reInitPage |
|
479 |
self initPage. |
|
480 |
self initProlog. |
|
481 |
||
482 |
"Created: 31.5.1996 / 23:35:18 / cg" |
|
483 |
! ! |
|
484 |
||
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
485 |
!PostscriptPrinterStream class methodsFor:'accessing - defaults'! |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
486 |
|
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
487 |
bottomInset |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
488 |
"return the bottom margin (in inches)" |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
489 |
|
378 | 490 |
^ BottomInset |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
491 |
|
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
492 |
"Created: 1.6.1996 / 13:07:43 / cg" |
378 | 493 |
"Modified: 3.6.1996 / 10:44:44 / cg" |
494 |
! |
|
495 |
||
496 |
bottomInset:inches |
|
497 |
"set the bottom margin (in inches)" |
|
498 |
||
499 |
BottomInset := inches. |
|
500 |
self reInitPage. |
|
501 |
||
502 |
"Created: 3.6.1996 / 10:46:25 / cg" |
|
503 |
"Modified: 3.6.1996 / 10:47:16 / cg" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
504 |
! |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
505 |
|
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
506 |
leftInset |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
507 |
"return the left margin (in inches)" |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
508 |
|
378 | 509 |
^ LeftInset |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
510 |
|
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
511 |
"Created: 1.6.1996 / 13:07:12 / cg" |
378 | 512 |
"Modified: 3.6.1996 / 10:45:11 / cg" |
513 |
! |
|
514 |
||
515 |
leftInset:inches |
|
516 |
"set the left margin (in inches)" |
|
517 |
||
518 |
LeftInset := inches. |
|
519 |
self reInitPage. |
|
520 |
||
521 |
"Created: 3.6.1996 / 10:46:33 / cg" |
|
522 |
"Modified: 3.6.1996 / 10:47:21 / cg" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
523 |
! |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
524 |
|
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
525 |
topInset |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
526 |
"return the top margin (in inches)" |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
527 |
|
378 | 528 |
^ TopInset |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
529 |
|
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
530 |
"Created: 1.6.1996 / 13:07:20 / cg" |
378 | 531 |
"Modified: 3.6.1996 / 10:45:17 / cg" |
532 |
! |
|
533 |
||
534 |
topInset:inches |
|
535 |
"set the top margin (in inches)" |
|
536 |
||
537 |
TopInset := inches. |
|
538 |
self reInitPage. |
|
539 |
||
540 |
"Created: 3.6.1996 / 10:46:41 / cg" |
|
541 |
"Modified: 3.6.1996 / 10:47:26 / cg" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
542 |
! ! |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
543 |
|
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
544 |
!PostscriptPrinterStream class methodsFor:'queries'! |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
545 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
546 |
printerTypeName |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
547 |
"return a descriptive name" |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
548 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
549 |
^ 'postscript printer' |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
550 |
! |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
551 |
|
378 | 552 |
supportsMargins |
553 |
"return true if this printer supports margins" |
|
554 |
||
555 |
^ true |
|
556 |
||
557 |
"Created: 3.6.1996 / 10:48:04 / cg" |
|
558 |
! |
|
559 |
||
368
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
560 |
supportsPageSizes |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
561 |
"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
|
562 |
|
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
563 |
^ true |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
564 |
|
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
565 |
"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
|
566 |
! |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
361
diff
changeset
|
567 |
|
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
568 |
supportsPostscript |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
569 |
"return true if this is a postscript printer" |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
570 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
571 |
^ true |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
572 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
573 |
"Created: 10.2.1996 / 16:23:23 / cg" |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
574 |
! ! |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
575 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
576 |
!PostscriptPrinterStream methodsFor:'access writing'! |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
577 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
578 |
cr |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
579 |
"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
|
580 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
581 |
self flushLine. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
582 |
native == true ifTrue:[^ super cr]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
583 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
584 |
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
|
585 |
colNr := 0. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
586 |
yPos := yPos - FontHeight. |
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
587 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
588 |
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
|
589 |
lineNr > LinesPerPage ifTrue:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
590 |
self nextPage |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
591 |
] |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
592 |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
593 |
"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
|
594 |
! |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
595 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
596 |
nextPut:aCharacter |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
597 |
|code| |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
598 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
599 |
(aCharacter == Character cr) ifTrue:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
600 |
^ self cr |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
601 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
602 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
603 |
native == true ifTrue:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
604 |
self flushLine. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
605 |
^ super nextPut:aCharacter |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
606 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
607 |
|
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
608 |
(aCharacter == $( ) ifTrue:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
609 |
lineBuffer := lineBuffer , '\(' . |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
610 |
^ self |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
611 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
612 |
(aCharacter == $) ) ifTrue:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
613 |
lineBuffer := lineBuffer , '\)' . |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
614 |
^ self |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
615 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
616 |
(aCharacter == $\ ) ifTrue:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
617 |
lineBuffer := lineBuffer , '\\' . |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
618 |
^ self |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
619 |
]. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
620 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
621 |
(aCharacter == Character tab ) ifTrue:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
622 |
self flushLine. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
623 |
colNr := ((colNr + 8) // 8) * 8. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
624 |
xPos := LeftX + (colNr * FontWidth). |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
625 |
^ self |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
626 |
]. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
627 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
628 |
(code := aCharacter asciiValue) > 16r7F ifTrue:[ |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
629 |
lineBuffer := lineBuffer , '\' , (code printStringRadix:8) |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
630 |
] ifFalse:[ |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
631 |
lineBuffer := lineBuffer copyWith:aCharacter |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
632 |
]. |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
633 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
634 |
"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
|
635 |
! ! |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
636 |
|
361 | 637 |
!PostscriptPrinterStream methodsFor:'accessing'! |
638 |
||
639 |
pageEndAction:something |
|
640 |
"set pageEndAction - if non-nil, that will be called before |
|
641 |
and EndPage is emmitted. |
|
642 |
An example use is a private block, |
|
643 |
which draws a company frame around the page ..." |
|
644 |
||
645 |
pageEndAction := something. |
|
646 |
||
647 |
"Modified: 30.5.1996 / 16:45:09 / ca" |
|
648 |
! |
|
649 |
||
650 |
pageStartAction:something |
|
651 |
"set pageStartAction - if nonNil, that is evaluated prior to every page." |
|
652 |
||
653 |
pageStartAction := something. |
|
654 |
||
655 |
"Modified: 30.5.1996 / 16:44:20 / ca" |
|
656 |
! ! |
|
657 |
||
348 | 658 |
!PostscriptPrinterStream methodsFor:'emphasis change'! |
659 |
||
660 |
bold |
|
661 |
"further printing is in bold" |
|
662 |
||
663 |
self flushLine. |
|
664 |
fStyle := Bold. |
|
665 |
self setFont |
|
666 |
||
667 |
"Modified: 10.4.1996 / 13:34:37 / cg" |
|
668 |
! |
|
669 |
||
349 | 670 |
boldItalic |
671 |
"further printing is in boldItalic" |
|
672 |
||
673 |
self flushLine. |
|
674 |
fStyle := BoldItalic. |
|
675 |
self setFont |
|
676 |
||
677 |
"Created: 18.5.1996 / 09:36:36 / cg" |
|
678 |
"Modified: 18.5.1996 / 09:43:10 / cg" |
|
679 |
! |
|
680 |
||
348 | 681 |
italic |
682 |
"further printing is in italic" |
|
683 |
||
684 |
self flushLine. |
|
685 |
fStyle := Italic. |
|
686 |
self setFont |
|
687 |
||
688 |
"Modified: 10.4.1996 / 13:35:16 / cg" |
|
689 |
! |
|
690 |
||
691 |
normal |
|
692 |
"further printing is in normal style (i.e. non-bold/non-italic)" |
|
693 |
||
694 |
self flushLine. |
|
695 |
fStyle := Normal. |
|
696 |
self setFont |
|
697 |
||
698 |
"Modified: 10.4.1996 / 13:35:57 / cg" |
|
699 |
! ! |
|
700 |
||
701 |
!PostscriptPrinterStream methodsFor:'font change'! |
|
702 |
||
703 |
courier |
|
704 |
"further printing is in the courier font" |
|
705 |
||
706 |
self flushLine. |
|
707 |
fFamily := Courier. |
|
708 |
self setFont |
|
709 |
||
710 |
"Modified: 10.4.1996 / 13:34:49 / cg" |
|
711 |
! |
|
712 |
||
713 |
helvetica |
|
714 |
"further printing is in the helvetica font" |
|
715 |
||
716 |
self flushLine. |
|
717 |
fFamily := Helvetica. |
|
718 |
self setFont |
|
719 |
||
720 |
"Modified: 10.4.1996 / 13:34:58 / cg" |
|
721 |
! |
|
722 |
||
723 |
times |
|
724 |
"further printing is in the times font" |
|
725 |
||
726 |
self flushLine. |
|
727 |
fFamily := Times. |
|
728 |
self setFont |
|
729 |
||
730 |
"Modified: 10.4.1996 / 13:36:07 / cg" |
|
731 |
! ! |
|
732 |
||
126 | 733 |
!PostscriptPrinterStream methodsFor:'open/close'! |
734 |
||
735 |
endPrint |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
736 |
"finish a document - finish page; then send documentTrailer. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
737 |
Send nothing if nativePrinting." |
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 |
native == true ifFalse:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
740 |
self endPage. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
741 |
super nextPutAllUntranslated:Trailer. |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
742 |
]. |
126 | 743 |
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
|
744 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
745 |
"Modified: 23.4.1996 / 20:03:26 / cg" |
0 | 746 |
! |
747 |
||
126 | 748 |
startPrint |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
749 |
"start a document - send documentProlog & start a page. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
750 |
Send nothing if nativePrinting." |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
751 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
752 |
fFamily := Courier. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
753 |
fStyle := Normal. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
754 |
|
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
755 |
native == true ifFalse:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
756 |
Prolog isNil ifTrue:[ |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
757 |
self class initialize |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
758 |
]. |
372 | 759 |
super writingTo:(self class printCommand). |
222
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
760 |
super nextPutAllUntranslated:Prolog. |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
761 |
self startPage |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
762 |
] |
15d1c9a82bc6
suppress trailer in native printing (used to disturb the output of html printouts)
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
763 |
|
373 | 764 |
"Modified: 1.6.1996 / 00:43:50 / cg" |
126 | 765 |
! ! |
766 |
||
767 |
!PostscriptPrinterStream methodsFor:'private'! |
|
768 |
||
769 |
endPage |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
770 |
"end a page - flush buffered text & send pageTrailer" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
771 |
|
0 | 772 |
self flushLine. |
361 | 773 |
pageEndAction notNil ifTrue:[ |
774 |
pageEndAction value |
|
775 |
]. |
|
126 | 776 |
super nextPutAllUntranslated:PageTrailer |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
777 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
778 |
"Modified: 23.4.1996 / 20:00:01 / cg" |
0 | 779 |
! |
780 |
||
126 | 781 |
flushLine |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
782 |
"flush buffered line text" |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
783 |
|
126 | 784 |
(lineBuffer size > 0) ifTrue:[ |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
785 |
super nextPutAllUntranslated:(xPos printString ). |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
786 |
super nextPutAllUntranslated:' '. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
787 |
super nextPutAllUntranslated:(yPos printString). |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
788 |
super nextPutAllUntranslated:'('. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
789 |
super nextPutAllUntranslated:lineBuffer. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
790 |
super nextPutAllUntranslated:')B'. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
791 |
super nextPutUntranslated:(Character cr). |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
792 |
xPos := xPos + (FontWidth * lineBuffer size). |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
793 |
colNr := colNr + lineBuffer size |
126 | 794 |
]. |
795 |
lineBuffer := '' |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
796 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
797 |
"Modified: 23.4.1996 / 20:00:13 / cg" |
126 | 798 |
! |
799 |
||
800 |
nextPage |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
801 |
"new page - finish previous page & start enew. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
802 |
Should not be sent when nativePrinting." |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
803 |
|
126 | 804 |
self endPage. |
805 |
self startPage |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
806 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
807 |
"Modified: 23.4.1996 / 20:04:07 / cg" |
0 | 808 |
! |
809 |
||
361 | 810 |
placeString:aString at:pos |
811 |
"special entry: place a string at some particular position in my ps-coordinate |
|
812 |
system. Can be used with endPageActions to place a page-number." |
|
813 |
||
814 |
self flushLine. |
|
815 |
super nextPutAllUntranslated:(pos x printString ). |
|
816 |
super nextPutAllUntranslated:' '. |
|
817 |
super nextPutAllUntranslated:(pos y printString). |
|
818 |
super nextPutAllUntranslated:'('. |
|
819 |
super nextPutAllUntranslated:aString. |
|
820 |
super nextPutAllUntranslated:')B'. |
|
821 |
super nextPutUntranslated:(Character cr). |
|
822 |
||
823 |
"Created: 30.5.1996 / 17:06:36 / ca" |
|
824 |
! |
|
825 |
||
126 | 826 |
setFont |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
827 |
"change the font. |
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
828 |
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
|
829 |
|
126 | 830 |
|fontNumber| |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
831 |
|
126 | 832 |
fontNumber := fFamily + fStyle. |
833 |
super nextPutAllUntranslated:fontNumber printString. |
|
834 |
super nextPutAllUntranslated:' F'. |
|
835 |
super nextPutUntranslated:(Character cr) |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
836 |
|
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
837 |
"Modified: 23.4.1996 / 20:01:28 / cg" |
0 | 838 |
! |
839 |
||
126 | 840 |
startPage |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
841 |
"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
|
842 |
|
361 | 843 |
pageStartAction notNil ifTrue:[ |
844 |
pageStartAction value |
|
845 |
]. |
|
126 | 846 |
super nextPutAllUntranslated:PageProlog. |
373 | 847 |
self class landscape ifTrue:[ |
848 |
super nextPutAllUntranslated:'Landscape |
|
849 |
'. |
|
850 |
]. |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
851 |
|
126 | 852 |
self setFont. |
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
853 |
|
126 | 854 |
yPos := TopY. |
855 |
xPos := LeftX. |
|
856 |
lineBuffer := ''. |
|
857 |
lineNr := 1. |
|
858 |
colNr := 0 |
|
246
ba03a2af594c
fixed ISO-latin1 encoding (national characters)
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
859 |
|
373 | 860 |
"Modified: 1.6.1996 / 00:44:10 / cg" |
0 | 861 |
! ! |
126 | 862 |
|
361 | 863 |
!PostscriptPrinterStream methodsFor:'queries'! |
864 |
||
865 |
fontHeight |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
866 |
"the used fonts height in my postscript coordinate system |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
867 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 868 |
|
869 |
^ FontHeight |
|
870 |
||
871 |
"Modified: 30.5.1996 / 16:47:37 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
872 |
"Modified: 1.6.1996 / 13:14:51 / cg" |
361 | 873 |
! |
874 |
||
875 |
leftX |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
876 |
"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
|
877 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 878 |
|
879 |
^ LeftX |
|
880 |
||
881 |
"Modified: 30.5.1996 / 16:48:56 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
882 |
"Modified: 1.6.1996 / 13:14:59 / cg" |
361 | 883 |
! |
884 |
||
885 |
linesPerPage |
|
886 |
"the number of lines per page" |
|
887 |
||
888 |
^ LinesPerPage |
|
889 |
||
890 |
"Modified: 30.5.1996 / 16:48:20 / ca" |
|
891 |
! |
|
892 |
||
893 |
overAllPageSize |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
894 |
"the overAll pageSize in my postscript coordinate system. |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
895 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 896 |
|
897 |
^ PageHeight |
|
898 |
||
899 |
"Created: 30.5.1996 / 16:56:51 / ca" |
|
900 |
"Modified: 30.5.1996 / 16:58:01 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
901 |
"Modified: 1.6.1996 / 13:15:06 / cg" |
361 | 902 |
! |
903 |
||
904 |
topMargin |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
905 |
"return the topMargin in my postscript coordinate system. |
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
906 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 907 |
|
908 |
^ PageHeight - TopY |
|
909 |
||
910 |
"Modified: 30.5.1996 / 16:58:01 / ca" |
|
911 |
"Created: 30.5.1996 / 17:02:02 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
912 |
"Modified: 1.6.1996 / 13:15:50 / cg" |
361 | 913 |
! |
914 |
||
915 |
topY |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
916 |
"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
|
917 |
(i.e. in twips, which is 1/20th of a point)" |
361 | 918 |
|
919 |
^ TopY |
|
920 |
||
921 |
"Modified: 30.5.1996 / 16:48:48 / ca" |
|
375
ab43222a70ce
added access methods for margins
Claus Gittinger <cg@exept.de>
parents:
373
diff
changeset
|
922 |
"Modified: 1.6.1996 / 13:15:23 / cg" |
361 | 923 |
! ! |
924 |
||
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
925 |
!PostscriptPrinterStream class methodsFor:'documentation'! |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
926 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
927 |
version |
378 | 928 |
^ '$Header: /cvs/stx/stx/libbasic2/PostscriptPrinterStream.st,v 1.34 1996-06-03 10:02:05 cg Exp $' |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
929 |
! ! |
126 | 930 |
PostscriptPrinterStream initialize! |