Keyman Developer Tutorial
Adding a Touch Keyboard
This session we will modify a desktop keyboard for the Dagbani language of Ghana to add a touch keyboard for Dagbani.
1. Start Keyman Developer.
2. In the Project menu, point to Recent Projects, click DagbaniTutorial.kpj.
3. In the Project - Keyboard dialog box, click Keyboards. Then click dagbanitutorial.kmn. The Details pagee appears.
4. Click Touch Layout. The Touch Layout page appears. There is a Design tab and a Code tab. The Code tab shows us the code that Keyman compiles to build the keyboard. The Design tab shows a pictorial picture of the keyboard. We will be using the Design tab. Click Design tab.
At the top of the Touch Layout pane, in the Platform dropdown, we can select phone or tablet. These are represented by iPhone and iPad graphical representations, but they will work on Android as well. We have the flexibility to have a different number of rows or columns of keys on the tablet and phone layouts, and so Keyman keeps them separate. If we want the exact same key structure on both, then select one of the two from the Platform dropdown. It is a lot of extra work to maintain two identical layouts. Keyman will automatically use the tablet if phone is not present or the phone if tablet is not present. Only if we want to make the tablet and phone layouts different, would we want to have both. In our case, we want select phone only. So, click on the adjacent Add and select phone in the Platform dropdown. Then click OK. Now select tablet in the Platform dropdown and select the adjacent Del buttons to remove tablet from the dropdown list. We should only have phone on the dropdown list.
Note that another option for generating a tablet keyboard is to import the desktop keyboard by clicking Import from On Screen since the tablet platform has as many keys as we have on the desktop platform. Doing this would mean that the tablet keyboard would have the same keystrokes as the desktop keyboard to generate the special characters.
Our touch keyboard will have three layers: default, shift and numeric. We will initially work with the default layout. So, to indicate what layer we are on, set the Layer dropdown to default.
The Touch layout tab has a Character Map pane that we will be using to enter special keys onto the touch keyboard. On the bottom of the pane, there is a Search box for a short description of the Unicode character that we are looking for (e.g. open e). The search box acts a filter of all the Unicode characters. So, by entering open e in the search box will display only those characters that have open e in their description. When we find the desired character in the list, we click on it to select it. It will be highlighted. Note that above the Search box will be a full Unicode description of the selected key. To copy the special character to a key, select the key and then double-click it.
On the Touch layout page, we can start handling the additional characters. Remembering that all special characters on a touch keyboard must be visible somewhere, there are at least four options to add them to an existing keyboard. In the case of adding an open o to a Latin keyboard we could:
- Placed the open o on an unused key, like x.
- Placed the open o on a long-press popup so that long-pressing o gives the option to select it,
- Place the open o on a different layer that appears when the activating key is pressed. Keyman has some different layer names (based on keyboard modifiers) that are predefined, plus a numeric layer, but custom layer names can be added.
- Add a dedicate open o key to our keyboard.
5. So, let's look at the first case. We will replace the x key with open o. Click on the x key and delete the x. In the character map, search for open o. Click on the open o (U+0254). Then double-click it. Then in the Code box, enter U_0254.
We will replace the q key with open e. Click on the q key and delete the q. In the character map, search for open e. Click on the open e (U+025B). Then double-click it. Then in the Code box, enter U_025B.
Now save our work by clicking on the Save icon.
6. So,let’s look at the second case. We will add a long-press on o key for the open o. Click on the o key. Then click Add longpress popup. In the Character Map, search for open o. Click on the open o (U+0254). Then double-click it. Then in the Code box, enter U_0254.
We will add a long-press on the e key for the open e. Click on the e key. Then click Add longpress popup. In the Character Map, search for open e. Click on the open o (U+025B). Then double-click it. Then in the Code box, enter U_025B.
If we need to add another character to the long-press popup. Depending on where we want it to be on the popup list, click one of the two plus in a green triangle icon and enter the current long-press character. To delete a character from the long-press popup, select the appropriate popup key and click the x in a red circle icon.
Now save our work, by clicking on the Save icon.
7. So, let’s look at the third case. We could add the open o to the numeric layer so that tapping numeric keythen vertical bar key will produce the open o. First, we will change the Layer box to display numeric, by clicking the down arrow of the Layer box and selecting numeric. Click on the vertical bar key. In the Character Map, search for open o. Click on the open o (U+0254). Then double-click it. Then in the Code box, enter U_0254.