[Bf-committers] International Input

Damien Plisson damien.plisson at yahoo.fr
Thu Apr 22 22:24:58 CEST 2010


Le 22 avr. 2010 à 08:52, Ignacio Fernandez Moreno a écrit :

> Hi all,
> 
> I've been researching too. My aproach was trying to get input in utf/unicode
> and this is what i've found:
> 
> - Ghost gets every input as an ascci char, you can see this in
> GHOST_TEventKeyData, and GHOST_EventKey. It should use wchar_t (from
> wchar.h). I have a patch that does this and applies it to the rna. It
> compiles and works giving some support to the utf input but it fails showing
> it because there is format conversion in some places using RNA_string_get
> with chars. Luckily ascii chars work well because they are the same in
> unicode so until everything is changed this patch works in Windows. Unix and
> OSX should change it's respective GHOST_System codes to set GHOST_EventKeys
> with wchar_t instead of ascii but i'm not experienced with those yet.
> 
> So i the point is changing that in the GHOST_system of other OS and looking
> where the RNA_string_get /RNA_string_set functions are called in the code
> with char arrays and change them to wchar_t arrays, as i read in a tutorial
> (can't remember address) a Character will no longer be a "char" in Blender
> so everyone should be aware of that.
> 
> Maybe i have some point wrong or some code not really well implemented but
> it's a start.
> 
> I've not looked into file saving/reading so our researchs are complemetary i
> think.
> 
> The patch:
> https://projects.blender.org/tracker/index.php?func=detail&aid=22112&group_id=9&atid=127
> 
> As i said, it needs some work. Specially I need help with the
> X11/Carbon/Cocoa part.

OSX events return unicode data, and currently Ghost implementation performs the translation to 8bit IsoLatin1.
So it's just one line change to get the original 16bit unicode data.

Another issue is to handle the two-keys chars, like on a French keyboard: ^ + e => ê.

You can forget about carbon, it's the old Mac API that is deprecated.

Damien



More information about the Bf-committers mailing list