Chinese fonts and input in Ubuntu

To whom it may concern. If you install Ubuntu Dapper (for other distributions, see comments below) with another language than Chinese as the main one, getting Chinese fonts and input to work is unforunately non-trivial. Not all steps can be done via a friendly, graphical interface.

First, install the Chinese language support files. You can do this in “System > Administration > Language Support” or via aptitude:

$ sudo aptitude install language-support-zh

This will install input support via smart-pinyin and SCIM, but you will need to activate it for your locale:

$ im-switch -s zh_CN

This creates a link in ~/.xinput.d/ for your current locale. Next time you login you should be able to activate pinyin input by pressing Ctrl+Space. There are also alot of other input methods (e.g. stroke based) which you may want to deactivate.

If you have some Japanese and Korean fonts installed (Ubuntu does by default), you will notice that the Chinese characters you write are shown with a mixture of fonts, which looks terrible (the same occurs if you have more than one Chinese font). Tell the font manager (fontconfig) that you want Chinese fonts by default:

$ sudo fontconfig-voodoo -s zh_CN

That’s it. If you are not using Ubuntu, you’ll want to install the smart-pinyin input method in SCIM. Use im-switch to create the hooks that activate SCIM when you start your desktop. If you have no Chinese fonts, look for the Arphic TrueType fonts. fontconfig-voodoo is part of the Ubuntu package language-selector-common. If you don’t have a similar tool in your distribution, consider copying /usr/share/language-selector/fontconfig/zh_CN from an Ubuntu box and hooking it into fontconfig (you’re on your own).

One thought on “Chinese fonts and input in Ubuntu

Comments are closed.