EpsonFX1PrinterStream.st
author Claus Gittinger <cg@exept.de>
Fri, 02 Feb 1996 20:53:52 +0100
changeset 179 38773360f4b7
parent 126 fca9404da9d4
child 259 6d36f3ac42a2
permissions -rw-r--r--
more on printing (printerType-query)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     1
"
4
1f66800df351 *** empty log message ***
claus
parents: 2
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
84
claus
parents: 36
diff changeset
     3
	      All Rights Reserved
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     4
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    11
"
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    12
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    13
PrinterStream subclass:#EpsonFX1PrinterStream
84
claus
parents: 36
diff changeset
    14
	 instanceVariableNames:''
claus
parents: 36
diff changeset
    15
	 classVariableNames:''
claus
parents: 36
diff changeset
    16
	 poolDictionaries:''
claus
parents: 36
diff changeset
    17
	 category:'Streams-External'
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    18
!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    19
31
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    20
!EpsonFX1PrinterStream class methodsFor:'documentation'!
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    21
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    22
copyright
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    23
"
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    24
 COPYRIGHT (c) 1991 by Claus Gittinger
84
claus
parents: 36
diff changeset
    25
	      All Rights Reserved
2
07d9ee98e092 *** empty log message ***
claus
parents: 0
diff changeset
    26
31
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    27
 This software is furnished under a license and may be used
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    28
 only in accordance with the terms of that license and with the
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    30
 be provided or otherwise made available to, or used by, any
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    31
 other person.  No title to or ownership of the software is
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    32
 hereby transferred.
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    33
"
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    34
!
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    35
31
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    36
documentation
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    37
"
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    38
    This class defines protocol for simple text prinitng 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
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    41
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    42
    I cannot tell, if this is really an Epson -
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    43
    all I had to test was a Citizen 120D - its documentation claims it to be FX1 compatible.
31
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    44
"
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    45
!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    46
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    47
version
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    48
    ^ '$Header: /cvs/stx/stx/libbasic2/EpsonFX1PrinterStream.st,v 1.13 1996-02-02 19:53:47 cg Exp $'
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    49
! !
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    50
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    51
!EpsonFX1PrinterStream class methodsFor:'queries'!
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    52
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    53
printerTypeName
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    54
    "return a descriptive name"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    55
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    56
    ^ 'Epson FX1 compatible printer'
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    57
! !
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    58
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    59
!EpsonFX1PrinterStream methodsFor:'access writing'!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    60
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    61
bold
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    62
    "set font to bold"
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    63
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    64
    "send: <ESC>G "
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    65
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    66
    super escape:$G
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    67
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    68
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    69
character:char fromCharacterSet:set
6
claus
parents: 4
diff changeset
    70
    "send a character from an alternate character set"
claus
parents: 4
diff changeset
    71
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    72
    "send: <ESC>R<set><char><ESC>R<0>"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    73
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    74
    super escape:$R.
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    75
    super nextPut:(Character value:set).
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    76
    super nextPut:char.
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    77
    super escape:$R.
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    78
    super nextPut:(Character value:0)
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    79
!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    80
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    81
cr
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    82
    "have to output cr-nl here"
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    83
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    84
    super nextPutUntranslated:(Character value:13).
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    85
    super nextPutUntranslated:(Character value:10).
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    86
    self spaces:LeftMargin
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    87
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    88
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    89
italic
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    90
    "set font to italic"
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    91
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    92
    "send: <ESC>4 will do that"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    93
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    94
    super escape:$4
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    95
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    96
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    97
nextPut:aCharacter
6
claus
parents: 4
diff changeset
    98
    "catch special characters 
claus
parents: 4
diff changeset
    99
     - currently only german umlauts are handled - needs more"
claus
parents: 4
diff changeset
   100
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   101
    |ascii|
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   102
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   103
    ascii := aCharacter asciiValue.
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   104
    (ascii < 128) ifTrue:[
84
claus
parents: 36
diff changeset
   105
	^ super nextPut:aCharacter
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   106
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   107
    (ascii == 16rfc) ifTrue:[   "udiaeresis"
84
claus
parents: 36
diff changeset
   108
	^ self character:$} fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   109
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   110
    (ascii == 16re4) ifTrue:[   "adiaeresis"
84
claus
parents: 36
diff changeset
   111
	^ self character:${ fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   112
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   113
    (ascii == 16rf6) ifTrue:[   "odiaeresis"
84
claus
parents: 36
diff changeset
   114
	^ self character:$| fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   115
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   116
    (ascii == 16rdc) ifTrue:[   "Udiaeresis"
84
claus
parents: 36
diff changeset
   117
	^ self character:$] fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   118
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   119
    (ascii == 16rc4) ifTrue:[   "Adiaeresis"
84
claus
parents: 36
diff changeset
   120
	^ self character:$[ fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   121
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   122
    (ascii == 16rd6) ifTrue:[   "Odiaeresis"
84
claus
parents: 36
diff changeset
   123
	^ self character:$\ fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   124
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   125
    (ascii == 16rdf) ifTrue:[   "ssharp"
84
claus
parents: 36
diff changeset
   126
	^ self character:$~ fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   127
    ]
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   128
!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   129
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   130
normal
6
claus
parents: 4
diff changeset
   131
    "set font to normal"
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   132
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   133
    "send: <ESC>H<ESC>5"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   134
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   135
    super escape:$H. super escape:$5
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   136
! !
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   137
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   138
!EpsonFX1PrinterStream methodsFor:'layout'!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   139
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   140
linesPerPage:n
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   141
    "send: <ESC>C<n>"
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:$C.
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   144
    super nextPut:(Character value:n)
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   145
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   146
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   147
newPage
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   148
    super nextPut:(Character value:12)
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   149
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   150
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   151
noTopMargin
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   152
    "send <ESC>0"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   153
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   154
    super escape:$O
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   155
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   156
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   157
pageHeight:inch
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   158
    "send <ESC>G<0><inch>"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   159
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   160
    super escape:$C.
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   161
    super nextPut:(Character value:0).
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   162
    super nextPut:(Character value:inch)
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   163
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   164
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   165
proportional:aBoolean
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   166
    "send <ESC>p0 or <ESC>p1"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   167
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   168
    super escape:$p.
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   169
    aBoolean ifTrue:[
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   170
	super nextPut:$1
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   171
    ] ifFalse:[
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   172
	super nextPut:$0
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   173
    ]
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   174
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   175
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   176
reset
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   177
    "send <ESC>@"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   178
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   179
    super escape:$@
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   180
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   181
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   182
topMargin:n
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   183
    "send <ESC>N<n>"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   184
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   185
    super escape:$N.
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   186
    super nextPut:(Character value:n)
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   187
! !