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