EpsonFX1PrinterStream.st
author claus
Mon, 08 Nov 1993 03:32:20 +0100
changeset 6 96ce41566060
parent 4 1f66800df351
child 9 be1c17c19ba8
permissions -rw-r--r--
2.8.1

"
 COPYRIGHT (c) 1991 by Claus Gittinger
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

PrinterStream subclass:#EpsonFX1PrinterStream
         instanceVariableNames:''
         classVariableNames:''
         poolDictionaries:''
         category:'Streams-External'
!

EpsonFX1PrinterStream comment:'

COPYRIGHT (c) 1991 by Claus Gittinger
              All Rights Reserved

$Header: /cvs/stx/stx/libbasic2/EpsonFX1PrinterStream.st,v 1.5 1993-11-08 02:30:19 claus Exp $

 cannot tell, if this is really an Epson -
 all I have is a Citizen 120D to test - the doc says its an FX1

 written Feb 91 by claus
'!

!EpsonFX1PrinterStream methodsFor:'layout'!

reset
    super nextPut:(Character esc).
    super nextPut:$@
!

pageHeight:inch
    super nextPut:(Character esc).
    super nextPut:$C.
    super nextPut:(Character value:0).
    super nextPut:(Character value:inch)
!

linesPerPage:n
    super nextPut:(Character esc).
    super nextPut:$C.
    super nextPut:(Character value:n)
!

noTopMargin
    super nextPut:(Character esc).
    super nextPut:$O
!

topMargin:n
    super nextPut:(Character esc).
    super nextPut:$N.
    super nextPut:(Character value:n)
!

leftMargin:n
    leftMargin := n
!

proportional:aBoolean
    super nextPut:(Character esc).
    super nextPut:$p.
    aBoolean ifTrue:[
        super nextPut:$1
    ] ifFalse:[
        super nextPut:$0
    ]
!

newPage
    super nextPut:(Character value:12)
! !

!EpsonFX1PrinterStream methodsFor:'access writing'!

character:char fromCharacterSet:set
    "send a character from an alternate character set"

    "send <ESC>R<set><char><ESC>R<\0>"
    super nextPut:(Character esc).
    super nextPut:$R.
    super nextPut:(Character value:set).
    super nextPut:char.
    super nextPut:(Character esc).
    super nextPut:$R.
    super nextPut:(Character value:0)
!

nextPut:aCharacter
    "catch special characters 
     - currently only german umlauts are handled - needs more"

    |ascii|

    ascii := aCharacter asciiValue.
    (ascii < 128) ifTrue:[
        ^ super nextPut:aCharacter
    ].
    (ascii == 16rfc) ifTrue:[   "udiaeresis"
        ^ self character:$} fromCharacterSet:2
    ].
    (ascii == 16re4) ifTrue:[   "adiaeresis"
        ^ self character:${ fromCharacterSet:2
    ].
    (ascii == 16rf6) ifTrue:[   "odiaeresis"
        ^ self character:$| fromCharacterSet:2
    ].
    (ascii == 16rdc) ifTrue:[   "Udiaeresis"
        ^ self character:$] fromCharacterSet:2
    ].
    (ascii == 16rc4) ifTrue:[   "Adiaeresis"
        ^ self character:$[ fromCharacterSet:2
    ].
    (ascii == 16rd6) ifTrue:[   "Odiaeresis"
        ^ self character:$\ fromCharacterSet:2
    ].
    (ascii == 16rdf) ifTrue:[   "ssharp"
        ^ self character:$~ fromCharacterSet:2
    ]
!

cr
    "have to output cr-nl here"

    super nextPutUntranslated:(Character value:13).
    super nextPutUntranslated:(Character value:10).
    self spaces:leftMargin
!

bold
    "set font to bold"

    "send <ESC>G will do that"
    super nextPut:(Character esc).
    super nextPutAll:'G'
!

italic
    "set font to italic"

    "send <ESC>4 will do that"
    super nextPut:(Character esc).
    super nextPutAll:'4'
!

normal
    "set font to normal"

    "send <ESC>H<ESC>5 will do that"
    super nextPut:(Character esc).
    super nextPutAll:'H'.
    super nextPut:(Character esc).
    super nextPutAll:'5'
! !