Data Driven IME Registration System

This section describes a new data driven system for registering IMEs that will allow users to add IMEs they wish to support themselves, as long as certain conditions are satisfied. Using this system, it is possible to see the IMEs currently supported by GFxIME and add support for the localized version of those IMEs yourself without needing to rebuild Scaleform Player or GFxIME.

Existing System

The existing system for registering IMEs uses an internal list that has to be updated and the source code recompiled every time support for a new IME or a localized version of an already supported IME is added. This means that a customer has to send Scaleform a support request for every new IME since the source code for GFxIME is normally not released. The new data driven system will expose the list of supported IMEs in an XML format and allow customers to modify this list in order to add support for localized versions of already supported IMEs. The procedure to do this is described in detail below.

Scaleform IME is designed to support a wide variety of IMEs on Windows XP, Vista and 7. There are four major language types that are supported- Chinese Simplified, Chinese Traditional, Japanese and Korean. Each language has a number of IMEs. Some of these are “system IMEs” which means that they either come pre-installed with the operating system or are installed with other Microsoft products such as MS Office. Others are “third party IMEs” which means they are provided by third party vendors; Chinese and Japanese IME provided by Google and Sogou Pinyin being two popular examples.

While there is a Windows API for providing IME support, this API is highly fickle. The windows messages corresponding to different IMEs can arrive at different times, leading to dangling candidate lists, flickering and crashes. Investigating the behavior of each IME and accounting for its peculiarities is what makes IME implementation a particularly challenging task. We realized early on during the development of the IME product that it would not be possible for us to support all IMEs in a generic way. Therefore, in Scaleform 3.x, a system for registering IMEs was introduced. As part of this system, a list of supported IMEs is maintained internally. During IME initialization, we first obtain a list of IMEs installed on the user’s system and compare this list to the list of supported IMEs. Only IMEs that are common between the two lists would appear in the Scaleform language bar. For non-supported IMEs, we simply ignore all IME related messages and return GFxIME_NotSupported from the HandleEvent call.

The process of registering IMEs looks at the keys in the "SYSTEM\CurrentControlSet\Control\Keyboard Layouts" section of the registry and uses a series of Windows API functions to obtain the list of IMEs registered on the system. However, it turns out that the string names used to register these IMEs are localized according to the operating system language. For example, the Microsoft Pinyin New Experience Input Style IME appears as “Chinese (Simplified) - Microsoft Pinyin New Experience Input Style” on an English system and as “中文(简体) - 微软拼音新体验输入风格” on a Simplified Chinese system. Therefore, in order to ensure that the IMEs Scaleform support work on all operating system languages, we had to add the localized strings for every IME to our IME registration table. However, as the list of supported IMEs continued to grow, this list became unwieldy and hard to maintain. More ever, in order to add support for a specific IME requested by a customer, we would have to update our internal IME list and then rebuild the IME library. This meant that the customer would have to create a support ticket and then wait for the updated IME lib.

Data Driven IME Support

The data driven IME system uses the fact that the localized versions of a certain IME work identically across different systems. For example, the English version of the Microsoft Pinyin IME sends the same messages in the same sequence as the Chinese Simplified version. This means that once the peculiarities of a certain IME has been figured out on the English version of Windows, the same code will work on the Korean version, Chinese Simplified version etc.

Implementation

The ime.xml file contains the registration information for most of the IMEs supported by GFxIME. This section explains the steps needed to add support for a certain IME. For this procedure to work, the following conditions must be met:

  1. Scaleform Version: Scaleform 3.3 and higher, since the data driven system was first introduced in Scaleform 3.3.
  2. Operating System: Windows Vista/7. The steps for Windows XP will be outlined soon.
  3. The IME that you are trying to add must already work on the English language version of the operating system. In other words, an English language entry for the corresponding IME must already exist in the ime.xml file.

Step 1:

Change the parameters passed during IME initialization as follows:

File: FxPlayer.cpp

Before: pimemanager->Init(Loader.GetLog())

Now: pimemanager->Init(Loader.GetLog(), pfileOpener, "C:\Scaleform\GFx\4.0\Bin\Data\ime.xml");

Note: You might have to change the path where ime.xml is situated on your computer.

Step 2:

Run Scaleform Player from the console and direct output to a text file. For example:

Now open log.txt. It should look like this:

As you can see, since I’m working on an English computer, most of the IME names appear in English. Open ime.xml in a good text editor (I recommend notepad++ since it handles Unicode characters well). It should like the following:

Now let’s say you are working on a Chinese Simplified System, and want to add support for the Microsoft Pinyin New Experience Input Style IME. You should first run the Scaleform Player executable with its output directed to a log file as shown above. You will see something similar to the following (depending on which IMEs are installed on your system):

As you can see, the Pinyin New Experience IME appears in its localized form. Now in order to add support for this IME, cut and paste the string name corresponding to the Pinyin New Experience IME to ime.xml, as shown below.

Make sure to keep the Tag entry the same as the existing entry for the English system. The tag is used to identify the IME internally by GFxIME. Now, the New Experience Pinyin IME should work on the Chinese Simplified system.

That’s it! Let us know if this procedure works for you or if you encounter any difficulties.