0
|
1 |
"
|
4
|
2 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
0
|
3 |
All Rights Reserved
|
|
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
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Streams-External'
|
|
18 |
!
|
|
19 |
|
|
20 |
EpsonFX1PrinterStream comment:'
|
31
|
21 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
|
22 |
All Rights Reserved
|
|
23 |
'!
|
2
|
24 |
|
31
|
25 |
!EpsonFX1PrinterStream class methodsFor:'documentation'!
|
|
26 |
|
|
27 |
copyright
|
|
28 |
"
|
|
29 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
2
|
30 |
All Rights Reserved
|
|
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 |
version
|
|
42 |
"
|
|
43 |
$Header: /cvs/stx/stx/libbasic2/EpsonFX1PrinterStream.st,v 1.7 1994-06-02 17:19:41 claus Exp $
|
|
44 |
"
|
|
45 |
!
|
0
|
46 |
|
31
|
47 |
documentation
|
|
48 |
"
|
|
49 |
This class defines protocol for simple text prinitng on an Epson-FX1
|
|
50 |
(and compatible) printer. It knows the escape codes for bold, italic etc.
|
|
51 |
|
|
52 |
I cannot tell, if this is really an Epson -
|
|
53 |
all I have is a Citizen 120D to test - the doc says its an FX1.
|
|
54 |
"
|
|
55 |
! !
|
0
|
56 |
|
|
57 |
!EpsonFX1PrinterStream methodsFor:'layout'!
|
|
58 |
|
|
59 |
reset
|
|
60 |
super nextPut:(Character esc).
|
|
61 |
super nextPut:$@
|
|
62 |
!
|
|
63 |
|
|
64 |
pageHeight:inch
|
|
65 |
super nextPut:(Character esc).
|
|
66 |
super nextPut:$C.
|
|
67 |
super nextPut:(Character value:0).
|
|
68 |
super nextPut:(Character value:inch)
|
|
69 |
!
|
|
70 |
|
|
71 |
linesPerPage:n
|
|
72 |
super nextPut:(Character esc).
|
|
73 |
super nextPut:$C.
|
|
74 |
super nextPut:(Character value:n)
|
|
75 |
!
|
|
76 |
|
|
77 |
noTopMargin
|
|
78 |
super nextPut:(Character esc).
|
|
79 |
super nextPut:$O
|
|
80 |
!
|
|
81 |
|
|
82 |
topMargin:n
|
|
83 |
super nextPut:(Character esc).
|
|
84 |
super nextPut:$N.
|
|
85 |
super nextPut:(Character value:n)
|
|
86 |
!
|
|
87 |
|
|
88 |
proportional:aBoolean
|
|
89 |
super nextPut:(Character esc).
|
|
90 |
super nextPut:$p.
|
|
91 |
aBoolean ifTrue:[
|
|
92 |
super nextPut:$1
|
|
93 |
] ifFalse:[
|
|
94 |
super nextPut:$0
|
|
95 |
]
|
|
96 |
!
|
|
97 |
|
|
98 |
newPage
|
|
99 |
super nextPut:(Character value:12)
|
|
100 |
! !
|
|
101 |
|
|
102 |
!EpsonFX1PrinterStream methodsFor:'access writing'!
|
|
103 |
|
|
104 |
character:char fromCharacterSet:set
|
6
|
105 |
"send a character from an alternate character set"
|
|
106 |
|
|
107 |
"send <ESC>R<set><char><ESC>R<\0>"
|
0
|
108 |
super nextPut:(Character esc).
|
|
109 |
super nextPut:$R.
|
|
110 |
super nextPut:(Character value:set).
|
|
111 |
super nextPut:char.
|
|
112 |
super nextPut:(Character esc).
|
|
113 |
super nextPut:$R.
|
|
114 |
super nextPut:(Character value:0)
|
|
115 |
!
|
|
116 |
|
|
117 |
nextPut:aCharacter
|
6
|
118 |
"catch special characters
|
|
119 |
- currently only german umlauts are handled - needs more"
|
|
120 |
|
0
|
121 |
|ascii|
|
|
122 |
|
|
123 |
ascii := aCharacter asciiValue.
|
|
124 |
(ascii < 128) ifTrue:[
|
|
125 |
^ super nextPut:aCharacter
|
|
126 |
].
|
|
127 |
(ascii == 16rfc) ifTrue:[ "udiaeresis"
|
|
128 |
^ self character:$} fromCharacterSet:2
|
|
129 |
].
|
|
130 |
(ascii == 16re4) ifTrue:[ "adiaeresis"
|
|
131 |
^ self character:${ fromCharacterSet:2
|
|
132 |
].
|
|
133 |
(ascii == 16rf6) ifTrue:[ "odiaeresis"
|
|
134 |
^ self character:$| fromCharacterSet:2
|
|
135 |
].
|
|
136 |
(ascii == 16rdc) ifTrue:[ "Udiaeresis"
|
|
137 |
^ self character:$] fromCharacterSet:2
|
|
138 |
].
|
|
139 |
(ascii == 16rc4) ifTrue:[ "Adiaeresis"
|
|
140 |
^ self character:$[ fromCharacterSet:2
|
|
141 |
].
|
|
142 |
(ascii == 16rd6) ifTrue:[ "Odiaeresis"
|
|
143 |
^ self character:$\ fromCharacterSet:2
|
|
144 |
].
|
|
145 |
(ascii == 16rdf) ifTrue:[ "ssharp"
|
|
146 |
^ self character:$~ fromCharacterSet:2
|
|
147 |
]
|
|
148 |
!
|
|
149 |
|
|
150 |
cr
|
|
151 |
"have to output cr-nl here"
|
|
152 |
|
|
153 |
super nextPutUntranslated:(Character value:13).
|
|
154 |
super nextPutUntranslated:(Character value:10).
|
9
|
155 |
self spaces:LeftMargin
|
0
|
156 |
!
|
|
157 |
|
|
158 |
bold
|
6
|
159 |
"set font to bold"
|
0
|
160 |
|
6
|
161 |
"send <ESC>G will do that"
|
0
|
162 |
super nextPut:(Character esc).
|
|
163 |
super nextPutAll:'G'
|
|
164 |
!
|
|
165 |
|
|
166 |
italic
|
6
|
167 |
"set font to italic"
|
0
|
168 |
|
6
|
169 |
"send <ESC>4 will do that"
|
0
|
170 |
super nextPut:(Character esc).
|
|
171 |
super nextPutAll:'4'
|
|
172 |
!
|
|
173 |
|
|
174 |
normal
|
6
|
175 |
"set font to normal"
|
0
|
176 |
|
6
|
177 |
"send <ESC>H<ESC>5 will do that"
|
0
|
178 |
super nextPut:(Character esc).
|
|
179 |
super nextPutAll:'H'.
|
|
180 |
super nextPut:(Character esc).
|
|
181 |
super nextPutAll:'5'
|
|
182 |
! !
|