On Wed, Apr 25, 2007 at 10:40:39AM -0700, Bill Kendrick wrote:
> On Mon, Apr 23, 2007 at 09:52:36AM -0700, Bill Kendrick wrote:
> > I wonder, would you be willing to document this feature in Tux Paint's
> > README.html documenation file?
> I've added some info, under the "Text" tool, and listed the supported
> languages there.
> I also added "(+)" next to the languages where right-[Alt] switches IM,
> to the OPTIONS documentation.
FYI, I've used Right-Alt because that's the key that switches modes when
typing Korean on the American keyboard, but Korean keyboards have a
dedicated "Korean/English" button. Simialr is true for Japanese
keyboards. I'd like to find out the SDL codes for these buttons and
allow those keys to change the modes also, but I don't have any Korean
or Japanese keyboards to test with.
> > Also, it would be good to add a section to the website's "Help Us" pages
> > that discusses how volunteers can create new ".im" files for other
> > languages. If you could direct me to some page that explains them, I
> > could try to put something together (or you could email me some text,
> > HTML, or just commit to the 'tuxpaint-website' repository in CVS).
> Still need to do this. I'll poke around the im.c file for it, I guess,
> if I have time.
A brief explanation is that *.im files contain different key strokes
that generate the unicode. I call this "character mapping".
Each *.im file can have multiple character mapping sections for
different character mapping modes. For example, on a Japanese typing
system, typing "ka" in Hiragana mode generates a different Unicode
character than typing "ka" in Katakana mode.
The *.im file format is as follows:
<unicode_in_hex_1> <key_sequence_1> <flag_1>
<unicode_in_hex_2> <key_sequence_2> <flag_2>
<unicode_in_hex_3> <key_sequence_3> <flag_3>
<unicode_in_hex_4> <key_sequence_4> <flag_4>
<unicode_in_hex_A> <key_sequence_A> <flag_A>
<unicode_in_hex_B> <key_sequence_B> <flag_B>
<unicode_in_hex_C> <key_sequence_C> <flag_C>
<unicode_in_hex_D> <key_sequence_D> <flag_D>
The word "section" breaks up the different character mapping sections.
The first section is in section 0 by default, the next in section 1,
etc. A maximum of 8 is allowed for the moment, but it's a simple
constant change in im.c if more is needed.
<unicode_in_hex> is a 16-bit hexadecimal number without the "0x".
<key_sequence> is the sequence of characters on the user's keyboard that
will generate the <unicode_in_hex>. <flag> is a flag that can be used
by the C code to customize the behavior of the code. If there is no
flag, you still have to add something as a placeholder, so "-" was
chosen to represent a placeholder flag.
Speaking of which, some C code needs to be added to im.c to handle these
*.im files. Most languages will want to load the *.im file, look up a
chracter sequence whenever a key is pressed, and return the
corresponding unicode. The Japanese IM handler, for example, loads
ja.im, looks up the corresponding unicode whenever a key is presed then
returns the correpsonding unicode, unless Right-Alt is pressed in which
case the character mapping section switches to the next. The Korean IM
handler goes a bit further and checks state flags to handle certain key
Oh, and... the *.im file may also have comments preceded by the #
Okay, so that's not very brief but it's not that comprehensive either.
Pleaset let me know if there's a gap in any explanation or if it just
flat out doesn't make sense.