Getting accents into Squeak
Torge Husfeldt
jean-jacques.gelee at gmx.de
Mon Oct 1 08:40:00 UTC 2001
DeadCharacters V3
from preamble:
"Change Set: DeadCharacterSupport-th
Date: 30 September 2001
Author: Your Name
Adds dead character support in ParagraphEditors and their heirs.
Just open up some TextEditor wich inherits from ParagraphEditor and type
in:
^e
you will hopefully get:
ê
Look into Character >> deadCharacters for more bindings (a bit cryptic
but always up to date).
To Undo revert ParagraphEditor>> normalCharacter to its former state (or
flame jean-jacques.gelee at gmx.de).
Versions:
3: got some comment right, eat spaces, more explanation, added
initializer.
2: initial release
ToDo:
1 - make it a preference.
2 - think of ways to produce the remainig characters as well
3 - maybe switch to compose-key logic
4 - general cleanup of code
Dead characters are a relatively straightforward way to type in
Characters that are not directly available on the keyboard. This
approach is being used by several Keyboard-drivers. In this simplistic
approach there is plenty of room for improvement.
Here is a list of characters that i have not been able to map to the
given dead/character/character combinations. If you find a way to map
them, go on.
'$ß $Æ $Ø $æ $ø $? $? '
A more thorough approach would surely make use of a combine-key (cf
Sun-keyboards)"
-------------- next part --------------
'From Squeak2.7 of 5 January 2000 [latest update: #1789] on 1 October 2001 at 10:38:16 am'!
"Change Set: DeadCharacterSupport-th
Date: 30 September 2001
Author: Your Name
Adds dead character support in ParagraphEditors and their heirs.
Just open up some TextEditor wich inherits from ParagraphEditor and type in:
^e
you will hopefully get:
?
Look into Character >> deadCharacters for more bindings (a bit cryptic but always up to date).
To Undo revert ParagraphEditor>> normalCharacter to its former state (or flame jean-jacques.gelee at gmx.de).
Versions:
3: got some comment right, eat spaces, more explanation, added initializer.
2: initial release
ToDo:
1 - make it a preference.
2 - think of ways to produce the remainig characters as well
3 - maybe switch to compose-key logic
4 - general cleanup of code
Dead characters are a relatively straightforward way to type in Characters that are not directly available on the keyboard. This approach is being used by several Keyboard-drivers. In this simplistic approach there is plenty of room for improvement.
Here is a list of characters that i have not been able to map to the given dead/character/character combinations. If you find a way to map them, go on.
'$§ $® $¯ $¾ $¿ $Î $Ï '
A more thorough approach would surely make use of a combine-key (cf Sun-keyboards)"!
Magnitude subclass: #Character
instanceVariableNames: 'value '
classVariableNames: 'CharacterTable DeadCharacters '
poolDictionaries: ''
category: 'Collections-Text'!
ScrollController subclass: #ParagraphEditor
instanceVariableNames: 'paragraph startBlock stopBlock beginTypeInBlock emphasisHere initialText selectionShowing otherInterval lastDeadCharacter '
classVariableNames: 'ChangeText CmdActions CurrentSelection FindText Keyboard ShiftCmdActions TextEditorYellowButtonMenu TextEditorYellowButtonMessages UndoInterval UndoMessage UndoParagraph UndoSelection Undone '
poolDictionaries: 'TextConstants '
category: 'Kernel-ST80 Remnants'!
!Character methodsFor: 'converting' stamp: 'th 9/30/2001 22:20'!
combineWith: aCharacter
"Dead Character support"
self isDeadCharacter ifFalse:[^ String with: self with: aCharacter].
^(self class deadCharacters at: self) at: aCharacter ifAbsent: [String with: self with: aCharacter]! !
!Character methodsFor: 'converting' stamp: 'th 9/30/2001 22:22'!
isDeadCharacter
^ self class deadCharacters includesKey: self! !
!Character class methodsFor: 'constants' stamp: 'th 10/1/2001 10:27'!
deadCharacters
"Dead characters are a relatively straightforward way to type in Characters that are not directly available on the keyboard. This approach is being used by several Keyboard-drivers."
"In this simplistic approach there is plenty room for improvement."
"Here is a list of characters that i have not been able to map to the given dead/character/character combinations. If you find a way to map them, go on."
"$§ $® $¯ $¾ $¿ $Î $Ï $À $Á"
"A more thorough approach would surely make use of a combine-key (cf Sun-keyboards)"
^DeadCharacters
ifNotNil:[DeadCharacters]
ifNil: [DeadCharacters _ Dictionary newFrom:
{ $~ -> (Dictionary newFrom:{$n -> '-'. $A ->'Ì'. $O -> 'Í'. $N -> '?'. $a -> '<'. $o -> '>'. $ -> '~' }).
$^ -> (Dictionary newFrom:{$a -> '?'. $e -> '?'. $i -> '?'. $o -> '?'. $u -> '?'. $ -> '^' }).
$¡ -> (Dictionary newFrom:{$A -> '?'. $a -> '?'. $ -> '¡' }).
$« -> (Dictionary newFrom:{$a -> '?'. $C -> ','. $E -> 'f'. $c -> '?'. $e -> '?'. $i -> '?'. $o -> '-'. $u -> '?'. $? -> 'À'. $!! -> 'Á'. $ -> '«'}).
$` -> (Dictionary newFrom:{$A -> 'Ë'. $a -> '^'. $e -> '?'. $i -> '?'. $o -> '~'. $u -> '?'. $ -> '`'}).
$¬ -> (Dictionary newFrom:{$a -> 'S'. $A -> '?'. $O -> '?'. $U -> '?'. $e -> '?'. $i -> '*'. $o -> 's'. $u -> 'Y'. $y -> 'Ø'. $ -> '¬' })
}]! !
!Character class methodsFor: 'constants' stamp: 'th 10/1/2001 10:27'!
initializeDeadCharacters
DeadCharacters _ nil! !
!ParagraphEditor methodsFor: 'typing/selecting keys' stamp: 'th 9/30/2001 23:40'!
normalCharacter: t1
| nextChar |
nextChar _ sensor keyboard.
lastDeadCharacter isNil
ifTrue:[nextChar isDeadCharacter
ifTrue:[lastDeadCharacter _ nextChar]
ifFalse:[t1 nextPut: nextChar]]
ifFalse:[
t1 nextPutAll: (lastDeadCharacter combineWith: nextChar).
lastDeadCharacter _ nil].
"t1 nextPut: sensor keyboard."
^ false! !
"Postscript:
Make sure changes take effect if another version of DeadCharacterSupport is already loaded and Character class variable DeadCharacters is already initialized."
Character initializeDeadCharacters
!
More information about the Squeak-dev
mailing list
|