not to use Compose files (was: RE: Mode_switch woes)

"Kent Karlsson" <[email protected]>
Newsgroups gmane.comp.xfree86.internationalization
Organization Data och IT, Chalmers University of Technology and G?teborg University
Message-ID <000801c43673$76d424d0$5f2d1081@chalmers95a69n>
> The thing is that 'compose rules' in X Window are not a part 
> of keyboard map
> but a separate file which choice depends on the current 
> locale. 

Which is, well, wrong... However, there may not be much point
in correcting that. There is a better way. A more general way.
And one that at least starts to get recommended, and maybe
it's time to start making such keyboard layouts also for the
Latin, Cyrillic, and Greek scripts... Those are the scripts
with the most precomposed accented letters in 10646/Unicode,
so for a long time one has used the "dead key" approach to
generate some of them. But there is a better and more general
way, one which does (or could do) away with the "Compose"
files altogether. However, it does assume Unicode-readiness.

The method is to have the "accent keys" actually generate
combining characters (to be typed after the base character).
For instance:
    key  <AD12> {[U0308, U0302, U0303, U030C]};
and
    key  <AB03> {[U0063, U0043, U0327, U0311]};
One can apply any (on the keyboard available) accent(s) on
any base character, including multiple accents (which is 
sometimes needed). Note that the accents must be typed after
the base character. This does not prevent keys from generaring
precomposed characters (or, rather, keysyms for precomposed
characters).

This works very nicely (at least on Windows, which is perhaps a
bit more Unicode-ready), but the Linux locale has to be a UTF-8
one, so that the mapping from keysym to character (in UTF-8)
works. In addition the applications must be able to handle
combining characters (at least to some extent).

If one prefers "maximally precomposed" characters, then one
can transform the text at some point to Unicode normal form
NFC. E.g. before mapping to legacy charsets, or before saving
an edited XML file.

There is one more thing that needs to be supported in XKB,
which now is handled via the Compose files: generating
multiple characters from one keystroke; i.e. generating
multiple keysyms from one keystroke. E.g.:

  key  <AD07> {[U0075, U0055, U0075 U0326, U0055 U0326]};

Note that for levels 3 and 4 in this example, two keysyms are
generated per keystroke. If there needs to be an upper limit to
how many keysyms can be generated for one keystroke, it
should be at least 4. Currently, one keysym can be mapped to
several characters in the Compose file; but I'd like to retire the
Compose files (at some future point in time).

	/kent k
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.