author | mawalch |
Mon, 11 Jul 2016 14:58:25 +0200 | |
changeset 3997 | 856722248c9f |
parent 1651 | 020ab0e0ae2f |
child 4197 | 51449951faf2 |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
84 | 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 |
" |
|
3997 | 12 |
"{ Package: 'stx:libbasic2' }" |
0 | 13 |
|
3997 | 14 |
"{ NameSpace: Smalltalk }" |
1317 | 15 |
|
0 | 16 |
PrinterStream subclass:#EpsonFX1PrinterStream |
259 | 17 |
instanceVariableNames:'' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
1651 | 20 |
category:'Interface-Printing' |
0 | 21 |
! |
22 |
||
1317 | 23 |
!EpsonFX1PrinterStream class methodsFor:'documentation'! |
31 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
84 | 28 |
All Rights Reserved |
2 | 29 |
|
31 | 30 |
This software is furnished under a license and may be used |
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
0 | 38 |
|
31 | 39 |
documentation |
40 |
" |
|
348 | 41 |
This class defines protocol for simple text printing on an Epson-FX1 |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
42 |
(and compatible) printer. |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
43 |
It does not support multiple fonts, but knows how to print bold, italic etc. |
31 | 44 |
|
348 | 45 |
Graphics printing is not supported - you need a postscriptprinter for this. |
46 |
||
31 | 47 |
I cannot tell, if this is really an Epson - |
348 | 48 |
all I had to test was a Citizen 120D - its documentation claims it to be |
49 |
FX1 compatible. |
|
50 |
||
51 |
Notice: |
|
52 |
This class only defines some minimum protocol for printing on |
|
53 |
Epsons - you really should use a PostscriptPrinter ... |
|
54 |
... however, if you own an Epson, here is some class to start with. |
|
55 |
It may need to be enhanced at some places (for example: provide more |
|
56 |
fonts/emphasis's; better international character translation etc.) |
|
57 |
||
58 |
This class is not officially supported - take it or leave it. |
|
259 | 59 |
|
60 |
[author:] |
|
61 |
Claus Gittinger |
|
31 | 62 |
" |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
63 |
! ! |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
64 |
|
1317 | 65 |
!EpsonFX1PrinterStream class methodsFor:'initialization'! |
441 | 66 |
|
67 |
initialize |
|
68 |
DefaultCommands := #('lpr' |
|
69 |
'lpr -P<your-printer>' |
|
70 |
'cat | rsh <printHost> lpr -h' |
|
71 |
). |
|
72 |
super initialize |
|
73 |
||
74 |
" |
|
75 |
self initialize |
|
76 |
" |
|
77 |
! ! |
|
78 |
||
1317 | 79 |
!EpsonFX1PrinterStream class methodsFor:'queries'! |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
80 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
81 |
printerTypeName |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
82 |
"return a descriptive name" |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
83 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
84 |
^ 'Epson FX1 compatible printer' |
0 | 85 |
! ! |
86 |
||
87 |
!EpsonFX1PrinterStream methodsFor:'access writing'! |
|
88 |
||
348 | 89 |
cr |
90 |
"send a carriage return (newLine). |
|
91 |
We have to output cr-nl here" |
|
92 |
||
93 |
super nextPutUntranslated:(Character value:13). |
|
94 |
super nextPutUntranslated:(Character value:10). |
|
370 | 95 |
self spaces:self class leftMargin |
348 | 96 |
|
370 | 97 |
"Modified: 1.6.1996 / 00:13:39 / cg" |
348 | 98 |
! |
99 |
||
100 |
nextPut:aCharacter |
|
101 |
"send aCharacter to the printer. |
|
102 |
Catch special characters |
|
103 |
- currently only german umlauts are handled - If you own this type |
|
104 |
of printer and depend on it, add more translation here ..." |
|
105 |
||
106 |
|ascii| |
|
107 |
||
3997 | 108 |
ascii := aCharacter codePoint. |
348 | 109 |
(ascii < 128) ifTrue:[ |
1317 | 110 |
^ stream nextPut:aCharacter |
348 | 111 |
]. |
112 |
(ascii == 16rfc) ifTrue:[ "udiaeresis" |
|
113 |
^ self character:$} fromCharacterSet:2 |
|
114 |
]. |
|
115 |
(ascii == 16re4) ifTrue:[ "adiaeresis" |
|
116 |
^ self character:${ fromCharacterSet:2 |
|
117 |
]. |
|
118 |
(ascii == 16rf6) ifTrue:[ "odiaeresis" |
|
119 |
^ self character:$| fromCharacterSet:2 |
|
120 |
]. |
|
121 |
(ascii == 16rdc) ifTrue:[ "Udiaeresis" |
|
122 |
^ self character:$] fromCharacterSet:2 |
|
123 |
]. |
|
124 |
(ascii == 16rc4) ifTrue:[ "Adiaeresis" |
|
125 |
^ self character:$[ fromCharacterSet:2 |
|
126 |
]. |
|
127 |
(ascii == 16rd6) ifTrue:[ "Odiaeresis" |
|
128 |
^ self character:$\ fromCharacterSet:2 |
|
129 |
]. |
|
130 |
(ascii == 16rdf) ifTrue:[ "ssharp" |
|
131 |
^ self character:$~ fromCharacterSet:2 |
|
132 |
] |
|
133 |
||
134 |
"Modified: 18.5.1996 / 09:03:18 / cg" |
|
135 |
! ! |
|
136 |
||
137 |
!EpsonFX1PrinterStream methodsFor:'emphasis change'! |
|
138 |
||
126 | 139 |
bold |
348 | 140 |
"set emphasis to bold" |
126 | 141 |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
142 |
"send: <ESC>G " |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
143 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
144 |
super escape:$G |
348 | 145 |
|
146 |
"Modified: 18.5.1996 / 09:03:31 / cg" |
|
126 | 147 |
! |
148 |
||
348 | 149 |
italic |
150 |
"set emphasis to italic" |
|
151 |
||
152 |
"send: <ESC>4 will do that" |
|
153 |
||
154 |
super escape:$4 |
|
155 |
||
156 |
"Modified: 18.5.1996 / 09:03:33 / cg" |
|
157 |
! |
|
158 |
||
159 |
normal |
|
160 |
"set emphasis to normal" |
|
161 |
||
162 |
"send: <ESC>H<ESC>5" |
|
163 |
||
164 |
super escape:$H. super escape:$5 |
|
165 |
||
166 |
"Modified: 18.5.1996 / 09:03:35 / cg" |
|
167 |
! ! |
|
168 |
||
169 |
!EpsonFX1PrinterStream methodsFor:'layout'! |
|
170 |
||
171 |
linesPerPage:n |
|
172 |
"change the lines-per-page setting" |
|
173 |
||
174 |
"send: <ESC>C<n>" |
|
175 |
||
176 |
super escape:$C. |
|
177 |
super nextPut:(Character value:n) |
|
178 |
||
179 |
"Modified: 18.5.1996 / 09:03:50 / cg" |
|
180 |
! |
|
181 |
||
182 |
newPage |
|
183 |
"force a newPage" |
|
184 |
||
185 |
super nextPut:(Character value:12) |
|
186 |
||
187 |
"Modified: 18.5.1996 / 09:04:04 / cg" |
|
188 |
! |
|
189 |
||
190 |
noTopMargin |
|
191 |
"turn off topMargin in the printer" |
|
192 |
||
193 |
"send <ESC>0" |
|
194 |
||
195 |
super escape:$O |
|
196 |
||
197 |
"Modified: 18.5.1996 / 09:04:19 / cg" |
|
198 |
! |
|
199 |
||
200 |
pageHeight:inches |
|
201 |
"set the pageHeight in inches" |
|
202 |
||
203 |
"send <ESC>G<0><inch>" |
|
204 |
||
205 |
super escape:$C. |
|
206 |
super nextPut:(Character value:0). |
|
207 |
super nextPut:(Character value:inches) |
|
208 |
||
209 |
"Modified: 18.5.1996 / 09:04:38 / cg" |
|
210 |
! |
|
211 |
||
212 |
proportional:aBoolean |
|
213 |
"turn on/off proportional printing" |
|
214 |
||
215 |
"send <ESC>p0 or <ESC>p1" |
|
216 |
||
217 |
super escape:$p. |
|
218 |
super nextPut:(aBoolean ifTrue:[$1] ifFalse:[$0]) |
|
219 |
||
220 |
"Modified: 18.5.1996 / 09:05:18 / cg" |
|
221 |
! |
|
222 |
||
223 |
reset |
|
224 |
"reset the printer - send <ESC>@" |
|
225 |
||
226 |
super escape:$@ |
|
227 |
||
228 |
"Modified: 18.5.1996 / 09:05:27 / cg" |
|
229 |
! |
|
230 |
||
231 |
topMargin:n |
|
232 |
"set the topMargin" |
|
233 |
||
234 |
"send <ESC>N<n>" |
|
235 |
||
236 |
super escape:$N. |
|
237 |
super nextPut:(Character value:n) |
|
238 |
||
239 |
"Modified: 18.5.1996 / 09:05:43 / cg" |
|
240 |
! ! |
|
241 |
||
242 |
!EpsonFX1PrinterStream methodsFor:'private'! |
|
243 |
||
0 | 244 |
character:char fromCharacterSet:set |
6 | 245 |
"send a character from an alternate character set" |
246 |
||
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
247 |
"send: <ESC>R<set><char><ESC>R<0>" |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
248 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
249 |
super escape:$R. |
0 | 250 |
super nextPut:(Character value:set). |
251 |
super nextPut:char. |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
252 |
super escape:$R. |
0 | 253 |
super nextPut:(Character value:0) |
126 | 254 |
! ! |
259 | 255 |
|
1317 | 256 |
!EpsonFX1PrinterStream class methodsFor:'documentation'! |
259 | 257 |
|
258 |
version |
|
3997 | 259 |
^ '$Header$' |
259 | 260 |
! ! |
1317 | 261 |
|
3997 | 262 |
|
441 | 263 |
EpsonFX1PrinterStream initialize! |