RSS Feed

Tag Archives: ibus

IBus (input) 1.5 problems and solutions


I am using Arch Linux. Recently updated an old computer, the IBus from 1.4 to 1.5. As a result, there were two problems.

  1. Cannot input anymore in any window, except Opera(?)
  2. IBus Pinyin cannot change to “Full pinyin” mode, but only “Double pinyin” mode.

For the first problem, it doesn’t happen in my other computers. For the second problem, it happened in my other laptops.

To solve the first problem, I tried several ways. Deleting the “~/.ibus”, “~/.cache/ibus”, “~/.config/ibus”, and “.gconf/desktop/ibus”, none of them can reset IBus to the default setting (initial setting). I wanted to reset the configuration because I know that it should work well, because it does work well in my other computers. However, none of the directories is able to solve the problem, finally I chose to reset the GConf and dconf. (I personally think that dconf is the one storing the latest version’s setting).

So, before reset, I backup the GConf and dconf first,

gconftool-2 --dump / > backup.xml
dconf dump / > backup.txt 

Then, start to reset,

gconftool-2 --recursive-unset /desktop/ibus
gconftool-2 --recursive-unset /schemas/desktop/ibus
dconf reset -f /desktop/ibus/ #trailing / is important

(Please note that, for the GConf, even we unset the keys, some of the keys will still appear.  They are generated automatically.)

By making the reset, start the IBus daemon, now, it works fine.

For the second problem, I don’t have exact solution for IBus Pinyin. I tried to solve this problem before, by using git version. Then revert back to non-git version after new version released. Yet this time, the git version is unable to be compiled. Therefore, my solution is to use another pinyin method, such as ibus-googlepinyin and ibus-sunpinyin. Furthermore, Fcitx is another possible solution to solve the problem.

CJK fonts in Wine and also works with IBus input


CJK (Chinese, Japanese, Korean) fonts in Wine was really troublesome for me. Today, I have solved it totally. Before explaining the solution, just to say about the system environment I am using.

Arch Linux
wine 1.3.37
winetricks 20111115
ibus 1.4.0
ibus-pinyin 1.4.0
ibus-qt 1.3.1
ibus-table 1.3.9.20110827
ibus-table-extraphrase 1.3.9.20110827
ibus-table-wubi-git 20110410

Problem

I have installed all the fonts using winetricks with allfonts. I have also used winetricks to set fakechinese, fakejapanese, fakekorean. But none of these tricks work fine on my Wine.

Changing locale works fine, “env LANG=zh_CN.gbk wine notepad”. The menu is okay, but in some dialogs, some characters are still missing.

Wine notepad CJK problem

Wine notepad CJK problem

Solution

To solve it, make sure you have installed several fonts, from winetricks or from the package manager. I have installed allfonts from winetricks and other fonts using pacman. Wine is able to use external fonts.

In order to make the CJK fonts display properly, firstly, we need to know what type of system font is used in the different locale,

env LANG=zh_CN.gbk wine regedit

Then, we look into the “HKLM\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink” to check what is the system font that is used in this locale.

(I just found that, for the newer version of Wine, mine is 1.5.6, there is no registry key as mentioned above. But we can still get the information in “HKLM\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes“, look at the MS Shell Dlg.  It will show the font that used in the Windows Dialog.)

For my experience, I can see the following fonts in different locale

  • SimSun in zh_CN.gbk
  • PMingLiu in zh_TW.big5
  • MS UI Gothic in ja_JP.utf8
  • Lucida Sans Unicode, Tahoma, Microsoft Sans Serif.

Now, to make them work properly, we need to add the key “HKCU\Software\Wine\Fonts\Replacements” as mentioned here.

Then, add the string value with those system font name, such as SimSun, PMingLiu, MS UI Gothic.

For the data, we need to use the font name. The font name we can get from “HKCU\Software\Wine\Fonts\Cache”, see all the keys. We need to use the font name based on those key, not the “English Name”.

After setting this registry, we should able to read the fonts correctly.

My registry is

  • Lucida Sans Unicode = Lucida Console (external, get from ttf-mac-fonts)
  • Microsoft Sans Serif = MS Sans Serif (installed with wine)
  • MS UI Gothic = TakaoGothic (installed through winetricks)
  • PMingLiu = AR PL Ukai TW (external, get from ttf-arphic-ukai)
  • SimSun = AR PL Ukai CN (external, get from ttf-arphic-ukai)
  • Tahoma = Tahoma (installed through winetricks)

I am not sure does Tahoma setting is useless or not. But this setting works fine for me. Now, start the notepad with different locale, everything should work fine.

Now, after this setting, even the tray icon with CJK tooltip also works fine.

Wine Mini Thunder in system tray

IBus input method

I tried to play a game with traditional Chinese characters, namely Big5. In the game, I cannot input the Chinese characters with IBus input method. I asked in Wine Forum (here), but no one can answer me how to solve it. But today, after solving the CJK problem, I also manage to solve this IBus input problem.

Firstly, we must enable IBus to run properly, we must set the environment variables,

export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

Some of the people mentioned that these environment variables can be  set in .xinitrc, .bashrc, or some other place. But in my case, they can only work in .xprofile.

The next thing, make sure ibus-daemon is started with “-x” or “–xim”.

ibus-daemon --xim

In my case, I just use the file “/etc/xdg/autostart/ibus.desktop”.

Now, the crucial part is Wine. If the locale is non-UTF8, then IBus will not work. Simply to say, IBus will work on UTF8 locale in Wine. Try it

env LANG=zh_TW.utf8 wine notepad

Now, we should able to enter any characters in notepad with IBus. Howevere, if it is zh_TW.big5 or zh_CN.gbk, IBus will not work.

Yes, this is the solution.

Wine game with IBus CJK input

Wine game with IBus CJK input