PERSONALIZED KEYBOARD DEFINITION

Amha Asfaw

University of Missouri, Columbia, MO

aesamha@mizzou1.missouri.edu

Introduction

There were discussions on electronic networks (Cleo & Soc.culture.african) on how to define standard keystrokes to generate Amharic characters. For example, should the Geez column be written with ' or e ? (b' l' or be le ) was part of that discussion. However, this concern of Amharic software developers was not necessary. In this paper, a method of personalizing keyboard definitions will be described.

Personalized Keyboards (keystrokes) are not only useful to accommodate individual styles and tests, but also individual needs. For example it is very hard for a one handed person to press the shift key and type the letter "Y" at the same time. On a personalized keyboard however, typing is merely repeating the movements of the fingers that created the keystrokes in the first place.

Abass B. Alemeneh in his "Mesihafe Elatek" emphasized the point that characters do need to have standard codes. However he was referring to a constant position of an Amharic character in a font. I agree that font creators should standardize these positions. The definitions of the keystrokes that will point to these standard positions however are best left to the user.

Basic Ideas

A character is represented in a computer by an 8 bit byte. And a binary representation of a byte can be written in 2^8 = 256 ways. The number of characters in a font is limited by this number. Even True Type fonts which are the standards of the industry now, are limited to 256 characters per font. Furthermore, all the 256 positions are not free to use. For example position 13 of (0,1,2 ..... 255) is used by most printers as a page throw code. And position 26 is used by some languages (e.g. True Basic) as an end of file marks. Therefore, it is customary to define characters in positions 33 to 255. This leaves 223 free positions per font. With the introduction of Unicode, this barrier may be broken. Until such a time, we can define a reduced set of Amharic characters (as in Hadiss Alemayehu's Fikir Eske-Meqabr, Ethwp ) in one font, or we need two sets of fonts to represent all Amharic characters (Giiz-Word, EthTeX)

Some characters in the Amharic script lost their original sounds and therefore their inclusion is only cosmetic or nostalgic. Amharic does not need 4 rows of characters with the Ha sound. That was what Haddis Alemayehu eliminated in his famous book.

The next question is "What is the maximum number of keystrokes needed to generate a code?" On the old Amharic type writer, this number was 3. For example, to generate the character "ja", the horizontal line at the top is printed first, the long right leg follows and the letter D is printed last. In this paper we will consider the case of 2 fonts and a maximum of 2 keystrokes per character.

Keyboard Definitions

Let us assume the following two fonts are created by a font vender. We will call the first one fidel1 and the second fidel2. And we will fill them with some characters. Remember these are the sounds of the characters and not the keystrokes. If they look like keystrokes, it is because the logical choice of keystrokes (for a person used to typing in English) are those that sound like the Amharic characters.

Figure 1-------------------------------------------------------------------

Position / 0 /....... / 35/ 36/ 37/ 38/ ......... /220/221/...... /255/

Fidel1 / /....... / ha/ hu/ hi/ ha/ ......... / :/ ?/...... / /

Fidel2 / /....... / ka/ ke/ k/ ko/ ......... / va/ vo/...... / !/

----------------------------------------------------------------------------

A program that displays the contents of fidel1 and fidel2 (eg. Brana) will record the key strokes chosen to represent fidel1 and fidel2. Let us assume the user is used eLaTeX and wants to preserve some of his/her old habits.

Figure 2-------------------------------------------------------------------

Position / 0 /....... / 35/ 36/ 37/ 38/ ......... /220/221/...... /255/

Fidel1 / /....... / ha/ hu/ hi/ ha/ ......... / :/ ?/...... / /

Keystroke / /....... / h/ h2/ h3/ h4/ ......... / :/ ?/...... / /

Fidel2 / /....... / ka/ ke/ k/ ko/ ......... / va/ vo/...... / !/

Keystroke / /....... / q4/ q5/ q7/ q8/ ......... / v4/ v8/...... / !/

----------------------------------------------------------------------------

Four storage areas are needed to store the above information. In general if we have a maximum key stroke of n for a character, we need 2*n storage areas. Next we will divide these storage areas in two groups. The first group contains the actual keystrokes (k) and the second contains pointers to the font tables (p).

therefore:

k1= the storage area for 1 key strokes ( h,?,: .....)

p1= the list of pointers to fonts and positions in fonts

k2= the storage area for 2 key strokes (h2,h3,v4 .....)

p2= the list of pointers to fonts and positions in fonts

kn= the storage area for n key strokes.

pn= the list of pointers to fonts and positions in fonts

Figure 3-----------------------------------------------------------------

k1 / h/ ?/ k/ : / . . . / ! /

p1 /035/221/337/220/ . . . /555/

k2 / h2/ h3/ h4/... / / ka/ ke/ k/ ko/ va/ vo/

p2 /036/037/038/... / /335/336/337/338/520/521/

-------------------------------------------------------------------------

Since each font can have a maximum of 256 positions or codes, by adding (n-1) X 300 to a character code in the nth font we can store both the character code and the font id as one number. (Figure 3)

if 0 < = m < = 255 m = character code within a font.

1< = n< = 2 n = the font id.

the numerical code stored for character m in font n = (n-1) X 300+m

Algorithm

The actual Visual Basic program that analyzes the user keystroke is listed at the end of this paper. However, we will see how the keystrokes h4! will be handled as an example.

keystroke h4!

step 1: search h in k2. Since the first cell starts with h there a potential for h to be the first of a two keystroke sequence. Therefore wait for the second keystroke.

step 2: Attach the second keystroke to the first one h||4 = h4 and search h4 in k2. h4 is found in cell 4 of k2 The corresponding p storage p2(4) contains the code 38. Since 38< 300 we determine the font is fidel1

step 3: Set font as fidel1 and display the character located in position 38 of fidel1.

step 4: Get the next keystroke "!" search it in k2 . "!" is not in k2 there fore search it in k1. And it is found in the last cell of k1. the corresponding code in p1 is 555. since 555 > 300 use fidel2

step 5: set font as fidel2 and display the character located in position 555-300 = 255 of fidel2.

The following lines of code will identify which font a character came from.

d = p("!") 'in this case d = 555 from the p storage.

f = 1 'assume font1 . in our case fidel1

do

r = d-300

if r< 0 then exit do

d = r

f = f+1

loop

' at this point font is f and the character is d.

Conclusion

In a multi-lingual society such as Ethiopia, generalized definitions of keyboard layouts and fonts is useful in the long run. We have no idea what fonts will the Shinashas of Metekel will use and what their preference of key board layout will be. If present day software developers think in terms of cultures other than their own a lot of future problems will be solved . If the computer industry could think of in terms of languages that use more than 26 characters we would not have this problem.

References

1. Abass B. Alameneh, EthioSystems Co. 1993.

2. Amha Asfaw, EthWP Unpublished Amharic WordProcesser for DOS,1986.

3. Amha Asfaw, Unpublished Amharic WordProcesser for Windows,1994.

4. Haddis Alemayehu, "Fikir Eske-Mekabir", Printed by Ministry of Education, 1968

5. Kemeny John, Kurtz Thomas, True Basic Inc. 1992.

6. Livingston Brian, Windows 3.1 Secrets, IDG Books, 1992.

7. Microsoft, Visual Basic 3.0, Microsoft Corp, 1993.

Appendix I

Listing of Programs

Global KEYCOUNT%, KEYVAL1%, KEYVAL2%, j1%, j2%

Global kb1d$, kb1p$, kb2d$, kb2p$, ethfnt$(2)

'This subroutine is called every time a key is pressed while the cursor is on the

'editor.

Sub Editor_KeyPress (keyascii As Integer)

If keyascii < 33 Then Exit Sub 'We are not interested in positions 0 to 32

result = fontindex(Editor.hWnd) 'Window will return the current font used

If result = 1 Or result = 2 Then 'Must be Amharic

Do

keycount = keycount + 1 'Key strock counter

Select Case keycount

Case 1

keyval1 = keyascii

u$ = " " + Chr$(keyval1)

i = InStr(kb2d$, u$)

keyascii = 8 ' key=8 is a back space code .

If i < > 0 Then Exit Sub

u$ = " " + u$

i = InStr(kb1d$, u$)

If i > 0 Then

Call hahu(i, 1)

keyascii = j1

Else

Beep

End If

keycount = 0

Exit Sub

Case 2

keyval2 = keyascii

u$ = " " + Chr$(keyval1) + Chr$(keyval2)

i = InStr(kb2d$, u$)

If i = 0 Then

u$ = " " + Chr$(keyval1)

i = InStr(kb1d$, u$)

If i < > 0 Then Call hahu(i, 1)

keycount = 0

keyascii = keyval2

Else

Call hahu(i, 2)

keyascii = j1

keycount = 0

Exit Sub

End If

Case Else

keycount = 0

End Select

Loop

End If

End Sub

Sub hahu (i1, i2)

ptr$ = kb1p$

If i2 = 2 Then ptr$ = kb2p$

u$ = Mid$(ptr$, i1, 3)

j1 = Val(u$)

j2 = 0

If j1 > = 300 Then j2 = 3

j1 = j1 - j2 * 100

j2=j2-1

If j2 < 0 Then j2 = 1

f$ = ethfnt$(j2)

' the following line sets the font according to j2 or ethfnt$(j2)

result = SetFont(formmain.Editor.hWnd, is%,ic%, ip%, ifa%, f$,FONT_SET_ALL)

End Sub

Appendix II

Possible Amharic translation for some computer words.

Key: Qulfe Key word: Qulfe qal or Qu-qal or Quqal

Keyboard Yequlfe seleda Motherboard Enat seleda

Bit: Chiret (Read Ch as in the amharic word for mud)

Byte: Qelem (Qelem is another word for hohe)= 8 chiretoch

Half word: Gmade-Qal = 2 Qelemoch = 16 Chiretoch

Full word: Mulu Qal or just Qal = 4 qelemoch

Double Word: Tamra-Qal (Read T as in the local beer Tela ) = 2 Qaloch

Definition: Denegage

Truetype: Qulchea

Pagethrow: Getse gelbache or Getse Gelche (Read tse as in Amharic(Sun))

Program: A computer program is a sequence of instructions thus: Yetezaz self or Selfe-tezaz.