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