supertuxkart / stk-code

The code base of supertuxkart
Other
4.39k stars 1.03k forks source link

I18N: Input methods not supported #2112

Closed Vdragon closed 7 years ago

Vdragon commented 9 years ago

Hi SuperTuxKart developers, please support input methods so that user can input CJK characters(for example, display name)

hiker commented 8 years ago

It appears that some non-ascii characters work (special Norwegian characters), but others don't. it would be good if someone with a keyboard with special keys on them could debug it.

Vdragon commented 8 years ago

@hiker Hi please checkout the following tutorial on CJK input issues https://docs.google.com/document/d/1HB3juffu0KgSUyg15y8hBZOLcJdHK9KDVPFyCwqHh-I/edit

hiker commented 8 years ago

Hmm - I just realised that we actually can not support CJK - the issue is that we have to restrict the number of characters that can be used (otherwise the textures are too big), so we only have the symbols available that are already used elsewhere in S'TK - not to useful for typing names I'd guess.

Changing this would be a significant effort (either adding support for ttf rendering or so), or even 'just' the ability to add missing characters 'on the fly to the textures used) is not trivial, I can't see us finding time for this in the near future - though patches are welcome :) (though be aware that just converting all Chinese characters into the font textures will not work, since most graphics card will run out of texture space)

Benau commented 8 years ago

https://github.com/Benau/stk-code/commit/d166aa620ede9763bcf3f663d7e02f9736767139

Now lazy loading characters (on the fly loading) is implemented, @Vdragon do you know how to get stk to integrate with ibus/any input methods?

Vdragon commented 8 years ago

@Benau Sorry, I have no idea how to do that.

Benau commented 8 years ago

https://github.com/Benau/stk-code/commit/2096532d0e654a2f67c968879a86e1b4b8298007

The above is mainly patched from official irrlicht svn and here (with additional fixes by myself): http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=6513&sid=38480dd2a5561c4584a747d3a988a4da&start=60

ex


Limitation: No ime box is shown in fullscreen

(Windows)Only the used language in current setting of non-Unicode programs can be typed with its supported IME, as in the screenshot above, korean (韓國) is chosen so only typing using IME with korean is possible. I THINK(??) it can be get rid of by compiling irrlicht with unicode instead of Multi-byte character set mode in VS, and change:

MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, bits, 2, &event.InputMethodEvent.Char, 1);

to

event.InputMethodEvent.Char = (wchar_t)wParam; (which is the official patch does)

But lots of compiling errors coming....

This may explain why #1591 can't show correct characters too.

Is the patch too "complicated" to test/merge?

Benau commented 7 years ago

@Vdragon can you try this branch in your linux? https://github.com/supertuxkart/stk-code/tree/fix_2112 screenshot In my gnome-shell testing, it works

Vdragon commented 7 years ago

@Benau Looking at it, thanks for helping.

Vdragon commented 7 years ago

@Benau Hi, I've built & tested, however the input method framework can't be activated in SuperTuxKart, I'm using Ubuntu's default IMF Fcitx in a KDE session.

Also if I pasted Chinese characters into the program it is displayed as question marks: supertuxkart_067

Vdragon commented 7 years ago

Also for commit d166aa6 I would like to suggest using Adobe Source Han Sans region-specific font instead of wqy, which is following GB18030 chinese writing/stroke standard and is different with the Taiwan/HongKong standard.

Benau commented 7 years ago

https://github.com/supertuxkart/stk-code/commit/a72f67015ca57016127a8f22b8e371a37a0ab899

Because it's too large (36MB), sorry

And for your problem, let me try to reproduce

Benau commented 7 years ago

Using lastest kubuntu 16.10, it's working for me

screenshot_20161113_105806

Are you using unicode locale (shown in screenshot)? if you start linux with LANG=C, stk can't open IM

Regarding paste chinese issue, seems that currently it will only work if the target application is not using gtk/qt (which have their own clipboard), last time I tried I can paste chinese from libreoffice only :/

which version you are using?

Benau commented 7 years ago

Also if you start stk in terminal, don't use sudo / su - root (use the same login user), otherwise IMF won't open also

Vdragon commented 7 years ago

Are you using unicode locale (shown in screenshot)? if you start linux with LANG=C, stk can't open IM

$ locale
LANG=zh_TW.UTF-8
LANGUAGE=zh_TW:zh_HK:zh
LC_CTYPE="zh_TW.UTF-8"
LC_NUMERIC="zh_TW.UTF-8"
LC_TIME="zh_TW.UTF-8"
LC_COLLATE="zh_TW.UTF-8"
LC_MONETARY="zh_TW.UTF-8"
LC_MESSAGES="zh_TW.UTF-8"
LC_PAPER="zh_TW.UTF-8"
LC_NAME="zh_TW.UTF-8"
LC_ADDRESS="zh_TW.UTF-8"
LC_TELEPHONE="zh_TW.UTF-8"
LC_MEASUREMENT="zh_TW.UTF-8"
LC_IDENTIFICATION="zh_TW.UTF-8"
LC_ALL=

which version you are using?

I'm using Ubuntu 16.04 with KDE installed separately from Kubuntu Backports PPA, running /usr/local/bin/supertuxkart from the terminal

$ printenv | grep fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
QT4_IM_MODULE=fcitx
GTK_IM_MODULE=fcitx
Vdragon commented 7 years ago

Oops, I made a big mistake by cloning the official repo instead of the patch's, please ignore the previous test result as I'm doing the new one.

Benau commented 7 years ago

ok!

I think I can fix the "?????" pasting chinese issue too, give me some time

Vdragon commented 7 years ago

I can successfully input Chinese after using the right revision of STK, sorry for all the trouble.

_070

I still can't paste properly paste Chinese text from LibreOffice though, but it should be other issue.

Benau commented 7 years ago

https://github.com/supertuxkart/stk-code/commit/e6e302af1cd7e127855845dca48dc84f2d7747e8

@Vdragon can you try again? (it's in the same branch, just do git pull should work)

Benau commented 7 years ago

Notice: all chinese related commits merged into master, so just do git checkout master; git pull should work

I'm closing this now, feel free to tell me if you have any problems later

Vdragon commented 7 years ago

Hi, the pasting issue is resolved in the new revision of STK.

Benau commented 7 years ago

Thx for your confirmation!