author | Claus Gittinger <cg@exept.de> |
Sat, 01 Jun 1996 00:21:49 +0200 | |
changeset 370 | 705453f00711 |
parent 348 | e4790af5d077 |
child 441 | dbbbefa3beae |
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 |
||
31 | 20 |
!EpsonFX1PrinterStream class methodsFor:'documentation'! |
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 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
62 |
!EpsonFX1PrinterStream class methodsFor:'queries'! |
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 |
printerTypeName |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
65 |
"return a descriptive name" |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
66 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
67 |
^ 'Epson FX1 compatible printer' |
0 | 68 |
! ! |
69 |
||
70 |
!EpsonFX1PrinterStream methodsFor:'access writing'! |
|
71 |
||
348 | 72 |
cr |
73 |
"send a carriage return (newLine). |
|
74 |
We have to output cr-nl here" |
|
75 |
||
76 |
super nextPutUntranslated:(Character value:13). |
|
77 |
super nextPutUntranslated:(Character value:10). |
|
370 | 78 |
self spaces:self class leftMargin |
348 | 79 |
|
370 | 80 |
"Modified: 1.6.1996 / 00:13:39 / cg" |
348 | 81 |
! |
82 |
||
83 |
nextPut:aCharacter |
|
84 |
"send aCharacter to the printer. |
|
85 |
Catch special characters |
|
86 |
- currently only german umlauts are handled - If you own this type |
|
87 |
of printer and depend on it, add more translation here ..." |
|
88 |
||
89 |
|ascii| |
|
90 |
||
91 |
ascii := aCharacter asciiValue. |
|
92 |
(ascii < 128) ifTrue:[ |
|
93 |
^ super nextPut:aCharacter |
|
94 |
]. |
|
95 |
(ascii == 16rfc) ifTrue:[ "udiaeresis" |
|
96 |
^ self character:$} fromCharacterSet:2 |
|
97 |
]. |
|
98 |
(ascii == 16re4) ifTrue:[ "adiaeresis" |
|
99 |
^ self character:${ fromCharacterSet:2 |
|
100 |
]. |
|
101 |
(ascii == 16rf6) ifTrue:[ "odiaeresis" |
|
102 |
^ self character:$| fromCharacterSet:2 |
|
103 |
]. |
|
104 |
(ascii == 16rdc) ifTrue:[ "Udiaeresis" |
|
105 |
^ self character:$] fromCharacterSet:2 |
|
106 |
]. |
|
107 |
(ascii == 16rc4) ifTrue:[ "Adiaeresis" |
|
108 |
^ self character:$[ fromCharacterSet:2 |
|
109 |
]. |
|
110 |
(ascii == 16rd6) ifTrue:[ "Odiaeresis" |
|
111 |
^ self character:$\ fromCharacterSet:2 |
|
112 |
]. |
|
113 |
(ascii == 16rdf) ifTrue:[ "ssharp" |
|
114 |
^ self character:$~ fromCharacterSet:2 |
|
115 |
] |
|
116 |
||
117 |
"Modified: 18.5.1996 / 09:03:18 / cg" |
|
118 |
! ! |
|
119 |
||
120 |
!EpsonFX1PrinterStream methodsFor:'emphasis change'! |
|
121 |
||
126 | 122 |
bold |
348 | 123 |
"set emphasis to bold" |
126 | 124 |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
125 |
"send: <ESC>G " |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
126 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
127 |
super escape:$G |
348 | 128 |
|
129 |
"Modified: 18.5.1996 / 09:03:31 / cg" |
|
126 | 130 |
! |
131 |
||
348 | 132 |
italic |
133 |
"set emphasis to italic" |
|
134 |
||
135 |
"send: <ESC>4 will do that" |
|
136 |
||
137 |
super escape:$4 |
|
138 |
||
139 |
"Modified: 18.5.1996 / 09:03:33 / cg" |
|
140 |
! |
|
141 |
||
142 |
normal |
|
143 |
"set emphasis to normal" |
|
144 |
||
145 |
"send: <ESC>H<ESC>5" |
|
146 |
||
147 |
super escape:$H. super escape:$5 |
|
148 |
||
149 |
"Modified: 18.5.1996 / 09:03:35 / cg" |
|
150 |
! ! |
|
151 |
||
152 |
!EpsonFX1PrinterStream methodsFor:'layout'! |
|
153 |
||
154 |
linesPerPage:n |
|
155 |
"change the lines-per-page setting" |
|
156 |
||
157 |
"send: <ESC>C<n>" |
|
158 |
||
159 |
super escape:$C. |
|
160 |
super nextPut:(Character value:n) |
|
161 |
||
162 |
"Modified: 18.5.1996 / 09:03:50 / cg" |
|
163 |
! |
|
164 |
||
165 |
newPage |
|
166 |
"force a newPage" |
|
167 |
||
168 |
super nextPut:(Character value:12) |
|
169 |
||
170 |
"Modified: 18.5.1996 / 09:04:04 / cg" |
|
171 |
! |
|
172 |
||
173 |
noTopMargin |
|
174 |
"turn off topMargin in the printer" |
|
175 |
||
176 |
"send <ESC>0" |
|
177 |
||
178 |
super escape:$O |
|
179 |
||
180 |
"Modified: 18.5.1996 / 09:04:19 / cg" |
|
181 |
! |
|
182 |
||
183 |
pageHeight:inches |
|
184 |
"set the pageHeight in inches" |
|
185 |
||
186 |
"send <ESC>G<0><inch>" |
|
187 |
||
188 |
super escape:$C. |
|
189 |
super nextPut:(Character value:0). |
|
190 |
super nextPut:(Character value:inches) |
|
191 |
||
192 |
"Modified: 18.5.1996 / 09:04:38 / cg" |
|
193 |
! |
|
194 |
||
195 |
proportional:aBoolean |
|
196 |
"turn on/off proportional printing" |
|
197 |
||
198 |
"send <ESC>p0 or <ESC>p1" |
|
199 |
||
200 |
super escape:$p. |
|
201 |
super nextPut:(aBoolean ifTrue:[$1] ifFalse:[$0]) |
|
202 |
||
203 |
"Modified: 18.5.1996 / 09:05:18 / cg" |
|
204 |
! |
|
205 |
||
206 |
reset |
|
207 |
"reset the printer - send <ESC>@" |
|
208 |
||
209 |
super escape:$@ |
|
210 |
||
211 |
"Modified: 18.5.1996 / 09:05:27 / cg" |
|
212 |
! |
|
213 |
||
214 |
topMargin:n |
|
215 |
"set the topMargin" |
|
216 |
||
217 |
"send <ESC>N<n>" |
|
218 |
||
219 |
super escape:$N. |
|
220 |
super nextPut:(Character value:n) |
|
221 |
||
222 |
"Modified: 18.5.1996 / 09:05:43 / cg" |
|
223 |
! ! |
|
224 |
||
225 |
!EpsonFX1PrinterStream methodsFor:'private'! |
|
226 |
||
0 | 227 |
character:char fromCharacterSet:set |
6 | 228 |
"send a character from an alternate character set" |
229 |
||
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
230 |
"send: <ESC>R<set><char><ESC>R<0>" |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
231 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
232 |
super escape:$R. |
0 | 233 |
super nextPut:(Character value:set). |
234 |
super nextPut:char. |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
235 |
super escape:$R. |
0 | 236 |
super nextPut:(Character value:0) |
126 | 237 |
! ! |
259 | 238 |
|
239 |
!EpsonFX1PrinterStream class methodsFor:'documentation'! |
|
240 |
||
241 |
version |
|
370 | 242 |
^ '$Header: /cvs/stx/stx/libbasic2/EpsonFX1PrinterStream.st,v 1.16 1996-05-31 22:21:41 cg Exp $' |
259 | 243 |
! ! |