BabelPad Help : Custom Input Method file format



File Format

The Custom Input Method file defines keyboard mappings and/or text input mappings that can be used for a custom input method in BabelPad. The keyboard mappings allow for the definition of a simple keyboard layout with support for AltGr (or Ctrl + Alt) key combinations and dead keys (including chaining dead keys). The text input mappings allow for the definition of a table-based text input method similar to that used by the Microsoft Table Driven Text Input Process Service. The file should be encoded as UTF-8, and include one or both of the two sections described below, in any order. Blank lines and comment lines prefaced by "//" are ignored. A number of sample input method and keyboard layout files for various Unicode scripts are available here.

You can create a file that only defines a keyboard layout or only defines text input mappings. You can also combine the two, for example defining text input mappings for a particular script, but also defining keyboard mappings for punctuation marks and symbols used for the script. You could use the characters a-z for text input (e.g. "cat" = 🐈), but also enter a-z as letters by defining keyboard mappings for AltGr+a through AltGr-z to a-z.

If both [Mapping] and [Text] sections are defined, then the keyboard mappings are applied only if there is no pending text input. As an example, suppose you define a keyboard mapping of $ to € in the [Mapping] section, and define a text input mapping of "bank$" to πŸ’΅ in the [Text] section. If the text input buffer is empty and you hit the $ key then the € character will be immediately inserted into your document. If you then enter the text "bank" you will get a list of matching candidates such as 🏦 (bank), πŸ’³ (bankcard), πŸ’΄ (bankY), πŸ’΅ (bank$), πŸ’Ά (bankE), and πŸ’· (bankL); if you next hit the $ sign, the list of matching candidates will be reduced to πŸ’΅ alone. In addition to the [Mapping] and [Text] sections there is also an optional [Options] section.


Mapping

This section provides keyboard mappings and is headed by "[Mapping]" (not case sensitive) on a line by itself. Following the heading should be one or more entries for keyboard mappings. Each entry should consist of two tab-separated fields for simple mappings or three tab-separated fields for dead key sequences, with an optional comment field at the end:

[Mapping]

// Simple mappings

A Γ… Latin Capital Letter a with Ring Above

a Γ₯ Latin Small Letter a with Ring Above


// Simple mappings with AltGr

^A Γ†

^a Γ¦


// Single dead key

a Γ€ "

e Γ« "


// Chaining dead keys

a ǟ " _

a ǟ _ "


// Dead key with AltGr on base character and dead key

^s αΊ› ^. Latin Small Letter Long S with Dot Above


Text

This section provides text mappings and is headed by "[Text]" (not case sensitive) on a line by itself. Following the heading should be one or more entries for text mappings. Each entry should consist of two tab-separated fields, with an optional comment field at the end:

[Text]

// text to emoji mappings

cat 🐈

dog πŸ•

fish 🐟

fishes 🐟🐠🐑

train πŸš‚πŸšƒπŸšƒπŸšƒπŸšƒπŸšƒπŸšƒπŸšƒ steam train with seven carriages


Input text entries do not need to be unique (e.g. you could map "camel" to πŸͺ and "camel" to 🐫, and when "camel" is entered πŸͺ and 🐫 will both be listed, and the user needs to manually select which camel they want). There is no limit to the length of either the input string or the Unicode mapping.

Note that if the input text strings include any of the digits 0-9, the user will not be able to select a candidate from the numbered candidate list using a number key if that particular number forms a valid candidate if treated as text input.

Candidates matching the user's text input are listed by BabelPad in the order defined in the custom input method file. Note that it is more efficient if text input strings starting with the same character are grouped together.

[Text]

camel πŸͺ dromedary

camel 🐫 bactrian

camels πŸͺ🐫

cat 🐈

catface 🐱

cata 😸

catb 😹

catc 😺

catd 😻

cate 😼

catf 😽

catg 😾

cath 😿

cati πŸ™€

dog πŸ•


Options

This optional section allows for the definition of the following options, all of which are only applicable to text input methods.


If the Font option is omitted then the currently-defined single font will be used for the candidate list, and if the Size option is omitted then the candidate list font will be set to 12 points.


[Options]

Font=Arial Unicode MS

Size=20

Wildcards=true

Shift=#


If wildcards are enabled, then the following wildcards may be used for the text input method. NB If wildcards are enabled, then none of the wildcard characters should be defined in the [Mapping] section.


The shift option facilitates typing with a single hand by allowing you to specify a key which will cause the following key to be treated as shifted. For example, if you specify "Shift=#" in the Options section, typing '#' followed by 'a' will result in 'A' being output.



See Also



Download | Help Contents