SC UniPad - The Unicode Text Editor

Home | Download | Register | FAQ | Keyboard | TechInfo | History | Links | UniMap

>> Virtual Keyboard : Features Roadmap : How to create Keyboards


Virtual Keyboard


Technical Background

UniPad provides a keyboard emulation so the keyboard layout can be changed independently from the Windows system layout. There exist two possible solutions to provide an emulation (without writing a real keyboard driver):

  1. One have to map all characters from the US keyboard layout. Some available multilingual applications use this method. It has a main disadvantage. Users outside the US have to explicitly select the US keyboard to work with the application. Even worse, AltGr combinations can't be defined.
  2. The second method (used by UniPad) by-passes the keyboard driver. UniPad directly interprets the codes of the physical keys (scan codes) to map them to a specific character. This has a disadvantage, too. Scan codes depend on the keyboard type. We decided to support the PC/AT Enhanced Keyboard, (MF II with 101/102 keys) because it is used most often. At the moment UniPad cannot support other keyboard types.
The UniPad Keyboard Layout

The following picture shows the key codes (decimal) for the keyboard layout definition used by UniPad and the corresponding characters on a US layout. The key codes of UniPad are based on the scan codes of the keyboard hardware, but they are not always identical to them (e.g. for the numeric key pad). The key with code 86 is not available on all MF II keyboards. It's mainly used with European keyboards for additional characters.



The positions of the keys 41, 43 and 86 may vary on several available keyboards. We found that the layout above is used most often. If your keyboard varies, please let us know. At the moment we can't support other keyboard layouts, but we would like to know it anyway, so we can document existing variations.

Format of the Definition File

UniPad's keyboard layout definition file are based on the extensible Markup Language (XML). You can find the corresponding document type definition (DTD) here: http://www.unipad.org/dtd/keyboard.dtd.

The file must have the extension .ukb. The format is UTF-8, although no characters outside the ASCII range are used at the moment.

The file should start with the general XML declaration followed by the document type declaration.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE keyboard SYSTEM "http://www.unipad.org/dtd/keyboard.dtd">

The root element is keyboard which has no attributes. That is, all other elements are enclosed by the keyboard element:

<keyboard>
  ...
</keyboard>

Each key of the keyboard is defined by the key element. The attribute code identifies the corresponding key. The key code is based on the hardware scan code, as described above. The key element contains a state element for each keyboard state. If the key definition for a specific keyboard state is omitted, no character is produced. The attribue name identifies the corresponding keyboard state. Possible values are:

norm No additional key is pressed.
capi Shift is pressed or Caps Lock is active.
algr AltGr is pressed.
acap AltGr + Shift are pressed or AltGr is pressed while Caps Lock is active.

AltGr is equivalent to Alt + Ctrl. Combinations of character keys with Alt or Ctrl alone are not allowed, because these combinations are assigned to menu shortcuts and application commands. Shift can't be used with the digits on the numeric block, because it is used by Windows to temporarily deactivate the Num Lock key.

Each state element contains only one char element which is empty. The attribute code identifies the corresponding Unicode character. The character code is specified by the U+XXXX notation (e. g. Latin letter A is U+0041). Character codes outside the Basic Multilingual Plane (> U+FFFF) are allowed with U+XXXXX and U+XXXXXX.

Overview of the key element:

<key code="kkk">
  <state name="ssss">
    <char code="U+cccc"/>
  </state>
  ...
</key>

Example of a definition file

The following example shows the definition for the Greek keyboard layout.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE keyboard SYSTEM "http://www.unipad.org/dtd/keyboard.dtd">
<!-- Generated by SC UniPad, www.unipad.org -->

