This is a short guide explaining the new keyboard layout files that will hopefully resolve all the problems with the last files.
At first all keyboard files must be UTF-8 encoded, so that characters of other languages can be stored correctly.

A keyboad layout file is written in XML and contains three parts:

KeyboardFont -> Name of the Font to be used for the keyboard description
KeyDefinitions -> Definition of the looks of the keyboard
KeyAccess -> Definition of the characters and keys on the keyboard

The root element of the keyboard layout file is

  <KeyboardLayout LanguageID="de" >
  </KeyboardLayout>

The language id attribute helps sorting the available keyboard layouts and also helps finding the correct keyboard layout depending on the system's keyboard setting.


The KeyboardFont element defines which font should be used, several recommendations may be given, separated by | characters
Example: 

<KeyboardFont>Courier | Misc Console | Monospace</KeyboardFont>


The key definitions are used to draw the keyboard. First some examples:

    <KeyDefinitions Options="ShowControlKeySymbols">
      <KeyDef Row="1" Slots="1" UpperChar="°" >^</KeyDef>
      <KeyDef Row="1" Slots="2" UpperChar="!" >1</KeyDef>
      <KeyDef Row="1" Slots="3" UpperChar="''" >2</KeyDef>
      <KeyDef Row="3" Slots="2" FingerKey="yes" >A</KeyDef>
      <KeyDef Row="3" Slots="3" FingerKey="yes" >S</KeyDef>
      <KeyDef Row="3" Slots="4" FingerKey="yes" >D</KeyDef>
      <KeyDef Row="3" Slots="5" FingerKey="yes" >F</KeyDef>
      <KeyDef Row="3" Slots="6" >G</KeyDef>
      <ControlKeyDef Row="4" Slots="1 2" UpperChar="Shift" >LeftShift</ControlKeyDef>
    </KeyDefinitions>

Please refer to the keyboard_grid.png file in ktouch/graphics where the key slots are defined.
There are two kinds of key elements: KeyDef and ControlKeyDef.
ControlKeyDef are keys that do not produce an actual character but are special characters (usually shift, control, alt, enter and space).

KeyDefs have the following attributes:
Row - the row of the key
Slots - one or more slots that are used by the key
UpperChar - the character that is at the top left if two characters have to be printed on the key
FingerKey - if set to yes, the key is marked as a key where the finger rests between typing.

The value of the KeyDef element has two meanings: it is the primary character that is printed on the key and also the reference character for the key access definitions (and thus must be unique in the keyboard layout).

ControlKeyDefs have the same attributes (no FingerKeys allowed here!), however the value is NOT to be translated, only the UpperChar attribute has to be translated in the appropriate language. The option "ShowControlKeySymbols" overrides the printing of the control key texts and causes KTouch to draw symbols for the keys instead. The values for the control keys are standardized and must be kept!!!
Possible values are:
LeftShift, RightShift, Tab, Backspace, CapsLock, Enter, LeftCtrl, LeftAlt, Space, RightAlt, RightCtrl, DummyKey


Lastly the connection between a character and the corresponding key is made by KeyPressCombos, defined under KeyAccess:

  <KeyAccess>
    <KeyPressCombo PressChar="^" KeyChar="^" />
    <KeyPressCombo PressChar="°" KeyChar="^" ControlKeyChar="RightShift" />
    <KeyPressCombo PressChar="a" KeyChar="A" />
    <KeyPressCombo PressChar="A" KeyChar="A" ControlKeyChar="RightShift" />
    <KeyPressCombo PressChar="s" KeyChar="S" />
    <KeyPressCombo PressChar="S" KeyChar="S" ControlKeyChar="RightShift" />
  </KeyAccess>

 A keypress combo contains two character definitions, since the keyboard layouts are in UTF-8 it should not be a problem to store character definitions for any possible character table. The PressChar attribute defines the character that is generated by the keypresscombo, the KeyChar specifies which KeyDef has to be used. Since the normal characters are all written in capitals on the keyboard, but when pressed without shift a lower case character is created, the keyboard combos shown above are generated. 
Again, the keywords for the control keys must not be translated.
 
 
  
