[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[m17n-lib:00345] Re: mim syntax: mapping XKB non-ascii to non-ascii



Hi,

In article <44453E70.6090908@xxxxxxxx>, Vaclav Smilauer <eudoxos@xxxxxxxx> writes:

> I would like to write a mim that would map "Ã" (a acute, written
> directly on Czech keyboard, through XKB) to "Ä" (a macron, classical
> latin) and similarly for other accented vowels. The trivial approach is
> (map (trans ("Ã" "Ä") )) but such a map is ignored by m17n-lib (that
> is, if I add this mapping to e.g. latin-post.mim, it is not available). Why?

> m17n-lib documentation says:

>> MTEXT in the definition of KEYSEQ consists of characters that can be
>> generated by a keyboard. Therefore MTEXT usually contains only ASCII
>> characters. However, if the input method is intended to be used, for
>> instance, with a West European keyboard, MTEXT may contain Latin-1
>> characters.

Oops, this is a documentation error.  We have not yet
implemented a code for handling non-ASCII character in MTEXT.

> My questions are:

> 1. What are the reasons of that restriction? Is there no way to get
> extra-Latin1 chars from XKB reliably? I looked at the source (IIRC
> input.c), the function checks that string_len = no_of_bytes (i.e. no
> UTF-8, ASCII<128), otherwise aborts.

> 2. How can I achieve the map I described, apart from simulating the
> whole czech layout on english keyboard and mapping 8âÄ etc.? (BTW, it is
> apparently only possible to use ASCII with native scim tables, therefore
> I turned to m17n)

> 2a. The syntax is "KEYSEQ ::= MTEXT | '(' [ SYMBOL | INTEGER ] * ')'".
> How do I find out what symbol / what integer is the one for "Ã" in X11
> and how to write the map then?

Please find a keysym name by xev and specify that name as
symbol.  For instance,

(map (trans ((amacron) "Ä") ...))

You can also lookup /usr/include/X11/keysymdef.h.  A keysym
name is the same as a macro name (sans "XK_").

> Documentation says
> > SYMBOL in the definition of KEYSEQ must be the return value of the minput_event_to_key() function.
> and
> > INTEGER in the definition of KEYSEQ must be a valid character code.
> I tried putting (0x00e1) (unicode position of 'Ã'), (0x3c 0xa1) which is
> what xev report (XLookupString gives 2 bytes: (c3 a1) "Ã"), neither of
> them works.

"C3 A1" is a UTF-8 byte sequence for "Ã".  Anyway, as scim
doesn't call m17n-lib's im function with such an keyevent
((0x00e1) nor (0xc3 0xa1)), you must specify a symbol as I
wrote above.

> 2b. What is the difference between (map (trans ("Ã" "Ä"))) and (map
> (trans "Ã" ?Ä))?

No difference, but the latter consumes slightly less memory.

> 3. Is there a command-line way to find out which mim's are accepted by
> m17n apart from launching scim and looking if the IM is listed among
> available IMs by scim-setup? (perhaps a debugging env variable?)

Check if you have the command "m17n-db".  If you have it,
you should be able to get a list of available mim files by:

% m17n-db -l input-method

If this doesn't solve your problem, please feel free to ask
further questions.

---
Kenichi Handa
handa@xxxxxxxx