2.9.16
Coherent GT
A modern user interface library for games
Input Method Editor (IME) support

Table of Contents

Coherent GT has full support for Input Method Editor (IME) that enables an application to handle Asian language input.

Note
This section refers only to IME. If you're interested in text translation see Localization.

With the IME the user can input text in East Asian languages as Chinese, Korean and Japanese. It translates multiple keystrokes to characters, from the respective languages, that otherwise can't be represented individually on keyboards.

Although IME is an OS feature, any application (and middleware like Coherent GT) has to provide some methods in order to make the user interaction work correctly.

A great explanation on IME for Windows and how it could work in a generic game is available here. Other OSes differ somewhat but the principles remain the same. Coherent GT's IME API is OS agnostic and the user should just bridge the OS-specific logic to the SDK. A detailed sample - Sample - IME and font API is available and shows integrations for all platforms.

Detailed explanation

The IME-related functionality is exposed through some Coherent::UIGT::View methods and Coherent::UIGT::ViewListener events:

The View contains 3 methods that deal with the current IME composition directly:

Coherent GT provides also some events called on the Coherent::UIGT::ViewListener that allow for the correct composition and positioning of the IME windows:

Coherent::UIGT::ViewListener::OnTextInputTypeChanged is called whenever the input focus in the view changes. The application should tell the OS that it accepts IME input when the user has focused a text field but it should not do it when for example the user has clicked on a picture or is not writing text anywhere.

Coherent::UIGT::ViewListener::OnCaretRectChanged informs where the caret is currently in the View. Coherent::UIGT::ViewListener::OnIMEShouldCancelComposition informs that the application should cancel the current composition and signal the OS accordingly. This can happen for instance when the user clicks somewhere and changes the focus from a text box when a composition is still in-progress.