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