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