EpsonFX1PrinterStream.st
changeset 0 1cf8d1747859
child 2 07d9ee98e092
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EpsonFX1PrinterStream.st	Fri Jul 16 11:39:41 1993 +0200
@@ -0,0 +1,150 @@
+"
+ COPYRIGHT (c) 1988-93 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:'
+%W% %E%
+
+ 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
+    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"
+    |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
+    "switch to bold font-face"
+
+    super nextPut:(Character esc).
+    super nextPutAll:'G'
+!
+
+italic
+    "switch to italic/oblique font-face"
+
+    super nextPut:(Character esc).
+    super nextPutAll:'4'
+!
+
+normal
+    "switch to normal font-face"
+
+    super nextPut:(Character esc).
+    super nextPutAll:'H'.
+    super nextPut:(Character esc).
+    super nextPutAll:'5'
+! !