Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 17.0 (current version)Version 16.0Version 15.0Version 14.0Version 13.0Version 12.0Version 11.0Version 10.0Version 2.0

On this page

addKeyboards

Summary

Adds keyboards to keymanweb.

Syntax

tavultesoft.keymanweb.addKeyboards(spec[, spec...])

Parameters

spec
Type: string|Object
keyboard name string or keyboard metadata JSON object

Return Value

undefined

Description

The keyboard spec can be a string or an object. Multiple keyboard specs can be specified in a single call, which can reduce the round-trip cost of multiple calls to Keyman Cloud servers (when using Keyman Cloud).

For general information and example uses of this method, please see the Adding Keyboards page from the guide section.

Using a string

When keyboard spec is a string, the Keyman Cloud is used to source the keyboard file. Keymanweb will load webfonts and keyboard file automatically on demand. The string format is one of the following:

  • 'keyboardID': Adds a specific keyboard, linking it to the default language for the keyboard
  • '@languageID': Adds the default keyboard for the specified ISO 639-3 language code
  • 'keyboardID@languageID': Loads a specific keyboard + language combination

The keyboard catalogue is online at http://keyman.com/developer/keymanweb/keyboards.php.

Using an object

When keyboard spec is an object, then more parameters can be specified, including sourcing the keyboard from locations other than the Keyman Cloud. The specification of the object is related to the Keyman Cloud JSON API (formerly known as KeymanWeb Server Data API):

The spec object contains the following members:

name
string
Name of the keyboard.
id
string
ID (internal name) of keyboard, together with version always matches the filename of the keyboard
filename
string
url of keyboard *.js file, relative (to page) or absolute
language
array|object
An array of objects (see definition below) or single object linked to the keyboard.
rtl
boolean optional
true if the keyboard targets a right-to-left script. May be set to false or left undefined otherwise.
version
string optional
Version of keyboard *.js file

The spec.language object contains the following members:

name
string
Name of the language.
id
string
ISO 639-3 language code.
region
string optional
Required when using the Toolbar UI. May be set with one of the following region names:
  • 'World' ('un')
  • 'Africa' ('af')
  • 'Asia' ('as')
  • 'Europe' ('eu')
  • 'South America' ('sa')
  • 'North America' ('na')
  • 'Oceania' ('oc')
  • 'Central America' ('ca')
  • 'Middle East' ('me')
font
array|object optional
An array of Font objects (see definition below) or single object describing fonts for input fields and the OSK (if oskFont is not present.)
oskFont
array|object optional
An array of Font objects (see font definition below) or single object describing fonts for the OSK.

The spec.language.font object contains the following members:

family
string
Font family that KeymanWeb will provide for this font.
filename
array
Array of URLs where font resources can be accessed, relative to the fonts initialization property. Multiple font resources can be specified as platform font format support varies and KeymanWeb will pick the most appropriate for the platform.
size
string optional
Font size (in CSS dimensions). If not specified, then 1em is used.