#DOCUMENTATION by exept
authorClaus Gittinger <cg@exept.de>
Sun, 25 Aug 2019 13:46:59 +0200
changeset 5145 8a1040ff7c87
parent 5144 76e42c1c457f
child 5146 ad165bc9291c
#DOCUMENTATION by exept class: EpsonFX1PrinterStream changed: #nextPut: class: EpsonFX1PrinterStream class comment/format in: #documentation
EpsonFX1PrinterStream.st
--- a/EpsonFX1PrinterStream.st	Sun Aug 25 12:12:19 2019 +0200
+++ b/EpsonFX1PrinterStream.st	Sun Aug 25 13:46:59 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
@@ -38,11 +40,11 @@
 
 documentation
 "
-    This class defines protocol for simple text printing on an Epson-FX1
-    (and compatible) printer. 
+    This class defines protocol for simple text printing on an Epson-FX1 printer
+    (and compatibles, such as FX80, FX100, etc.). 
     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.
+    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 
@@ -58,6 +60,11 @@
     [Disclaimer:]    
         This class is not officially supported - take it or leave it.
 
+    [Disclaimer2:]    
+        This is more or less completely outdated (look at the creation date of this class !!).
+        Left for historic (nostalgic?) reasons.
+        Will be removed (or made autoloaded) in the future.
+
     [author:]
         Claus Gittinger
 "
@@ -100,37 +107,53 @@
 
 nextPut:aCharacter
     "send aCharacter to the printer.
-     Catch special characters 
+     Catch special characters.
      - currently only german umlauts are handled - If you own this type
-       of printer and depend on it, add more translation here ..."
+       of printer and depend on it, add more translation here.
+     See https://files.support.epson.com/pdf/fx100_/fx100_u1.pdf table6.2."
 
-    |ascii|
+    |ascii xLation|
 
     ascii := aCharacter codePoint.
     (ascii < 128) ifTrue:[
-        ^ stream 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
+        stream nextPut:aCharacter.
+        ^ self.
     ].
-    (ascii == 16rdc) ifTrue:[   "Udiaeresis"
-        ^ self character:$] fromCharacterSet:2
-    ].
-    (ascii == 16rc4) ifTrue:[   "Adiaeresis"
-        ^ self character:$[ fromCharacterSet:2
+    xLation := #(
+                "/ german
+                ($ä  ${ 2 )     "adiaeresis"
+                ($ö  $| 2 )     "odiaeresis"
+                ($ü  $} 2 )     "udiaeresis"
+                ($Ä  $[ 2 )     "Adiaeresis"
+                ($Ö  $\ 2 )     "Odiaeresis"
+                ($Ü  $] 2 )     "Udiaeresis"
+                ($ß  $~ 2 )     "ssharp"
+
+                "/ france  
+                ($à  $@ 1 )     "a-grave"
+                ($é  ${ 1 )     "e-aigu"
+                ($ú  $| 1 )     "u-aigu"
+                ($è  ${ 1 )     "e-grave"
+                ($ç  $\ 1 )     "c-cedille"
+
+                "/ italy  
+                ($ò  $| 6 )     "o-grave"
+                ($ì  $~ 6 )     "i-grave"
+
+                "/ spain  
+                ($Ñ  $\ 7 )     "N-tilde"
+                ($ñ  $| 7 )     "n-tilde"
+                ($¿  $] 7 )     "question"
+
+                "/ british  
+                ($£  $# 3 )     "pound"
+                "/ japan  
+                ($¥  $\ 8 )     "Yen"
+            ) detect:[:pair | pair first == aCharacter] ifNone:nil.
+
+    xLation notNil ifTrue:[
+        self character:(xLation second) fromCharacterSet:(xLation third)
     ].
-    (ascii == 16rd6) ifTrue:[   "Odiaeresis"
-        ^ self character:$\ fromCharacterSet:2
-    ].
-    (ascii == 16rdf) ifTrue:[   "ssharp"
-        ^ self character:$~ fromCharacterSet:2
-    ]
 
     "Modified: 18.5.1996 / 09:03:18 / cg"
 ! !