CharacterArray.st
changeset 1013 0e54ddc990cb
parent 1012 19fd2f72269f
child 1018 0efa94da3494
--- a/CharacterArray.st	Sat Feb 24 23:04:43 1996 +0100
+++ b/CharacterArray.st	Sat Feb 24 23:49:57 1996 +0100
@@ -1353,6 +1353,9 @@
     encodingSymbol == #jis7 ifTrue:[
         ^ self encodeIntoJIS7
     ].
+    (encodingSymbol startsWith:'jis') ifTrue:[
+        ^ self encodeIntoJIS
+    ].
     encodingSymbol == #euc ifTrue:[
         ^ self encodeIntoEUC
     ].
@@ -1362,7 +1365,7 @@
     ^ newString
 
     "Created: 22.2.1996 / 15:07:31 / cg"
-    "Modified: 23.2.1996 / 19:54:24 / cg"
+    "Modified: 24.2.1996 / 23:31:00 / cg"
 !
 
 replaceFrom:aString decode:encoding 
@@ -1869,8 +1872,8 @@
          'hello' decodeFromEUC 
     "
 
-    "Modified: 23.2.1996 / 15:58:06 / cg"
     "Created: 23.2.1996 / 17:28:41 / cg"
+    "Modified: 24.2.1996 / 23:38:05 / cg"
 !
 
 decodeFromJIS7
@@ -2057,7 +2060,7 @@
     "
 
     "Created: 23.2.1996 / 17:29:11 / cg"
-    "Modified: 23.2.1996 / 19:25:27 / cg"
+    "Modified: 24.2.1996 / 23:37:59 / cg"
 !
 
 encodeIntoEUC
@@ -2106,6 +2109,41 @@
     "Modified: 23.2.1996 / 19:56:25 / cg"
 !
 
+encodeIntoJIS
+    "return a new string with the receivers characters as JIS encoded 16bit string,
+     This is used to draw 8bit strings in a JIS font"
+
+    |sz c b romans newString|
+
+    romans := self class romanJISDecoderTable.
+
+    sz := self size.
+    newString := JISEncodedString new:sz.
+    1 to:sz do:[:index |
+        c := self at:index.
+        b := c asciiValue.
+        b <= 255 ifTrue:[
+            (b < 33 or:[b > (159 + 32)]) ifTrue:[
+                "/ a control character
+                newString at:index put:c.
+            ] ifFalse:[
+                newString at:index put:(Character value:(romans at:b - 32)).
+            ].
+        ] ifFalse:[
+            newString at:index put:c
+        ]
+    ].
+    ^ newString
+
+    "simple:
+
+         'hello' encodeIntoJIS
+    "
+
+    "Created: 23.2.1996 / 17:30:29 / cg"
+    "Modified: 24.2.1996 / 23:46:20 / cg"
+!
+
 encodeIntoJIS7
     "return a new string with the receivers characters as JIS7 encoded 7bit string,
      The receiver must be a JIS 16 bit character string."
@@ -3088,5 +3126,5 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.56 1996-02-24 22:04:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.57 1996-02-24 22:49:57 cg Exp $'
 ! !