InnerhalbNach weiteren Dokumenten suchenSupport-Ressourcen | Dieses Buch im PDF-Format herunterladen (354 KB)
Chapter 5 X Input Method ArchitectureThis chapter describes the input method architecture of X Window applications in Asian locales. The architecture is based on the X Window System Input Method Specification, which is included in X11R6 documentation, and on the X Window System Input Method Protocol (XIMP). Overview of the X Window System Input Method (XIM)The X Window System Input Method (XIM) is a mechanism to input internationalized text, that is, text using other than ASCII characters. Before the X Window System was internationalized, the mapping between keystrokes and input characters was a simple one-to-one mapping. However, the increased demand for internationalized programs forced the abandonment of simple keymapping. For example, mappings between key strokes and Chinese, Korean, or Japanese characters are very different. Without internationalization, the relevant parts of the X Window system could be depicted as follows: Figure 5-1 X Window system architecture--not internationalized
With internationalization, there is the added facility of an intelligent input method server, which can be either a library or server. Sun's X input method for Asian Solaris facilities is in the form of a server. This can be represented as follows: Figure 5-2 Solaris Input Method Server Role
X Window System internationalization involves more than just XIM. It also involves locale support and internationalized text drawing support, such as XmbDrawString() and XwcDrawString(). The X11R6 documentation provides more information on X Window System internationalization. Architecture of XIMThis section describes how XIM works. Figure 5-3 XIM Server Model
XIM Protocol InterfaceThe current XIMP in Solaris software supports the following key event handling solutions:
Front-End IM Server Type1: XIMP_FE_TYPE1All key events go through the IM server only when input conversion mode is ON to compose text. The Conversion ON key is recognized in the IM library. The Conversion OFF key is recognized in the IM server. Figure 5-4 Event Flow in XIMP_FE_TYPE1
Back-End IM Server Type2: XIMP_BE_TYPE2All key events are sent first to the IM library and then to the IM server. The IM server is responsible for sending unused key events back to the IM library. The Conversion ON/OFF key is recognized in IM server. Figure 5-5 Event flow in XIMP_BE_TYPE2
For XIMP_SYNC_BE_TYPE2, extra synchronization is done on XIMP_KEYPRESS. IM ServerThe IM server is implemented as a separate process. The Sun IM server, named htt, supports the following Asian locales:
For Korean or Chinese htt usage and options, refer to the htt(1) man pages and to the input methods chapter in the Asian Solaris user's guide appropriate to your product. The IM server comprises the following functional components:
Setting Status and Preedit StylesThe X Window System resource entries in the .Xdefaults resource file specify the status style and preedit style as described in the following sections. The default CDE settings are overTheSpot and status area. Status StylesThe Status Area displays which input mode is in effect in the IM server window. You can set the style by entering one of the following lines in the .Xdefaults resource file: Table 5-1 Status Styles
Preedit StylesMany scripts require multiple key strokes to form a single display character, syllable, symbol, ideogram, or other item. Adequate space is needed to display input keystrokes for these languages. For the Asian CDE environment, this intermediate display area is called the preedit area. The preedit area displays intermediate formations of input keystrokes while they are held in a buffer before being committed and sent to the application. The available styles of preedit area positioning are discussed in the following sections. You can set the style by placing one of the following lines in the .Xdefaults resource file: Table 5-2 Preedit Styles
On-the-Spot StyleThe on-the-spot style in the preedit area is displayed directly in the application window, and grows to the right of the insertion point as text is typed. If existing text is located to the right of the insertion point, that text is moved further to the right, accommodating the expanding preedit text as it is typed. The following shows an example of this style: Figure 5-6 On-the-Spot Style: Korean
Figure 5-7 On-the-Spot Style: Simplified Chinese
Figure 5-8 On-the-Spot Style: Traditional Chinese
Over-the-Spot StyleAs you type text, an over-the-spot style preedit area expands to the right of the insertion point and overwrites any existing display. After you finish typing and processing the preedit area input (in other words, once the text is converted, committed, or otherwise disposed), the processed preedit text is inserted at the insertion point and the preedit area disappears. Existing text located to the right of the insertion point appears to be overwritten during typing, but when the processed text is inserted at the insertion point, previously existing text is moved and displayed further to the right. This text movement accommodates the input text being inserted. Using Over-the-Spot Style with Korean Solaris SoftwareBefore you type in an over-the-spot preedit area, the screen should resemble the following: Figure 5-9 Over-the-Spot Style Before Korean Text is Typed
Using Over-the-Spot Style with Simplified Chinese Solaris SoftwareBefore you type text in an over-the-spot preedit area, the screen should resemble the following: Figure 5-12 Over-the-Spot Style Before Typing Simplified Chinese Text
Using Over-the-Spot Style with Traditional Chinese Solaris SoftwareBefore you type in an over-the-spot preedit area, the screen should resemble the following: Figure 5-15 Over-the-Spot Style Before Typing Traditional Chinese Text
Off-the-Spot StyleAn off-the-spot style preedit area is located inside an application window, but it is not at the insertion point. This style preedit area is a permanent part of the application's visual interface. For ease of viewing and consistency, the proposed standard location for off-the-spot preedit areas is in the bottom margin of the application window to the right of the status area. After you finish typing and processing preedit area input (text converted, committed, or otherwise disposed), the text is sent to the insertion point. Text to the right of the insertion point is moved farther to the right, accommodating the preedit text as it is inserted. Root-Window StyleA root-window style preedit area is provided by the system's workspace. The proposed standard location of the preedit area is at the bottom of the workspace. Input handling works the same as with off-the-spot style preedit areas. Figure 5-18 Root-Window Style (Korean)
Figure 5-19 Root-Window Style (Simplified Chinese)
Figure 5-20 Root-Window Style (Traditional Chinese)
Toolkit Use and Application InterfacesTwo methods are available for programming applications for Asian Solaris software:
For more information, see Common Desktop Environment: Internationalization Programmers Guide. This guide provides instructions on writing international programs. To write a program that interfaces directly with Xlib, a developer must use the internationalized APIs described earlier in this chapter. For additional information on the APIs, see the X11R6 documentation. |
||||||||||||||||||