OSSO Virtual Keyboard File Format Specification

version 0.53, 31.01.2006

Mohammad Anwari <Mohammad.Anwari@nokia.com>

ChangeLog

0.10  11.03.2005  Mohammad Anwari   initial document
0.15  14.03.2005  Mohammad Anwari   changed the structure:
                                    - removing state (this is runtime value)
                                    changed namespace from HILDON to osso
0.20  17.03.2005  Mohammad Anwari   added type of layout in file
                                    structure
0.25  18.03.2005  Mohammad Anwari   added Special key with scan codes 
0.30  08.04.2005  Mohammad Anwari   changed the key type
                                    and addition of numeric state
0.35  11.04.2005  Mohammad Anwari   added lang, wc, and name
0.50  10.10.2005  Mohammad Anwari   multiple layout support
0.51  09.11.2005  Mohammad Anwari   added key size and split keyboard and
                                    numeric keypad into key sections
0.52  17.11.2005  Mohammad Anwari   redesign key size information
0.53  31.01.2006  Mohammad Anwari   added variance index

Overview

This document describes the file structure of the virtual keyboard layout and API to load it into memory. This file specification attempts to save multiple layout of keyboard in a single file. Each layout can have individual configuration of the number of keys and rows. This file specification was designed to have a fast loading time of the file and fast accessibility to each layout inside the file in the memory. All labels and strings used here use utf-8 encoding. libimlayout only reads and provides in memory representation of the virtual keyboard layout, the rendering of the layout is not within the scope.

Layout

A vkb file could have more than one layout. And each layout could have more than one sublayout.

Some possibilities of .vkb content:

+ File Name:                    en_GB.vkb
+ Number of Layout:             2
+ Layout 1
  - Type:                       HILDON_VKB_LAYOUT_NORMAL
  - Number of Sub Layout:       2
  - Sub Layout 1
    * Type:                     HILDON_VKB_LAYOUT_LOWERCASE
  - Sub Layout 2
    * Type:                     HILDON_VKB_LAYOUT_UPPERCASE
+ Layout 2
  - Type:                       HILDON_VKB_LAYOUT_THUMB
  - Number of Sub Layout:       1
  - Sub Layout 1
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE

+ File Name:                    en_US.vkb
+ Number of Layout:             3
+ Layout 1
  - Type:                       HILDON_VKB_LAYOUT_NORMAL
  - Number of Sub Layout:       2
  - Sub Layout 1
    * Type:                     HILDON_VKB_LAYOUT_LOWERCASE
  - Sub Layout 2
    * Type:                     HILDON_VKB_LAYOUT_UPPERCASE
+ Layout 2
  - Type:                       HILDON_VKB_LAYOUT_SMALL
  - Number of Sub Layout:       2
  - Sub Layout 1
    * Type:                     HILDON_VKB_LAYOUT_LOWERCASE
  - Sub Layout 2
    * Type:                     HILDON_VKB_LAYOUT_UPPERCASE
+ Layout 2
  - Type:                       HILDON_VKB_LAYOUT_THUMB
  - Number of Sub Layout:       1
  - Sub Layout 1
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE

+ File Name:                    latin.special.vkb
+ Number of Layout:             1
+ Layout 1
  - Type:                       HILDON_VKB_LAYOUT_SPECIAL
  - Number of Sub Layout:       4
  - Sub Layout 1
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE
    * Label:                    Common
  - Sub Layout 2
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE
    * Label:                    Symbols
  - Sub Layout 1
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE
    * Label:                    Accents a-m
  - Sub Layout 1
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE
    * Label:                    Accents n-z


+ File Name:                    zh_ZH.vkb
+ Number of Layout:             3
+ Layout 1
  - Type:                       HILDON_VKB_LAYOUT_PINYIN
  - Number of Sub Layout:       1
  - Sub Layout 1
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE
+ Layout 2
  - Type:                       HILDON_VKB_LAYOUT_ZHUYIN
  - Number of Sub Layout:       1
  - Sub Layout 1
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE
+ Layout 3
  - Type:                       HILDON_VKB_LAYOUT_CANGJIE
  - Number of Sub Layout:       1
  - Sub Layout 1
    * Type:                     HILDON_VKB_SUBLAYOUT_SINGLE

Keys

There are three kind of keys supported:

Each key could have these attributes:

File Structure

Offset  Type      Size  Description
------------------------------ Header Section
0000    Byte      1     Version
0001    Byte      1     Number of Layout
0003    Byte      1     Length of Name
0004    String    *     Name
....    Byte      1     Length of Language Code
....    String    *     Language Code
....    Byte      1     Length of Word Completion Locale
....    String    *     Word Completion Locale
....    Byte      1     Number of screen mode supported
....    Array     *     Array of screen modes
        of Bytes
....    Byte      *     Number of key size available
....    Array     *     --Read Key Size section--
        of Key Size 
....    Int       *     Array of Layout offsets
....    Byte      20    reserved
....    Array     *     --Read Layout section--
        of Layout

------------------------------ Key Size Section
0000    Byte      1     Key Width
0001    Byte      1     Key Height
0002    Byte      1     Baseline
0002    Byte      4     Key Margins
------------------------------ End of Key Size Section

------------------------------ Layout Section
0000    Byte      1     Type of Layout
0001    Byte      1     Number of Sub Layout
0002    Byte      1     Numeric Layout      
0003    Byte      1     Default index of key size
....    Array     *     --Read Sub Layout section--
        of Sub Layout
------------------------------ End of Layout Section

------------------------------ Sub Layout Section
0000    Byte      1     Type of Sub Layout
0001    Byte      1     Variance Index
0002    Byte      1     Length of Label
....    Array     *     Label
        of bytes
....    Byte      1     Number of key sections
....    Array     *     --Read key section--
        of Key Section
------------------------------ End of Sub Layout

------------------------------ Key Section
0000    Byte      1     Number of Keys
0001    Byte      1     Number of Rows
0002    Byte      4     Margins
000.    Array     *     Number of Keys in Rows
        of bytes  (size depends on Number of Rows value)
....    Array     *     --Read button section--
        of Keys
------------------------------ End of Key Section


------------------------------ Button Section
0000    Byte      1     Type                  
------------------------------ Multiple Button Section
                              if Type is a multiple key
0000    Byte      1     Number of multiple keys
....    Array     *     --Read standard button--
        of Standard Key
------------------------------ End of Multiple Key Section
------------------------------ Standard Button Section
0000    Byte      1     Type    If the key is not a multiple key
                                then this byte is not read
................................
0001    Byte      1     Attribute
                  if (the eighth bit is set then size is 2 bytes)
000.    Byte      1     Length of the Label
                        If the eigth bit is set then Label is a string of array
                        (\0 delimited for each entry) with size Length
000.    String    *     Label
                  (size depends on the Length of the Label)
000.    Byte      1     Key size index
------------------------------ if Key attribute is RAW
000.    Byte      1     Length of the scan code
000.    Array     *     scan code
        of bytes
------------------------------ End of Standard Button Section
------------------------------ End of Button Section

API

See imlayout_vkb.h file