EpsonFX1PrinterStream.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 19:02:29 +0200
changeset 259 6d36f3ac42a2
parent 179 38773360f4b7
child 348 e4790af5d077
permissions -rw-r--r--
documentation
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
259
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    14
	instanceVariableNames:''
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    15
	classVariableNames:''
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    16
	poolDictionaries:''
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
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.
259
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    44
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    45
    [author:]
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    46
        Claus Gittinger
31
e223f3cf2995 *** empty log message ***
claus
parents: 9
diff changeset
    47
"
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    48
! !
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
!EpsonFX1PrinterStream class methodsFor:'queries'!
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    51
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    52
printerTypeName
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    53
    "return a descriptive name"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    54
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    55
    ^ 'Epson FX1 compatible printer'
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    56
! !
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    57
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    58
!EpsonFX1PrinterStream methodsFor:'access writing'!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    59
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    60
bold
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    61
    "set font to bold"
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    62
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    63
    "send: <ESC>G "
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    64
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    65
    super escape:$G
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    66
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    67
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    68
character:char fromCharacterSet:set
6
claus
parents: 4
diff changeset
    69
    "send a character from an alternate character set"
claus
parents: 4
diff changeset
    70
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    71
    "send: <ESC>R<set><char><ESC>R<0>"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    72
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    73
    super escape:$R.
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    74
    super nextPut:(Character value:set).
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    75
    super nextPut:char.
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    76
    super escape:$R.
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    77
    super nextPut:(Character value:0)
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    78
!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    79
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    80
cr
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    81
    "have to output cr-nl here"
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    82
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    83
    super nextPutUntranslated:(Character value:13).
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    84
    super nextPutUntranslated:(Character value:10).
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    85
    self spaces:LeftMargin
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    86
!
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
italic
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    89
    "set font to italic"
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    90
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    91
    "send: <ESC>4 will do that"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    92
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    93
    super escape:$4
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    94
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    95
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    96
nextPut:aCharacter
6
claus
parents: 4
diff changeset
    97
    "catch special characters 
claus
parents: 4
diff changeset
    98
     - currently only german umlauts are handled - needs more"
claus
parents: 4
diff changeset
    99
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   100
    |ascii|
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   101
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   102
    ascii := aCharacter asciiValue.
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   103
    (ascii < 128) ifTrue:[
84
claus
parents: 36
diff changeset
   104
	^ super nextPut:aCharacter
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   105
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   106
    (ascii == 16rfc) ifTrue:[   "udiaeresis"
84
claus
parents: 36
diff changeset
   107
	^ self character:$} fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   108
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   109
    (ascii == 16re4) ifTrue:[   "adiaeresis"
84
claus
parents: 36
diff changeset
   110
	^ self character:${ fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   111
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   112
    (ascii == 16rf6) ifTrue:[   "odiaeresis"
84
claus
parents: 36
diff changeset
   113
	^ self character:$| fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   114
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   115
    (ascii == 16rdc) ifTrue:[   "Udiaeresis"
84
claus
parents: 36
diff changeset
   116
	^ self character:$] fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   117
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   118
    (ascii == 16rc4) ifTrue:[   "Adiaeresis"
84
claus
parents: 36
diff changeset
   119
	^ self character:$[ fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   120
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   121
    (ascii == 16rd6) ifTrue:[   "Odiaeresis"
84
claus
parents: 36
diff changeset
   122
	^ self character:$\ fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   123
    ].
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   124
    (ascii == 16rdf) ifTrue:[   "ssharp"
84
claus
parents: 36
diff changeset
   125
	^ self character:$~ fromCharacterSet:2
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   126
    ]
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   127
!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   128
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   129
normal
6
claus
parents: 4
diff changeset
   130
    "set font to normal"
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   131
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   132
    "send: <ESC>H<ESC>5"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   133
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   134
    super escape:$H. super escape:$5
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   135
! !
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   136
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   137
!EpsonFX1PrinterStream methodsFor:'layout'!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   138
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   139
linesPerPage:n
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   140
    "send: <ESC>C<n>"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   141
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   142
    super escape:$C.
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   143
    super nextPut:(Character value:n)
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   144
!
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
newPage
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   147
    super nextPut:(Character value:12)
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   148
!
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
noTopMargin
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   151
    "send <ESC>0"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   152
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   153
    super escape:$O
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   154
!
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
pageHeight:inch
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   157
    "send <ESC>G<0><inch>"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   158
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   159
    super escape:$C.
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   160
    super nextPut:(Character value:0).
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   161
    super nextPut:(Character value:inch)
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   162
!
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
proportional:aBoolean
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   165
    "send <ESC>p0 or <ESC>p1"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   166
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   167
    super escape:$p.
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   168
    aBoolean ifTrue:[
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   169
	super nextPut:$1
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   170
    ] ifFalse:[
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   171
	super nextPut:$0
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   172
    ]
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
reset
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   176
    "send <ESC>@"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   177
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   178
    super escape:$@
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   179
!
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
topMargin:n
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   182
    "send <ESC>N<n>"
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   183
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   184
    super escape:$N.
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   185
    super nextPut:(Character value:n)
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   186
! !
259
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   187
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   188
!EpsonFX1PrinterStream class methodsFor:'documentation'!
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   189
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   190
version
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   191
    ^ '$Header: /cvs/stx/stx/libbasic2/EpsonFX1PrinterStream.st,v 1.14 1996-04-25 17:01:15 cg Exp $'
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   192
! !