Bert Freudenberg uploaded a new version of Multilingual to project Etoys: http://source.squeak.org/etoys/Multilingual-kks.15.mcz
==================== Summary ====================
Name: Multilingual-kks.15 Author: bf Time: 12 October 2010, 11:31:52 pm UUID: 2acc1113-6373-4e47-b1d5-4759fb2f33e2 Ancestors: Multilingual-bf.14
added multilingual Unicode environments (SQ-850)
=============== Diff against Multilingual-bf.14 ===============
Item was added: + LanguageEnvironment subclass: #M17nEnvironment + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Multilingual-Languages'! + + !M17nEnvironment commentStamp: 'kks 10/2/2010 19:45' prior: 0! + This class supports multilingual Unicode environments that use UTF-8 encoding. Such a large scope implies the use of external fonts and external rendering engines like Pango. Currently, it is useful for Indic and a few Asian languages.!
Item was added: + ----- Method: M17nEnvironment classSide>>clipboardInterpreterClass (in category 'subclass responsibilities') ----- + clipboardInterpreterClass + + ^ UTF8ClipboardInterpreter. + !
Item was added: + ----- Method: M17nEnvironment classSide>>fileNameConverterClass (in category 'subclass responsibilities') ----- + fileNameConverterClass + + ^ UTF8TextConverter. + !
Item was added: + ----- Method: M17nEnvironment classSide>>inputInterpreterClass (in category 'subclass responsibilities') ----- + inputInterpreterClass + | platformName | + platformName := SmalltalkImage current platformName. + platformName = 'Win32' + ifTrue: [ 'CE' = (SmalltalkImage current getSystemAttribute: 1002) + ifTrue: [^ MacRomanInputInterpreter]]. + platformName = 'MacOS' + ifTrue: [^MacRomanInputInterpreter]. + ^M17nInputInterpreter.!
Item was added: + ----- Method: M17nEnvironment classSide>>leadingChar (in category 'subclass responsibilities') ----- + leadingChar + + ^ Unicode leadingChar. + !
Item was added: + ----- Method: M17nEnvironment classSide>>supportedLanguages (in category 'subclass responsibilities') ----- + supportedLanguages + "Include languages that will not conflict with other languages" + + ^#('bn' 'gu' 'hi' 'kn' 'ml' 'mr' 'ta' 'te' 'sa')!
Item was added: + ----- Method: M17nEnvironment classSide>>systemConverterClass (in category 'subclass responsibilities') ----- + systemConverterClass + + ^ UTF8TextConverter.!
Item was added: + KeyboardInputInterpreter subclass: #M17nInputInterpreter + instanceVariableNames: 'converter' + classVariableNames: '' + poolDictionaries: '' + category: 'Multilingual-TextConversion'! + + !M17nInputInterpreter commentStamp: 'kks 10/2/2010 23:26' prior: 0! + A flexible input interpreter that is tuned to variations in keyboard events coming in from the VM. + + Old VMs passed only a 8-bit keycode evt[3] and 0 in evt[6]. This code could be in any one of the code pages. On Mac, this used mac-roman, while on Unix, this could be ASCII or UTF-8 depending on the locale. + + Newer VMs pass UTF32 in evt[6]. This can be 'cooked' based on the current language setting to generate a Character.!
Item was added: + ----- Method: M17nInputInterpreter>>initialize (in category 'as yet unclassified') ----- + initialize + + converter _ UTF8TextConverter new.!
Item was added: + ----- Method: M17nInputInterpreter>>nextCharFrom:firstEvt: (in category 'as yet unclassified') ----- + nextCharFrom: sensor firstEvt: evtBuf + | keyValue | + keyValue := evtBuf at: 6. + 0 = keyValue ifTrue: [ ^self nextUtf8Char: sensor firstEvt: evtBuf ]. + 256 > keyValue ifTrue: [ ^keyValue asCharacter ]. + ^ Character leadingChar: (Locale current languageEnvironment leadingChar) code: keyValue!
Item was added: + ----- Method: M17nInputInterpreter>>nextUtf8Char:firstEvt: (in category 'as yet unclassified') ----- + nextUtf8Char: sensor firstEvt: evtBuf + "this code should really go into InputSensor>>fullKey" + | aCollection bytes peekEvent keyValue type stream multiChar evt | + self flag: #fixthis. + keyValue _ evtBuf third. + evtBuf fourth = EventKeyChar ifTrue: [type _ #keystroke]. + peekEvent _ sensor peekEvent. + (peekEvent notNil and: [peekEvent fourth = EventKeyDown]) ifTrue: [ + sensor nextEvent. + peekEvent _ sensor peekEvent]. + + (type == #keystroke + and: [peekEvent notNil + and: [peekEvent first = EventTypeKeyboard + and: [peekEvent fourth = EventKeyChar]]]) ifTrue: [ + aCollection _ OrderedCollection with: keyValue asCharacter. + bytes _ (keyValue <= 127) + ifTrue: [ 0 ] + ifFalse: [ (keyValue bitAnd: 16rE0) = 192 + ifTrue: [ 1 ] + ifFalse: [ (keyValue bitAnd: 16rF0) = 224 + ifTrue: [ 2 ] + ifFalse: [ 3 ] + ] + ]. + [bytes > 0] whileTrue: [ + (evt := sensor nextEvent) fourth = EventKeyChar ifTrue: [ + bytes := bytes - 1. + aCollection add: (Character value: evt third)]]. + "aCollection do: [ :each | Transcript show: (each asciiValue hex , ' ')]. + Transcript show: Character cr." + stream _ ReadStream on: (String withAll: aCollection). + multiChar _ converter nextFromStream: stream. + multiChar isOctetCharacter ifFalse: [ sensor nextEvent ]. + ^ multiChar]. + + ^ keyValue asCharacter!
etoys-dev@lists.squeakfoundation.org