EpsonFX1PrinterStream.st
changeset 348 e4790af5d077
parent 259 6d36f3ac42a2
child 370 705453f00711
--- a/EpsonFX1PrinterStream.st	Fri May 17 16:46:19 1996 +0200
+++ b/EpsonFX1PrinterStream.st	Sat May 18 09:14:51 1996 +0200
@@ -35,12 +35,24 @@
 
 documentation
 "
-    This class defines protocol for simple text prinitng on an Epson-FX1
+    This class defines protocol for simple text printing on an Epson-FX1
     (and compatible) printer. 
     It does not support multiple fonts, but knows how to print bold, italic etc.
 
+    Graphics printing is not supported - you need a postscriptprinter for this.
+
     I cannot tell, if this is really an Epson -
-    all I had to test was a Citizen 120D - its documentation claims it to be FX1 compatible.
+    all I had to test was a Citizen 120D - its documentation claims it to be 
+    FX1 compatible.
+
+    Notice: 
+        This class only defines some minimum protocol for printing on
+        Epsons - you really should use a PostscriptPrinter ...
+        ... however, if you own an Epson, here is some class to start with.
+        It may need to be enhanced at some places (for example: provide more
+        fonts/emphasis's; better international character translation etc.)
+
+        This class is not officially supported - take it or leave it.
 
     [author:]
         Claus Gittinger
@@ -57,14 +69,161 @@
 
 !EpsonFX1PrinterStream methodsFor:'access writing'!
 
+cr
+    "send a carriage return (newLine).
+     We have to output cr-nl here"
+
+    super nextPutUntranslated:(Character value:13).
+    super nextPutUntranslated:(Character value:10).
+    self spaces:LeftMargin
+
+    "Modified: 18.5.1996 / 09:02:07 / cg"
+!
+
+nextPut:aCharacter
+    "send aCharacter to the printer.
+     Catch special characters 
+     - currently only german umlauts are handled - If you own this type
+       of printer and depend on it, add more translation here ..."
+
+    |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
+    ]
+
+    "Modified: 18.5.1996 / 09:03:18 / cg"
+! !
+
+!EpsonFX1PrinterStream methodsFor:'emphasis change'!
+
 bold
-    "set font to bold"
+    "set emphasis to bold"
 
     "send: <ESC>G "
 
     super escape:$G
+
+    "Modified: 18.5.1996 / 09:03:31 / cg"
 !
 
+italic
+    "set emphasis to italic"
+
+    "send: <ESC>4 will do that"
+
+    super escape:$4
+
+    "Modified: 18.5.1996 / 09:03:33 / cg"
+!
+
+normal
+    "set emphasis to normal"
+
+    "send: <ESC>H<ESC>5"
+
+    super escape:$H. super escape:$5
+
+    "Modified: 18.5.1996 / 09:03:35 / cg"
+! !
+
+!EpsonFX1PrinterStream methodsFor:'layout'!
+
+linesPerPage:n
+    "change the lines-per-page setting"
+
+    "send: <ESC>C<n>"
+
+    super escape:$C.
+    super nextPut:(Character value:n)
+
+    "Modified: 18.5.1996 / 09:03:50 / cg"
+!
+
+newPage
+    "force a newPage"
+
+    super nextPut:(Character value:12)
+
+    "Modified: 18.5.1996 / 09:04:04 / cg"
+!
+
+noTopMargin
+    "turn off topMargin in the printer"
+
+    "send <ESC>0"
+
+    super escape:$O
+
+    "Modified: 18.5.1996 / 09:04:19 / cg"
+!
+
+pageHeight:inches
+    "set the pageHeight in inches"
+
+    "send <ESC>G<0><inch>"
+
+    super escape:$C.
+    super nextPut:(Character value:0).
+    super nextPut:(Character value:inches)
+
+    "Modified: 18.5.1996 / 09:04:38 / cg"
+!
+
+proportional:aBoolean
+    "turn on/off proportional printing"
+
+    "send <ESC>p0 or <ESC>p1"
+
+    super escape:$p.
+    super nextPut:(aBoolean ifTrue:[$1] ifFalse:[$0])
+
+    "Modified: 18.5.1996 / 09:05:18 / cg"
+!
+
+reset
+    "reset the printer - send <ESC>@"
+
+    super escape:$@
+
+    "Modified: 18.5.1996 / 09:05:27 / cg"
+!
+
+topMargin:n
+    "set the topMargin"
+
+    "send <ESC>N<n>"
+
+    super escape:$N.
+    super nextPut:(Character value:n)
+
+    "Modified: 18.5.1996 / 09:05:43 / cg"
+! !
+
+!EpsonFX1PrinterStream methodsFor:'private'!
+
 character:char fromCharacterSet:set
     "send a character from an alternate character set"
 
@@ -75,118 +234,10 @@
     super nextPut:char.
     super escape:$R.
     super nextPut:(Character value:0)
-!
-
-cr
-    "have to output cr-nl here"
-
-    super nextPutUntranslated:(Character value:13).
-    super nextPutUntranslated:(Character value:10).
-    self spaces:LeftMargin
-!
-
-italic
-    "set font to italic"
-
-    "send: <ESC>4 will do that"
-
-    super escape:$4
-!
-
-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
-    ]
-!
-
-normal
-    "set font to normal"
-
-    "send: <ESC>H<ESC>5"
-
-    super escape:$H. super escape:$5
-! !
-
-!EpsonFX1PrinterStream methodsFor:'layout'!
-
-linesPerPage:n
-    "send: <ESC>C<n>"
-
-    super escape:$C.
-    super nextPut:(Character value:n)
-!
-
-newPage
-    super nextPut:(Character value:12)
-!
-
-noTopMargin
-    "send <ESC>0"
-
-    super escape:$O
-!
-
-pageHeight:inch
-    "send <ESC>G<0><inch>"
-
-    super escape:$C.
-    super nextPut:(Character value:0).
-    super nextPut:(Character value:inch)
-!
-
-proportional:aBoolean
-    "send <ESC>p0 or <ESC>p1"
-
-    super escape:$p.
-    aBoolean ifTrue:[
-	super nextPut:$1
-    ] ifFalse:[
-	super nextPut:$0
-    ]
-!
-
-reset
-    "send <ESC>@"
-
-    super escape:$@
-!
-
-topMargin:n
-    "send <ESC>N<n>"
-
-    super escape:$N.
-    super nextPut:(Character value:n)
 ! !
 
 !EpsonFX1PrinterStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/EpsonFX1PrinterStream.st,v 1.14 1996-04-25 17:01:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/EpsonFX1PrinterStream.st,v 1.15 1996-05-18 07:14:27 cg Exp $'
 ! !