[SDL] Some old new things about IME and XIM support.
Christophe Cavalaria
chris.cavalaria at free.fr
Fri Mar 23 12:28:18 PDT 2007
Ryan C. Gordon wrote:
>
>> As you said, if you don't mind I ask you,
>> would the interface TTF_RenderUNICODE_* of SDL_ttf be changed?
>> It uses Uint16 pointer to receive a wide string now,
>> and I think I might have to follow it's interface.
>
> The problem is that "Unicode" on Windows, the TCHAR type, is 16-bit, as
> are all OS interfaces. My understanding is that in Windows XP, this
> stopped being UCS-2 and started being UTF-16...I would be amazed if most
> applications handled this well, though.
Yuck!!! UTF-16, the crappiest unicode encoding available. All the problems
of UTF-8 and UCS-4 at the same time. Btw, SDL_ttf uses UCS-2 not UTF-16 as
it's input type for the UNICODE functions so there might be an issue there.
> Eventually this should change in SDL and support libraries too, but
> mostly that will be from people contributing patches.
Then maybe it would be best to add in SDL_ttf one additional set of
functions which handle UCS-4 correctly. I've had a look at the code and it
is rather trivial to do. It's even easier than the current functions since
you can get rid of a few type casts in the operation ( libttf uses 32bit
chars strings no matter which system it is )
I had a recent small project where I completly ditched unicode handling
because there was no way for me to make SDL_ttf take my std::widestring on
Linux. Unicode wasn't too important but would have been a neat bonus for
me. But facing problems the second time I'm doing string manipulation with
SDL_ttf because of that was too much for what it was worth.
And UTF-8 was not a solution at all in that case.
More information about the SDL
mailing list