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