SDL Unicode Text Input X11 Support Monthly Report (June 2009)

Hi All,

One of the first things to look into is why the current SDL 1.3 for
X11 supports just a few compose sequences but does not support all
available ones. Specifically, if you run SDL/test/checkkeys, you can
notice that
dead_acute + a = ?
dead_diaeresis + a = ?
(several more of these, but only for Latin characters; Greek, Cyrillic
would not work).
In addition, at least a handful compose sequences with the Compose key
work with the current state of SDL 1.3,
Compose + c + o = ?
Compose + o + c = ?
Compose + o + a = ?
After some long search in the SDL 1.3 source, the problem was found to
be merely with the test application.
An SDL 1.3 application simply needs to invoke setlocale() so that all
available compose sequences found in X.Org are made available.

Each application would need to 1) include locale.h and 2) invoke
setlocale() just before SDL_Init(), as shown in

One would invoke as setlocale(LC_CTYPE, “”)

  1. LC_CTYPE refers to character attributes and is the minimal requirement.
  2. One might also use LC_ALL which includes LC_CTYPE.
  3. “” means that the system locale is used (shown when you run
    ’locale’). As long as the system locale is .UTF-8, it is fine.
    A typical locale would be en_US.UTF-8.

You can also try the sdlim-test application found at
http://github.com/simos/sdlim-test/ which is similar to checkkeys but
also shows the character in the window.

I verified that compose sequences from
http://cgit.freedesktop.org/xorg/lib/libX11/tree/nls/en_US.UTF-8/Compose.pre
for Latin, Greek, Cyrillic work, include exotic ones such as Compose +
( + 1 + 0 + ) (produces ?).

A number of scripts may get supported though they will not be usable
at the moment due to rendering inability with SDL_TTF.
An example of this would be Arabic/Indic scripts (characters are
joined together changing shape) and Vietnamese (for some characters
that require combining diacritics and no precomposed characters exist
in Unicode). Switching to SDL_Pango might be a solution. In any case,
we can still test the IM support even if there are issues with
rendering.

What remains in the input method support in SDL 1.3 and X11 is to have
complete support for complex scripts.
A way to figure out what is required is to see similar systems, one of
which is Wine.
The task would be to get a similar support as shown in
http://source.winehq.org/git/wine.git/?a=blob;f=dlls/winex11.drv/xim.c;hb=HEAD
to SDL 1.3.

I had a look at a previous project for IM support in SDL 1.2
(http://sdl-im.csie.net/) which appears to have stalled (last update
Jan’07). This project worked on X11 and Win32 IM support for SDL.

What I have been currently doing is basing the effort on sdl-im.
I have already ported part of the code to SDL 1.3,


and I plan to continue with the rest.

It would be desirable to have a sample application that implements a
simple text box.
There is some code at http://libsdlinput.sourceforge.net/ however it
would be able to have something that could be placed in SDL/test/ and
can be used for our testing purposes. If someone has such code
already, it would be welcome.

Finally, the API requirements start to become clear; there are common
functions that are shared between targets and Jiang and I have to
figure out what should those common functions be.

Simos

SDL_Pango helps. Combine that with FriBiDi to get proper input support
for bidirectional languages (such as Arabic and Hebrew).

At least, that’s what we’ve done in Tux Paint.

Keep up the good work, folks!On Fri, Jul 03, 2009 at 04:59:11AM +0100, Simos Xenitellis wrote:

A number of scripts may get supported though they will not be usable
at the moment due to rendering inability with SDL_TTF.
An example of this would be Arabic/Indic scripts (characters are
joined together changing shape) and Vietnamese (for some characters
that require combining diacritics and no precomposed characters exist
in Unicode). Switching to SDL_Pango might be a solution. In any case,
we can still test the IM support even if there are issues with
rendering.


-bill!
Sent from my computer