This chapter explains how to implement Thai input methods with different types of applications, introduces the different input methods, and describes the input sequence checking modes that are provided with the Compaq Tru64 UNIX operating system software.
The input methods for entering Thai characters include:
The input sequence checking modes provided with the Compaq Tru64 UNIX operating system are:
For character-cell terminal applications, Thai input methods are implemented by the firmware of the VT382-T Thai terminal or incorporated in the terminal emulation software, such as Thai DECterm. Applications need not provide code to handle the input of Thai characters; they can rely on the VT382-T terminal or Thai DECterm to provide the input method services.
Thai DECterm can be regarded as one of the DECwindows Motif applications. Therefore, the activating and deactivating methods follow those of DECwindows Motif, as discussed in Section 7.2.
For VT382-T terminals, the input mode can be selected using the [Thai] key, which is equivalent to the [Compose] key on a standard LK201 keyboard or the [Left-Compose] key on a standard LK401 keyboard. On the Thai version of the LK201 or LK401 keyboard (LK201-T or LK401-T) the [Thai] key is labeled in Thai.
After the Thai input mode is activated, the firmware of the VT382-T terminal or the input methods incorporated in Thai DECterm allow for entering Thai characters and return the input data as appropriate.
The X Window System provides a mechanism for associating encodings of symbols which are usually printed on keycaps (called KeySyms) with physical or logical keys. Each key is associated with a list of KeySyms. Depending on the Shift/Lock state, different KeySyms are obtained by pressing the same key. For instance, in the case of U.S. English keyboard, the input of "3" or "#" is switched by the shift state. The standard mechanism for supporting two KeySyms per key was established in Release 3 of the X Window System.
This support is insufficient for some languages, such as Hebrew and Thai, which require more KeySyms in order to support the native languages. In Relese 4, the Mode Switch mechanism was introduced to allow switching of Group 1 and Group 2 characters, where Group 1 is ASCII KeySyms and Group 2 is native language characters. The Mode Switch mechanism works as a Group Shift key for these languages.
In addition, you can input different sets of characters through the same keyboard by changing the associated KeySyms.
In the X Consortium's release of X Window System, the Mode Switch On state is effective only for entering one single character. After the character is entered, the Mode Switch state is reset. In the Compaq Tru64 UNIX implementation, the Mode Switch mechanism is enhanced to support both single-shot switching and locking-shift switching, depending on the keymap definition. In the latter case, when the Mode Switch state is set, it remains unchanged until the Mode Switch key is pressed again to modify the state.
Note
On Compaq Tru64 UNIX operating system servers, a locking "mode switch" mechanism is used to switch between the Thai and English input modes. On servers where the locking "mode switch" is absent, the Thai input mode can still be entered by pressing the key corresponding to the XK_Multi_key KeySym. In contrast to the locking "mode switch" mechanism, the XK_Multi_key affects one input context only.
For setting Thai KeySyms, DECwindows Motif provides the keymaps shown in Table 7-1.
Keymap |
Keyboard |
---|---|
thai lk201t |
LK201-T |
thai lk201wtt |
LK201-T |
thai lk401t |
LK401-T |
thai lk401wtt |
LK401-T |
thai lk443t |
LK443-T |
thai lk443wtt |
LK443-T |
thai pcxalt |
PCXAL-T |
thai pcxalwtt |
PCXAL-T |
The keymaps in Table 7-1 support locking-shift mode switching. With these keymaps, you can enter English characters in the Mode Switch Off state and Thai characters in the Mode Switch On state.
The effect of setting the Mode Switch on is similar to that of entering the Thai input mode on the VT382-T terminal.
The procedures for activating the Thai input mode on VT terminals, DECwindows Motif, or CDE are similar. You need to load a Thai keymap in order to input Thai characters on DECwindows Motif and CDE; for VT terminals, you can skip this step.
If you are using XDM to load a Thai keymap, choose the Keyboard... menu item from the Customize menu of the Session Manager. The Keyboard dialog box is displayed and you can choose the Thai keymap associated with the keyboard connected to your workstation. For instance, if you have a Thai LK401-T keyboard and you want to use the Gatemanee layout, you would choose "thai lk401t".
If you are using CDE, you can load the Thai keymaps by clicking the keyboard options in Application Manager.
The keymap is a global attribute to a display device. After you select a keymap, the keymap is effective to all client applications running on your display device. If you plan to run applications in different languages, you should check to determine if there are conflicts between the keymap that you are using and the keymap required by those languages.
To input Thai characters, switch the input mode to Thai. In this mode, you can input Thai characters by pressing keys on the main keyboard. On a Thai keyboard, the Thai characters are printed on the right-hand side of the keycaps. See Chapter 6 for illustrations of the Thai Keyboard layouts.
The key sequences for activating the Thai input mode are shown in Table 7-2.
Keyboard Types |
Thai Key Sequence |
---|---|
VT Terminals |
[Thai] |
DECwindows Motif |
|
[Thai/Space] |
|
[Thai] |
You can press the appropriate Thai key sequence to toggle between the English input mode and the Thai input mode.
Most Thai characters defined in Thai Industrial Standard (TIS) 620-2533 are found on the keycaps of the main keyboard; you enter them directly by pressing the respective keys. However, there are 7 Thai characters which do not appear on the supported keyboard layouts. To enter these characters, you can use Special Thai character input method or hexadecimal input method.
You can enter the special characters in Thai input mode by pressing designated keys while holding down the [Shift/Thai] key on a LK201-T keyboard or the [Shift/Alt] key on a LK401-T keyboard. The special characters, designated keys, and keyboards are listed in Table 7-3.
Character | Hex Code |
Designated Key |
LK201 |
LK401 |
---|---|---|---|---|
KHO KHUAT |
A3 |
KHO KHAI |
[Shift/Thai/-] |
[Shift/Alt/-] |
KHO KHON |
A5 |
KHO KHWAI |
[Shift/Thai/8] |
[Shift/Alt/8] |
LAKKHANGYAO |
E5 |
SARA AA |
[Shift/Thai/K] |
[Shift/Alt/K] |
YAMAKKAN |
EE |
SARA AM |
[Shift/Thai/E] |
[Shift/Alt/E] |
FONGMAN |
EF |
MAIYAMOK |
[Shift/Thai/Q] |
[Shift/Alt/Q] |
ANGKHANKHU |
FA |
NO NU |
[Shift/Thai/O] |
[Shift/Alt/O] |
KHOMUT |
FB |
PHO PHUNG |
[Shift/Thai/Z] |
[Shift/Alt/Z] |
Note:
The Special Thai Character Input method cannot be used in English input mode.
You can enter special Thai characters by specifying their hexadecimal (Hex) codes.
On a VT382-T Thai terminal, you invoke the Hex input mode by pressing [Ctrl/Thai], then releasing it.
For DECwindows Motif, you invoke the Hex input mode by pressing and releasing [Ctrl/Thai] on an LK201-T keyboard or [Ctrl/Alt] on an LK401-T keyboard.
Note
You can invoke Hex input mode either from English input mode or Thai input mode.
Once in Hex input mode, you input a two-digit hexadecimal code to enter a special character. For example, if you want to enter the Thai character FONGMAN (EF), press:
[Ctrl/Thai] [E] [F]
After the hexadecimal code is entered, you exit Hex input mode. You must reactivate Hex input mode to enter another hexadecimal code.
To input English characters, set Thai mode to off. In this mode, you can input English letters, numeric characters, and punctuation marks by pressing keys on the main keyboard. On a Thai keyboard, the characters or symbols are printed on the left side of the keycaps.
The Compaq Tru64 UNIX operating system software supports the following Thai input sequence check modes:
The way you select input sequence check mode depends on whether you are using DECwindows Motif or running character-cell terminal applications.
In DECwindows Motif, you can select an input sequence check mode in one of two ways:
Table 7-4 shows the value of the XMODIFIERS parameter that you set for the various input sequence check modes.
Input Sequence Check Mode |
XMODIFIERS |
---|---|
NISC/Passthrough |
@im=Pasthrough |
VT382-T ISC |
@im=VT382T |
WTT Basic |
@im=BasicCheck |
WTT Strict |
@im=Strict |
By default, the input mode is WTT Basic mode.
For example, you can start Cardfiler in WTT Strict mode and Calendar in Passthrough mode with the following script:
#! /usr/bin/sh # # Please uncomment the following lines to # make sure the session is in proper # language. # # echo "*xnlLanguage:\tth_TH.TACTIS" | \ # /usr/bin/X11/xrdb -merge # XMODIFIERS=@im=Strict export XMODIFIERS /usr/bin/X11/dxcardfiler & # # XMODIFIERS=@im=Passthrough export XMODIFIERS /usr/bin/X11/dxcalendar & # #
For Thai DECterm, you can select the Thai input sequence mode through the General Option... dialog box. For details, see Chapter 9.
For VT382-T Thai terminal, the Passthrough mode and the VT382-T Input Sequence Check mode are supported by the terminal itself. You can select one of these input modes through the terminal's Setup menu. The other two input sequence check modes, WTT Basic and WWW Strict, can be supported through the Thai terminal driver. By default, the input sequence check mode is set to WTT Basic mode. To switch the input sequence check mode, you can use the following command:
% stty isc <mode>
The <mode> variable can be one of the following values:
For the details about the Thai terminal driver, see Chapter 9.
Note
The input sequence checking mechanism supported by the Thai terminal driver is disabled in the CBREAK or RAW mode. For details, see the cbreak and raw reference pages.
In this mode, Thai characters can be entered in arbitrary order. No checking is performed on the sequence of input data.
This input mode provides more freedom for applications to handle input data by themselves. However, data can be entered in invalid order and applications need to handle it properly.
Thai characters of different display levels can be combined in six valid patterns, as shown in Figure 7-1.
Entering combinations other than these patterns will not produce correct Thai script writing syntax, and a warning bell will ring to signify possible typographical errors.
The VT382-T ISC algorithm checks only the combination of Thai characters; not their order. The following data sequences represent the same character sequence and their appearance on screen is identical:
The rule is that base level characters are entered first. They are used as delimiters for character columns. The order of other characters in the same column does not matter.
To simplify the implementation, a lookup table, Table 7-5, is used to determine the valid combinations of Thai characters.
C |
C |
T |
|||||||||||||||
N |
O |
F |
F |
F |
T |
B |
B |
O |
A |
A |
A |
A |
A |
A |
|||
O |
N |
L |
V |
V |
V |
R |
V |
V |
B |
N |
D |
D |
D |
V |
V |
V |
|
N |
S |
V |
1 |
2 |
3 |
L |
1 |
2 |
D |
E |
1 |
2 |
3 |
1 |
2 |
3 |
|
NON |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
CONS |
A |
A |
A |
A |
A |
A |
X |
C |
C |
C |
C |
C |
C |
C |
C |
C |
C |
LV |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
FV1 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
FV2 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
FV3 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
CTRL |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
BV1 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
C |
C |
R |
R |
R |
R |
R |
BV2 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
C |
R |
R |
R |
R |
R |
R |
BD |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
TONE |
A |
A |
A |
A |
A |
A |
X |
C |
C |
R |
R |
R |
R |
R |
C |
C |
C |
AD1 |
A |
A |
A |
A |
A |
A |
X |
C |
R |
R |
R |
R |
R |
R |
C |
R |
R |
AD2 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
C |
AD3 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
AV1 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
C |
C |
R |
R |
R |
R |
R |
AV2 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
C |
R |
R |
R |
R |
R |
R |
AV3 |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
C |
R |
C |
R |
R |
R |
R |
Horizontal - following byte
Value |
Meaning |
Where to display |
---|---|---|
A |
Accept |
Next display cell |
C |
Accept & Compose |
Same display cell |
R |
Reject |
|
X |
Accept but not Display |
|
Note
The VT382-T Thai terminal supports an older version of TIS 620, namely TIS 620-2529. In TIS 620-2529, the character YAMAKKAN is classified as a base level character and its behavior is different from that described in this table.
The WTT Basic mode is similar to the VT382-T ISC mode, but it is stricter. It accepts Thai data entered in only the following sequences:
Data in the following sequences is not allowed:
In the Compaq Tru64 UNIX operating system, WTT Basic is the default input sequence check mode.
For details, see Table 76.
In addition to the combinations rejected by the WTT Basic mode, the WTT Strict mode adds more conditions to eliminate illegal input sequences. The WTT Strict mode can further improve the correctness of input data.
For details, see Table 76.
C |
C |
T |
|||||||||||||||
N |
O |
F |
F |
F |
T |
B |
B |
O |
A |
A |
A |
A |
A |
A |
|||
O |
N |
L |
V |
V |
V |
R |
V |
V |
B |
N |
D |
D |
D |
V |
V |
V |
|
N |
S |
V |
1 |
2 |
3 |
L |
1 |
2 |
D |
E |
1 |
2 |
3 |
1 |
2 |
3 |
|
NON |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
CONS |
A |
A |
A |
A |
S |
A |
X |
C |
C |
C |
C |
C |
C |
C |
C |
C |
C |
LV |
S |
A |
S |
S |
S |
S |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
FV1 |
A |
A |
A |
A |
S |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
FV2 |
A |
A |
A |
A |
S |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
FV3 |
A |
A |
A |
S |
A |
S |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
CTRL |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
BV1 |
A |
A |
A |
A |
S |
A |
X |
R |
R |
R |
C |
C |
R |
R |
R |
R |
R |
BV2 |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
C |
R |
R |
R |
R |
R |
R |
BD |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
TONE |
A |
A |
A |
A |
A |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
AD1 |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
AD2 |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
AD3 |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
R |
R |
R |
R |
R |
R |
R |
AV1 |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
C |
C |
R |
R |
R |
R |
R |
AV2 |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
C |
R |
R |
R |
R |
R |
R |
AV3 |
A |
A |
A |
S |
S |
A |
X |
R |
R |
R |
C |
R |
C |
R |
R |
R |
R |
* Vertical - leading byte
Horizontal - Following byte
Note
The values highlighted in Table 7-6 have been modified since the original WTT input sequence checking table.
Value |
Meaning |
Basic |
Strict |
Where to display |
---|---|---|---|---|
A |
Accept |
Accept |
Accept |
Next display cell |
C |
Accept & Compose |
Accept |
Accept |
Same display cell |
S |
Strict Mode Reject |
Accept |
Reject |
Next display cell |
R |
Reject |
Reject |
Reject |
|
X |
Accept but not display |
Accept |
Accept |
|