<keyboard>

  <key code="2">
    <state name="norm"> <char code="U+0031"/> </state>
    <state name="capi"> <char code="U+0021"/> </state>
  </key>

  <key code="3">
    <state name="norm"> <char code="U+0032"/> </state>
    <state name="capi"> <char code="U+0040"/> </state>
    <state name="algr"> <char code="U+00B2"/> </state>
  </key>

  <key code="4">
    <state name="norm"> <char code="U+0033"/> </state>
    <state name="capi"> <char code="U+0023"/> </state>
    <state name="algr"> <char code="U+00B3"/> </state>
  </key>

  <key code="5">
    <state name="norm"> <char code="U+0034"/> </state>
    <state name="capi"> <char code="U+0024"/> </state>
    <state name="algr"> <char code="U+00A3"/> </state>
  </key>

  <key code="6">
    <state name="norm"> <char code="U+0035"/> </state>
    <state name="capi"> <char code="U+0025"/> </state>
    <state name="algr"> <char code="U+00A7"/> </state>
  </key>

  <key code="7">
    <state name="norm"> <char code="U+0036"/> </state>
    <state name="capi"> <char code="U+005E"/> </state>
    <state name="algr"> <char code="U+00B6"/> </state>
  </key>

  <key code="8">
    <state name="norm"> <char code="U+0037"/> </state>
    <state name="capi"> <char code="U+0026"/> </state>
  </key>

  <key code="9">
    <state name="norm"> <char code="U+0038"/> </state>
    <state name="capi"> <char code="U+002A"/> </state>
    <state name="algr"> <char code="U+00A4"/> </state>
  </key>

  <key code="10">
    <state name="norm"> <char code="U+0039"/> </state>
    <state name="capi"> <char code="U+0028"/> </state>
    <state name="algr"> <char code="U+00A6"/> </state>
  </key>

  <key code="11">
    <state name="norm"> <char code="U+0030"/> </state>
    <state name="capi"> <char code="U+0029"/> </state>
    <state name="algr"> <char code="U+00B0"/> </state>
  </key>

  <key code="12">
    <state name="norm"> <char code="U+002D"/> </state>
    <state name="capi"> <char code="U+005F"/> </state>
    <state name="algr"> <char code="U+00B1"/> </state>
  </key>

  <key code="13">
    <state name="norm"> <char code="U+003D"/> </state>
    <state name="capi"> <char code="U+002B"/> </state>
    <state name="algr"> <char code="U+00BD"/> </state>
  </key>

  <key code="16">
    <state name="norm"> <char code="U+003B"/> </state>
    <state name="capi"> <char code="U+003A"/> </state>
  </key>

  <key code="17">
    <state name="norm"> <char code="U+03C2"/> </state>
    <state name="capi"> <char code="U+0344"/> </state>
  </key>

  <key code="18">
    <state name="norm"> <char code="U+03B5"/> </state>
    <state name="capi"> <char code="U+0395"/> </state>
    <state name="algr"> <char code="U+20AC"/> </state>
  </key>

  <key code="19">
    <state name="norm"> <char code="U+03C1"/> </state>
    <state name="capi"> <char code="U+03A1"/> </state>
    <state name="algr"> <char code="U+00AE"/> </state>
  </key>

  <key code="20">
    <state name="norm"> <char code="U+03C4"/> </state>
    <state name="capi"> <char code="U+03A4"/> </state>
  </key>

  <key code="21">
    <state name="norm"> <char code="U+03C5"/> </state>
    <state name="capi"> <char code="U+03A5"/> </state>
    <state name="algr"> <char code="U+00A5"/> </state>
  </key>

  <key code="22">
    <state name="norm"> <char code="U+03B8"/> </state>
    <state name="capi"> <char code="U+0398"/> </state>
  </key>

  <key code="23">
    <state name="norm"> <char code="U+03B9"/> </state>
    <state name="capi"> <char code="U+0399"/> </state>
  </key>

  <key code="24">
    <state name="norm"> <char code="U+03BF"/> </state>
    <state name="capi"> <char code="U+039F"/> </state>
  </key>

  <key code="25">
    <state name="norm"> <char code="U+03C0"/> </state>
    <state name="capi"> <char code="U+03A0"/> </state>
  </key>

  <key code="26">
    <state name="norm"> <char code="U+005B"/> </state>
    <state name="capi"> <char code="U+007B"/> </state>
    <state name="algr"> <char code="U+00AB"/> </state>
  </key>

  <key code="27">
    <state name="norm"> <char code="U+005D"/> </state>
    <state name="capi"> <char code="U+007D"/> </state>
    <state name="algr"> <char code="U+00BB"/> </state>
  </key>

  <key code="30">
    <state name="norm"> <char code="U+03B1"/> </state>
    <state name="capi"> <char code="U+0391"/> </state>
  </key>

  <key code="31">
    <state name="norm"> <char code="U+03C3"/> </state>
    <state name="capi"> <char code="U+03A3"/> </state>
  </key>

  <key code="32">
    <state name="norm"> <char code="U+03B4"/> </state>
    <state name="capi"> <char code="U+0394"/> </state>
  </key>

  <key code="33">
    <state name="norm"> <char code="U+03C6"/> </state>
    <state name="capi"> <char code="U+03A6"/> </state>
  </key>

  <key code="34">
    <state name="norm"> <char code="U+03B3"/> </state>
    <state name="capi"> <char code="U+0393"/> </state>
  </key>

  <key code="35">
    <state name="norm"> <char code="U+03B7"/> </state>
    <state name="capi"> <char code="U+0397"/> </state>
  </key>

  <key code="36">
    <state name="norm"> <char code="U+03BE"/> </state>
    <state name="capi"> <char code="U+039E"/> </state>
  </key>

  <key code="37">
    <state name="norm"> <char code="U+03BA"/> </state>
    <state name="capi"> <char code="U+039A"/> </state>
  </key>

  <key code="38">
    <state name="norm"> <char code="U+03BB"/> </state>
    <state name="capi"> <char code="U+039B"/> </state>
  </key>

  <key code="39">
    <state name="norm"> <char code="U+0301"/> </state>
    <state name="capi"> <char code="U+0308"/> </state>
    <state name="algr"> <char code="U+0344"/> </state>
  </key>

  <key code="40">
    <state name="norm"> <char code="U+0027"/> </state>
    <state name="capi"> <char code="U+0022"/> </state>
  </key>

  <key code="41">
    <state name="norm"> <char code="U+0060"/> </state>
    <state name="capi"> <char code="U+007E"/> </state>
  </key>

  <key code="43">
    <state name="norm"> <char code="U+005C"/> </state>
    <state name="capi"> <char code="U+007C"/> </state>
    <state name="algr"> <char code="U+00AC"/> </state>
  </key>

  <key code="44">
    <state name="norm"> <char code="U+03B6"/> </state>
    <state name="capi"> <char code="U+0396"/> </state>
  </key>

  <key code="45">
    <state name="norm"> <char code="U+03C7"/> </state>
    <state name="capi"> <char code="U+03A7"/> </state>
  </key>

  <key code="46">
    <state name="norm"> <char code="U+03C8"/> </state>
    <state name="capi"> <char code="U+03A8"/> </state>
    <state name="algr"> <char code="U+00A9"/> </state>
  </key>

  <key code="47">
    <state name="norm"> <char code="U+03C9"/> </state>
    <state name="capi"> <char code="U+03A9"/> </state>
  </key>

  <key code="48">
    <state name="norm"> <char code="U+03B2"/> </state>
    <state name="capi"> <char code="U+0392"/> </state>
  </key>

  <key code="49">
    <state name="norm"> <char code="U+03BD"/> </state>
    <state name="capi"> <char code="U+039D"/> </state>
  </key>

  <key code="50">
    <state name="norm"> <char code="U+03BC"/> </state>
    <state name="capi"> <char code="U+039C"/> </state>
  </key>

  <key code="51">
    <state name="norm"> <char code="U+002C"/> </state>
    <state name="capi"> <char code="U+003C"/> </state>
  </key>

  <key code="52">
    <state name="norm"> <char code="U+002E"/> </state>
    <state name="capi"> <char code="U+003E"/> </state>
  </key>

  <key code="53">
    <state name="norm"> <char code="U+002F"/> </state>
    <state name="capi"> <char code="U+003F"/> </state>
  </key>

  <key code="57">
    <state name="norm"> <char code="U+0020"/> </state>
    <state name="capi"> <char code="U+0020"/> </state>
    <state name="algr"> <char code="U+0020"/> </state>
    <state name="acap"> <char code="U+0020"/> </state>
  </key>

  <key code="86">
    <state name="norm"> <char code="U+003C"/> </state>
    <state name="capi"> <char code="U+003E"/> </state>
  </key>

  <key code="100">
    <state name="norm"> <char code="U+0030"/> </state>
    <state name="capi"> <char code="U+0030"/> </state>
    <state name="algr"> <char code="U+0030"/> </state>
    <state name="acap"> <char code="U+0030"/> </state>
  </key>

  <key code="101">
    <state name="norm"> <char code="U+0031"/> </state>
    <state name="capi"> <char code="U+0031"/> </state>
    <state name="algr"> <char code="U+0031"/> </state>
    <state name="acap"> <char code="U+0031"/> </state>
  </key>

  <key code="102">
    <state name="norm"> <char code="U+0032"/> </state>
    <state name="capi"> <char code="U+0032"/> </state>
    <state name="algr"> <char code="U+0032"/> </state>
    <state name="acap"> <char code="U+0032"/> </state>
  </key>

  <key code="103">
    <state name="norm"> <char code="U+0033"/> </state>
    <state name="capi"> <char code="U+0033"/> </state>
    <state name="algr"> <char code="U+0033"/> </state>
    <state name="acap"> <char code="U+0033"/> </state>
  </key>

  <key code="104">
    <state name="norm"> <char code="U+0034"/> </state>
    <state name="capi"> <char code="U+0034"/> </state>
    <state name="algr"> <char code="U+0034"/> </state>
    <state name="acap"> <char code="U+0034"/> </state>
  </key>

  <key code="105">
    <state name="norm"> <char code="U+0035"/> </state>
    <state name="capi"> <char code="U+0035"/> </state>
    <state name="algr"> <char code="U+0035"/> </state>
    <state name="acap"> <char code="U+0035"/> </state>
  </key>

  <key code="106">
    <state name="norm"> <char code="U+0036"/> </state>
    <state name="capi"> <char code="U+0036"/> </state>
    <state name="algr"> <char code="U+0036"/> </state>
    <state name="acap"> <char code="U+0036"/> </state>
  </key>

  <key code="107">
    <state name="norm"> <char code="U+0037"/> </state>
    <state name="capi"> <char code="U+0037"/> </state>
    <state name="algr"> <char code="U+0037"/> </state>
    <state name="acap"> <char code="U+0037"/> </state>
  </key>

  <key code="108">
    <state name="norm"> <char code="U+0038"/> </state>
    <state name="capi"> <char code="U+0038"/> </state>
    <state name="algr"> <char code="U+0038"/> </state>
    <state name="acap"> <char code="U+0038"/> </state>
  </key>

  <key code="109">
    <state name="norm"> <char code="U+0039"/> </state>
    <state name="capi"> <char code="U+0039"/> </state>
    <state name="algr"> <char code="U+0039"/> </state>
    <state name="acap"> <char code="U+0039"/> </state>
  </key>

  <key code="110">
    <state name="norm"> <char code="U+002F"/> </state>
    <state name="capi"> <char code="U+002F"/> </state>
    <state name="algr"> <char code="U+002F"/> </state>
    <state name="acap"> <char code="U+002F"/> </state>
  </key>

  <key code="111">
    <state name="norm"> <char code="U+002A"/> </state>
    <state name="capi"> <char code="U+002A"/> </state>
    <state name="algr"> <char code="U+002A"/> </state>
    <state name="acap"> <char code="U+002A"/> </state>
  </key>

  <key code="112">
    <state name="norm"> <char code="U+002D"/> </state>
    <state name="capi"> <char code="U+002D"/> </state>
    <state name="algr"> <char code="U+002D"/> </state>
    <state name="acap"> <char code="U+002D"/> </state>
  </key>

  <key code="113">
    <state name="norm"> <char code="U+002B"/> </state>
    <state name="capi"> <char code="U+002B"/> </state>
    <state name="algr"> <char code="U+002B"/> </state>
    <state name="acap"> <char code="U+002B"/> </state>
  </key>

  <key code="114">
    <state name="norm"> <char code="U+002E"/> </state>
    <state name="capi"> <char code="U+002E"/> </state>
    <state name="algr"> <char code="U+002E"/> </state>
    <state name="acap"> <char code="U+002E"/> </state>
  </key>

</keyboard>



Sitemap | Privacy Policy | Contact | Copyright and Trademark notice
©1997-2015 Sharmahd Computing
+++