HOWTO: Installing Japanese that looks nice on Ubuntu Edgy : 日本語
OK, so it drove me absolutely crazy and I very nearly switched back to Fedora which would have been a great shame. All I wanted to do was install Japanese input that looked OK in an English install of Ubuntu. There were many different guides out there and most of which were incomplete or based on previous versions. So I have put what worked for me together in this thread. It might not work for you and I don't claim to have come up with it myself, but maybe some people might find it helpful. I hope the next version of Ubuntu has this out of the box (as Fedora does).
There are two issues here:
1.Installing the SCIM input system that will work in a locale other than converting your whole install to Japanese, i.e. you want Japanese input in an English login.
2.The fonts look initially terrible. Therefore a certain amount of customisation is required to make all the Kanji's render in the same style and Hiragana & Katakana to render in a non-handwriting style.
1.
First lets make sure you have the correct repositories installed in order to automatically download the relevant packs. Open the repositories list file:
Code:
sudo gedit /etc/apt/sources.list
Add the following line at the bottom:
Code:
deb http://archive.ubuntulinux.jp/ubuntu-ja edgy/
Now update your repos with:
Code:
sudo apt-get update
Go to System / Administration / Language Support and select Japanese. This should install the basics.
You might want to install some other Asian input methods too. To make sure you have all the common ones, use:
Code:
sudo apt-get install uim anthy scim-gtk2-immodule scim-uim scim-chinese scim-hangul scim-tables-zh scim-tables-ja scim-tables-ko
That should install Japanese, Chinese and Korean input. If you don't want them all, don't worry you can always hide them from the list later (in SCIM config), but it's probably a good idea to have them on your system.
Now you want to make SCIM (Language input system) available in your English login and not just the Japanese one. First open the scim_startup file:
Code:
sudo gedit /etc/X11/Xsession.d/74custom-scim_startup
Add these lines:
Code:
export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE="scim"
export XIM_PROGRAM="scim -d"
export QT_IM_MODULE="scim"
2.
OK, now you've got Japanese input installed (hopefully). It will probably require rebooting xwindows (CTRL+ALT+Backspace). But for me, I really couldn't cope with the horrible fonts that defaulted especially as they were nice and pretty in Fedora. Here's the next step.
Now that you have the Japanese repositories set up (see above), you'll want to get a nice set of fonts.
Code:
sudo apt-get install msttcorefonts ttf-dejavu ipafont ipamonafont ttf-arphic-ukai ttf-arphic-uming
This will install the Microsoft (Freeware) core fonts and a number of other useful fonts, specifically ones that support Japanese unicode characters.
Unfortunately, I am very disappointed in the Ubuntu distribution of DejaVu. It seems to be the default font, but you will almost certainly want this to be changed to MSGothic and MSMincho. These are Microsoft fonts, but they are freeware and are actually from a company called Ricoh so you can sleep at night knowing you're not using Microsoft if you want. They need to be downloaded and installed manually. They can be found at the following 2 sites.
http://www.themeworld.com/cgi-bin/pr...msgothic.0.zip
http://www.themeworld.com/cgi-bin/pr...msmincho.0.zip
or
http://www.wafu.ne.jp/3dlogo/fonts/msgothic.ttf
http://www.wafu.ne.jp/3dlogo/fonts/msmincho.ttf
So download the file and you need to copy them into the fonts directory. This will need root privileges and is probably easiest done using the file explorer:
Code:
sudo nautilus --browser
That will give you a browser with the right privileges. So copy your downloaded ttf files and paste them into a folder under the fonts tree. I recommend:
Code:
/usr/share/fonts/truetype/msttcorefonts
Now we need to rebuild the fonts cache:
Code:
sudo fc-cache -f -v
OK, so that might well be enough, but I think you'll probably still have your Japanese fonts not running at optimum and the default might be a little ugly. Lets set up the order in which we like the fonts to be selected. Open the “.fonts.conf” file in your home directory:
Code:
sudo gedit .fonts.conf
It should read as follows:
Code:
<?xml version="1.0"?>
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>Times New Roman</family>
<family>MS 明朝</family>
<family>IPAPMincho</family>
<family>Sazanami Mincho</family>
<family>Kochi Mincho</family>
<family>DejaVu Serif</family>
<family>Bitstream Vera Serif</family>
<family>Thorndale AMT</family>
<family>Luxi Serif</family>
<family>Nimbus Roman No9 L</family>
<family>Times</family>
<family>Frank Ruehl</family>
<family>MgOpen Canonica</family>
<family>AR PL SungtiL GB</family>
<family>AR PL Mingti2L Big5</family>
<family>FreeSerif</family>
<family>Baekmuk Batang</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Verdana</family>
<family>MS ゴシック</family>
<family>IPAPGothic</family>
<family>Sazanami Gothic</family>
<family>Kochi Gothic</family>
<family>DejaVu Sans</family>
<family>Bitstream Vera Sans</family>
<family>Arial</family>
<family>Albany AMT</family>
<family>Luxi Sans</family>
<family>Nimbus Sans L</family>
<family>Helvetica</family>
<family>Nachlieli</family>
<family>MgOpen Moderna</family>
<family>AR PL KaitiM GB</family>
<family>AR PL KaitiM Big5</family>
<family>FreeSans</family>
<family>Baekmuk Dotum</family>
<family>SimSun</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Courier New</family>
<family>MS ゴシック</family>
<family>IPAGothic</family>
<family>Sazanami Gothic</family>
<family>Kochi Gothic</family>
<family>DejaVu Sans Mono</family>
<family>Bitstream Vera Sans Mono</family>
<family>Andale Mono</family>
<family>Cumberland AMT</family>
<family>Luxi Mono</family>
<family>Nimbus Mono L</family>
<family>Courier</family>
<family>Miriam Mono</family>
<family>FreeMono</family>
<family>AR PL KaitiM GB</family>
<family>Baekmuk Dotum</family>
</prefer>
</alias>
<match target="font" >
<edit mode="assign" name="embeddedbitmap" >
<bool>false</bool>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="autohint" >
<bool>true</bool>
</edit>
</match>
</fontconfig>
So, save the file and reboot xwindows (CTLR+ALT+Backspace). Now with any luck the order of fonts should have been updated so that the default Japanese type face is actually a clean one first and foremost instead of the ugly first serving. Also it disables the built in bitmap font which can really make kanji's look odd next to anti aliased hiragana etc. For most people this setting will be fine. If you're not happy, by all means leave out the embeddedbitmap setting.
If you're still having problems consider the following:
Find your locale (you should already know it)
Code:
locale | grep LANG=
Then (with relevant changes)
Code:
sudo im-switch -z en_GB -s scim-anthy
Note: You will need to change the en_GB to your relevant locale. Mine is en_GB (I'm a Brit living in Tokyo) but your one will no doubt be different)
Also, you might wanna play with:
Code:
sudo dpkg-reconfigure fontconfig-config
So with any luck you should have got Japanese working to a satisfactory level. I still have issues inputting into Java AWT and SWING components, but I guess you can't expect everything. If anyone has any information on this, please let me know!
References:
http://ubuntuforums.org/showthread.php?t=206280
http://www.ubuntuforums.org/showthread.php?t=204500
http://www.mrbass.org/linux/ubuntu/scim/
http://www.ubuntuforums.org/showthread.php?t=127451
Bookmarks