> I believe this to be all that is needed for inserting
> keys with Qt frontend.
>
> If I do LANG=ro_RO ./lyx with this patch, I can insert t-cedilla etc.
> from latin2, just fine (assuming I've set document lang naturally).
>
> If my LANG=en_GB, X will not let me compose these latin2 cahracters
> *anyway*, so I do not see how it is possible to ever insert them.

I don't think that X's keyboard input and X application's LANG have anything 
to do with each other at all.

I'm using LANG=en_US all the time, and I'm using polish keyboard (basically 
right-alt + a,c,e,... to get ą,ć,ę,...) will all KDE applications and so far 
I have no problems.

What I make out of xev's output is that X sends a unique representation of a 
letter to the application (keysym -- which is LANG-neutral, it just gives the 
ISO/UNICODE-alike name of the letter, like aogonek), and it's up to the 
application to digest it or not.

I have tried many different KDE apps, and by switching keyboards (xmodmap and 
friends) I could compose all the different languages' characters while still 
being in LANG=en_US locale.

So, there are just a few simple steps that take place:
1. Keyboard scancodes result from physical keypresses
2. current modmap is used by the X server to map scancode sequences to keysyms
3. keysyms are passed to the application via Xlib
4. it's up to the toolkit to decide what to do -- AFAIK the expected behaviour 
(somewhat screwed in Qt) is to simply pass keysyms in some toolkit-transcoded 
form to the widgets as proper events
5. for all documents, the application will typically pass the letters that are 
inside the document's encoding set to the document, and should display 
question mark or box or something similar for letters wich are outside of 
document's encoding set. In case of UTF-xxx encodings, everything is 
representable, in case of 8-bit one-byte-per-character encodings there are 
obviously max. 256 symbols that can be represented (and typically the control 
stuff like values 0-15 are excluded from being used in an encoding anyway).

That's what I imagine is/should be happening.

Now, since we are trying to have our meal without eating it (i.e. not use 
unicode for .lyx file and it's representation inside of LyX), here's what I 
imagine is/should be going on in LyX:

1. LyX uses non-unicode encoded output, since that's what TeX/LaTeX expects 
(right?)

2. LyX could use UTF-8 for .lyx file, but that's not the case currently and it 
may only be the case for 1.4, so let's forget about it.

3. So, LyX has to somehow decide how on earth to:
a) choose which encoding to use for the .lyx document if one wants to have one 
paragraph in russian, and another in hebrew
b) choose how to encode given character in the resultant .latex file

I'd imagine that the solution for 3a) is to use paragraph language as having 
one-to-one mapping with encoding. So, if I have a LyX document with 3 
paragraphs:
- one in Polish
- one in Russian
- one in English
the first paragraph should have 8859-2 encoding, the second one should have 
koi8r encoding (it's the most popular, I imagine), and the third one should 
have 8859-15 encoding. I don't think that particular choice of encoding is 
critical, as long as that encoding is 8-bits-per-character (i.e. not UTF-8) 
and maps all necessary/customary characters used in given language. For some 
languages which have different charsets, it's needed to equate language with 
language-encoding, like chinese-big, chinese-simplified, etc. Now, that was 
about the .lyx file.

The solution for 3b) is outside of my knowledge... Can you change latex 
encodings inside a document? Is utf8 encoding available in your average latex 
installation? So far I was happy just using 8859-2 encoding for everything I 
did in latex...

Does any of my way thinking make sense? I for one would like to understand 
what's going on too, since encodings and stuff are rather simple things that 
get elevated to black magic pedestal since poor users have problems usually 
when their deadlines are near and never seem to have time nor resolve to 
pursue things if only they find a workaround (or an arcane HOWTO/README that 
just happened to work) for their particular case.

Cheers, Kuba Ober

Reply via email to