author | Claus Gittinger <cg@exept.de> |
Sat, 02 May 2020 21:40:13 +0200 | |
changeset 5476 | 7355a4b11cb6 |
parent 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. |
5173 | 111 |
Answer aCharacter. |
348 | 112 |
- currently only german umlauts are handled - If you own this type |
5145 | 113 |
of printer and depend on it, add more translation here. |
114 |
See https://files.support.epson.com/pdf/fx100_/fx100_u1.pdf table6.2." |
|
348 | 115 |
|
5145 | 116 |
|ascii xLation| |
348 | 117 |
|
3997 | 118 |
ascii := aCharacter codePoint. |
348 | 119 |
(ascii < 128) ifTrue:[ |
5145 | 120 |
stream nextPut:aCharacter. |
5173 | 121 |
^ aCharacter. |
348 | 122 |
]. |
5145 | 123 |
xLation := #( |
124 |
"/ german |
|
125 |
($ä ${ 2 ) "adiaeresis" |
|
126 |
($ö $| 2 ) "odiaeresis" |
|
127 |
($ü $} 2 ) "udiaeresis" |
|
128 |
($Ä $[ 2 ) "Adiaeresis" |
|
129 |
($Ö $\ 2 ) "Odiaeresis" |
|
130 |
($Ü $] 2 ) "Udiaeresis" |
|
131 |
($ß $~ 2 ) "ssharp" |
|
132 |
||
133 |
"/ france |
|
134 |
($Ã $@ 1 ) "a-grave" |
|
135 |
($é ${ 1 ) "e-aigu" |
|
136 |
($ú $| 1 ) "u-aigu" |
|
137 |
($è ${ 1 ) "e-grave" |
|
138 |
($ç $\ 1 ) "c-cedille" |
|
139 |
||
140 |
"/ italy |
|
141 |
($ò $| 6 ) "o-grave" |
|
142 |
($ì $~ 6 ) "i-grave" |
|
143 |
||
144 |
"/ spain |
|
145 |
($Ñ $\ 7 ) "N-tilde" |
|
146 |
($ñ $| 7 ) "n-tilde" |
|
147 |
($¿ $] 7 ) "question" |
|
148 |
||
149 |
"/ british |
|
150 |
($£ $# 3 ) "pound" |
|
151 |
"/ japan |
|
152 |
($Â¥ $\ 8 ) "Yen" |
|
153 |
) detect:[:pair | pair first == aCharacter] ifNone:nil. |
|
154 |
||
155 |
xLation notNil ifTrue:[ |
|
156 |
self character:(xLation second) fromCharacterSet:(xLation third) |
|
348 | 157 |
]. |
5173 | 158 |
^ aCharacter |
348 | 159 |
|
160 |
"Modified: 18.5.1996 / 09:03:18 / cg" |
|
161 |
! ! |
|
162 |
||
163 |
!EpsonFX1PrinterStream methodsFor:'emphasis change'! |
|
164 |
||
126 | 165 |
bold |
348 | 166 |
"set emphasis to bold" |
126 | 167 |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
168 |
"send: <ESC>G " |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
169 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
170 |
super escape:$G |
348 | 171 |
|
172 |
"Modified: 18.5.1996 / 09:03:31 / cg" |
|
126 | 173 |
! |
174 |
||
348 | 175 |
italic |
176 |
"set emphasis to italic" |
|
177 |
||
178 |
"send: <ESC>4 will do that" |
|
179 |
||
180 |
super escape:$4 |
|
181 |
||
182 |
"Modified: 18.5.1996 / 09:03:33 / cg" |
|
183 |
! |
|
184 |
||
185 |
normal |
|
186 |
"set emphasis to normal" |
|
187 |
||
188 |
"send: <ESC>H<ESC>5" |
|
189 |
||
190 |
super escape:$H. super escape:$5 |
|
191 |
||
192 |
"Modified: 18.5.1996 / 09:03:35 / cg" |
|
193 |
! ! |
|
194 |
||
195 |
!EpsonFX1PrinterStream methodsFor:'layout'! |
|
196 |
||
197 |
linesPerPage:n |
|
198 |
"change the lines-per-page setting" |
|
199 |
||
200 |
"send: <ESC>C<n>" |
|
201 |
||
202 |
super escape:$C. |
|
203 |
super nextPut:(Character value:n) |
|
204 |
||
205 |
"Modified: 18.5.1996 / 09:03:50 / cg" |
|
206 |
! |
|
207 |
||
208 |
newPage |
|
209 |
"force a newPage" |
|
210 |
||
211 |
super nextPut:(Character value:12) |
|
212 |
||
213 |
"Modified: 18.5.1996 / 09:04:04 / cg" |
|
214 |
! |
|
215 |
||
216 |
noTopMargin |
|
217 |
"turn off topMargin in the printer" |
|
218 |
||
219 |
"send <ESC>0" |
|
220 |
||
221 |
super escape:$O |
|
222 |
||
223 |
"Modified: 18.5.1996 / 09:04:19 / cg" |
|
224 |
! |
|
225 |
||
226 |
pageHeight:inches |
|
227 |
"set the pageHeight in inches" |
|
228 |
||
229 |
"send <ESC>G<0><inch>" |
|
230 |
||
231 |
super escape:$C. |
|
232 |
super nextPut:(Character value:0). |
|
233 |
super nextPut:(Character value:inches) |
|
234 |
||
235 |
"Modified: 18.5.1996 / 09:04:38 / cg" |
|
236 |
! |
|
237 |
||
238 |
proportional:aBoolean |
|
239 |
"turn on/off proportional printing" |
|
240 |
||
241 |
"send <ESC>p0 or <ESC>p1" |
|
242 |
||
243 |
super escape:$p. |
|
244 |
super nextPut:(aBoolean ifTrue:[$1] ifFalse:[$0]) |
|
245 |
||
246 |
"Modified: 18.5.1996 / 09:05:18 / cg" |
|
247 |
! |
|
248 |
||
249 |
reset |
|
250 |
"reset the printer - send <ESC>@" |
|
251 |
||
252 |
super escape:$@ |
|
253 |
||
254 |
"Modified: 18.5.1996 / 09:05:27 / cg" |
|
255 |
! |
|
256 |
||
257 |
topMargin:n |
|
258 |
"set the topMargin" |
|
259 |
||
260 |
"send <ESC>N<n>" |
|
261 |
||
262 |
super escape:$N. |
|
263 |
super nextPut:(Character value:n) |
|
264 |
||
265 |
"Modified: 18.5.1996 / 09:05:43 / cg" |
|
266 |
! ! |
|
267 |
||
268 |
!EpsonFX1PrinterStream methodsFor:'private'! |
|
269 |
||
0 | 270 |
character:char fromCharacterSet:set |
6 | 271 |
"send a character from an alternate character set" |
272 |
||
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
273 |
"send: <ESC>R<set><char><ESC>R<0>" |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
274 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
275 |
super escape:$R. |
0 | 276 |
super nextPut:(Character value:set). |
277 |
super nextPut:char. |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
278 |
super escape:$R. |
0 | 279 |
super nextPut:(Character value:0) |
126 | 280 |
! ! |
259 | 281 |
|
1317 | 282 |
!EpsonFX1PrinterStream class methodsFor:'documentation'! |
259 | 283 |
|
284 |
version |
|
3997 | 285 |
^ '$Header$' |
259 | 286 |
! ! |
1317 | 287 |
|
3997 | 288 |
|
441 | 289 |
EpsonFX1PrinterStream initialize! |