jon.reeve
October 20th, 2007, 03:15 AM
So I may not be an expert on this matter, but I've spent probably a good dozen or so hours battling with problems related to Ubuntu's Chinese language support, including several at the Chinese forums and wiki, and I learned a few things in the process, which I thought I'd share with the community in case some of this should prove to be helpful. This should be considered a guide for those who want to install Chinese language support (to be able to read and write Chinese characters) on a non-Chinese version of Ubuntu, like an English language version, for students of Chinese language, for example. The Chinese version, with Chinese menus and a Chinese login, often doesn't have any of these problems that I'll be describing.
1) Install Chinese Language support in System -> Administration -> Language Support by selecting Chinese and enable support of complex characters in the checkbox below. It has been noted elsewhere that in Fiesty you might actually have to uncheck this box if it's already checked, hit apply, and then check it again. This should install SCIM. When you log out and log back in, a little keyboard icon in the system tray indicates that SCIM is runinng.
2) Configure SCIM. This should be in System -> Preferences. Go to "global setup" and choose the input method you'll be using. For example, I use 拼音 but others go for other input methods. Familiarize yourself with the keystrokes necessary to activate SCIM, or set ones you like. That way, whenever you want to write Chinese you can just press Cntl+space. I've got it hooked up to change between English and Chinese input every time I press Print Screen, which I find useful.
3) Now you'll notice that you can input Chinese. But what if you have some characters that come out in serif, and others in sans? Does it look really strange? That's probably because Ubuntu is trying to display Chinese characters using a Japanese font, and is only displaying them with the Chinese font when the Japanese font doesn't contain that particular Chinese character. The way to fix this is by changing the font locale to zh_CN. This can be done by running
fontconfig-voodoo -f -s zh_CN
and has worked for me in the past using this method, but there's the chance it might not work under Gutsy, as it tends to give Chinese fonts priority over even regular Western fonts, thereby making your normal western text look all aliased and ugly. To fix this, one of the things you could do is to move the western fonts (ie Bitstream, Deja Vu, etc) higher up on the list in the file /usr/share/language-selector/fontconfig/zh_CN by running
sudo gedit /usr/share/language-selector/fontconfig/zh_CN
and editing the file accordingly. But in case this doesn't work for some reason, another way to do this is first to revert your voodoo settings:
fontconfig-voodoo -f -s none
then make a file called .fonts.conf with all the same stuff in it as a fixed-up zh_CN file would have. For example, mine looks like this:
<fontconfig>
<include ignore_missing="yes">CJK_aliases</include>
<alias>
<family>serif</family>
<prefer>
<family>Bitstream Vera Serif</family>
<family>DejaVu Serif</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL UKai CN</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Bitstream Vera Sans</family>
<family>DejaVu Sans</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL UKai CN</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
<family>DejaVu Sans Mono</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL UKai CN</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
</fontconfig>
4) Now your Chinese characters display consistently but they're all aliased and ugly-looking under a certain size. That's because there's a few lines in fontconfig that turn off the antialiasing features that would otherwise smooth out the characters. The way to fix this is by editing a file called /etc/fonts/conf.d/70-ttf-arphic-uming.conf where there is a line that says
<test name="pixelsize" compare="more_eq"><int>17</int></test>
There, you can change the number 17 to whatever number you want it to start aliasing from. I changed it to 8, for example.
And voila! Now you have pretty looking Chinese fonts.
With that having been said, I really hope that by the next release Ubuntu will have figured this whole thing out, so that people won't have to go through all this just to get their computer to display Chinese correctly.
1) Install Chinese Language support in System -> Administration -> Language Support by selecting Chinese and enable support of complex characters in the checkbox below. It has been noted elsewhere that in Fiesty you might actually have to uncheck this box if it's already checked, hit apply, and then check it again. This should install SCIM. When you log out and log back in, a little keyboard icon in the system tray indicates that SCIM is runinng.
2) Configure SCIM. This should be in System -> Preferences. Go to "global setup" and choose the input method you'll be using. For example, I use 拼音 but others go for other input methods. Familiarize yourself with the keystrokes necessary to activate SCIM, or set ones you like. That way, whenever you want to write Chinese you can just press Cntl+space. I've got it hooked up to change between English and Chinese input every time I press Print Screen, which I find useful.
3) Now you'll notice that you can input Chinese. But what if you have some characters that come out in serif, and others in sans? Does it look really strange? That's probably because Ubuntu is trying to display Chinese characters using a Japanese font, and is only displaying them with the Chinese font when the Japanese font doesn't contain that particular Chinese character. The way to fix this is by changing the font locale to zh_CN. This can be done by running
fontconfig-voodoo -f -s zh_CN
and has worked for me in the past using this method, but there's the chance it might not work under Gutsy, as it tends to give Chinese fonts priority over even regular Western fonts, thereby making your normal western text look all aliased and ugly. To fix this, one of the things you could do is to move the western fonts (ie Bitstream, Deja Vu, etc) higher up on the list in the file /usr/share/language-selector/fontconfig/zh_CN by running
sudo gedit /usr/share/language-selector/fontconfig/zh_CN
and editing the file accordingly. But in case this doesn't work for some reason, another way to do this is first to revert your voodoo settings:
fontconfig-voodoo -f -s none
then make a file called .fonts.conf with all the same stuff in it as a fixed-up zh_CN file would have. For example, mine looks like this:
<fontconfig>
<include ignore_missing="yes">CJK_aliases</include>
<alias>
<family>serif</family>
<prefer>
<family>Bitstream Vera Serif</family>
<family>DejaVu Serif</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL UKai CN</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Bitstream Vera Sans</family>
<family>DejaVu Sans</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL UKai CN</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
<family>DejaVu Sans Mono</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL UKai CN</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
</fontconfig>
4) Now your Chinese characters display consistently but they're all aliased and ugly-looking under a certain size. That's because there's a few lines in fontconfig that turn off the antialiasing features that would otherwise smooth out the characters. The way to fix this is by editing a file called /etc/fonts/conf.d/70-ttf-arphic-uming.conf where there is a line that says
<test name="pixelsize" compare="more_eq"><int>17</int></test>
There, you can change the number 17 to whatever number you want it to start aliasing from. I changed it to 8, for example.
And voila! Now you have pretty looking Chinese fonts.
With that having been said, I really hope that by the next release Ubuntu will have figured this whole thing out, so that people won't have to go through all this just to get their computer to display Chinese correctly.