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.
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.
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.
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”.
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.
P/S (2020-03-31): With the recent Wine 5.4 and using Fcitx 4.2.9, the above method doesn’t work on games. No solution found yet.
P/S (2020-04-05): Tried to install Wine 1.3.37 using PlayOnLinux and run the game Taikou Risshiden 5, CJK input with Fcitx 4.2.9 has no issue. Meaning it is the bug from latest version of Wine.