个人工具

“UbuntuHelp:Japanese Input and Fonts in Ubuntu 7.10”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/Japanese_Input_and_Fonts_in_Ubuntu_7.10}} {{Languages|UbuntuHelp:Japanese_Input_and_Fonts_in_Ubuntu_7.10}} '''HOWTO: Installing Japanese that look...)
 
 
第4行: 第4行:
 
Installing Japanese Input and Superior Font Setup in Ubuntu
 
Installing Japanese Input and Superior Font Setup in Ubuntu
 
== Introduction ==
 
== Introduction ==
This is a guide to setting up Japanese for Ubuntu 7.10 Gutsy. It is intended as a complete guide encompassing all elements required for using Japanese on any language installation of Ubuntu. It covers input (UIM-Anthy) and configuring the Japanese fonts. There are other guides around for older versions of Ubuntu or that use the alternative SCIM. They tend to cover elements only. This guide is intended to cover everything. Please note that Kubuntu requires slightly different steps. Please follow the relevant page accordingly. This is an updated version based on the original 7.04 one, but with some sections changed. Please note that if you follow this guide, your fonts will be reconfigured. This might mean losing some font settings you may have made. I have chosen to switch to UIM from SCIM because SCIM (ubuntu) does not properly support XIM at the moment. That means in applications not written for GTK or QT, you will not be able to use extended characters. UIM on the other hand should support 100% of applications.  
+
This is a guide to setting up Japanese for Ubuntu 7.10 Gutsy Gibbon. It is intended as a complete guide encompassing all elements required for using Japanese on any language installation of Ubuntu. It covers input (UIM-Anthy) and configuring the Japanese fonts. There are other guides around for older versions of Ubuntu or that use the alternative SCIM. Please note that Kubuntu requires slightly different steps; follow the relevant wiki page accordingly.
 +
This is an updated version based on the original 7.04 one, but with some sections changed. Please note that if you follow this guide, your fonts will be reconfigured. This might mean losing some font settings you may have made.  
 
== Issues Involved ==
 
== Issues Involved ==
 
There are two main issues here:
 
There are two main issues here:
 
1.Installing the UIM 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.
 
1.Installing the UIM 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.
+
2.The fonts look initially terrible. Therefore a certain amount of customization is required to make all the kanji render in the same style, and hiragana and katakana to render in a non-handwriting style.
 
== Japanese Input with UIM ==
 
== Japanese Input with UIM ==
This section covers setting up the Japanese input system using UIM Anthy. This involves, downloading, installing and configuring it so that you can use it in non-Japanese locales (e.g. your system is in English).
+
This section covers setting up the Japanese input system using UIM-Anthy. This involves, downloading, installing and configuring it so that you can use it in non-Japanese locales (e.g. your system is in English).
 
=== Setting Up Repositories ===
 
=== Setting Up Repositories ===
First lets make sure you have the correct repositories installed in order to automatically download the relevant packs. Make sure you have the Universe and Multiverse repositories switched on. This can be done in 'Synaptic Package Manager' under the repositories tab. Also, you need the Japanese repository too. Open the repositories list file:
+
First make sure you have the needed software sources enabled in order to be able to download the relevant packages. In the Repositories tab in the Synaptic Package Manager, make sure the multiverse and universe repositories are checked. Furthermore, you need to add the Japanese repository. This is easiest done by manually appending the source to the repositories list file.
<pre><nowiki>
+
Open it up in a text editor by running the following command in a terminal, or in a run box (Alt+F2).<pre><nowiki>
 
gksudo gedit /etc/apt/sources.list
 
gksudo gedit /etc/apt/sources.list
 
</nowiki></pre>
 
</nowiki></pre>
Add the following line at the bottom:
+
Add the following line at the bottom.
 
<pre><nowiki>
 
<pre><nowiki>
 
deb http://archive.ubuntulinux.jp/ubuntu-ja gutsy/
 
deb http://archive.ubuntulinux.jp/ubuntu-ja gutsy/
 
</nowiki></pre>
 
</nowiki></pre>
Note that you will need to change 'gutsy' if you are using a different version from 7.10. Now update your repos with:
+
Note that you will need to change 'gutsy' if you are using a different release than 7.10.
 +
Now refresh your package list, either by choosing Refresh in Synaptic, or by entering the following in a terminal.
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get update
 
sudo apt-get update
 
</nowiki></pre>
 
</nowiki></pre>
At this stage, you will probably get an error saying that the repository is not validated. Ignore this for now. The following step will correct it. After adding the repository and running the update, you also need to add a keyring for the new location:
+
At this stage, you will probably get an error saying that the repository is not validated. The following step will correct it.
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install ubuntu-ja-keyring
 
sudo apt-get install ubuntu-ja-keyring
第31行: 第33行:
 
Go to System / Administration / Language Support and select Japanese. This should install the basics.
 
Go to System / Administration / Language Support and select Japanese. This should install the basics.
 
=== Installing UIM ===
 
=== Installing UIM ===
Although the default input method (SCIM) will have been installed, there are still certain bugs which mean that it will not function correctly in all applications, specifically non GTK (Gnome) ones. For this reason we will install UIM. This alternative provides the same input converter (Anthy) as SCIM did, but also provides a much more stable and compatible back end.
+
Although the default input method SCIM will have been automatically installed when you installed Ubuntu, there are still certain bugs which mean that it will not function correctly in all applications, specifically non-GTK (Gnome) ones. For this reason we will install UIM. This alternative provides the same input converter (Anthy) as SCIM did, but also provides a much more stable and compatible back end.
 +
* '''NOTE:''' This is, at the very least, no longer true in later releases. A properly configured xinput.d file will enable SCIM input in any and all applications.
 +
To install the packages needed for UIM, enter the following in a terminal.
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install uim uim-anthy uim-common uim-gtk2.0 uim-qt uim-xim
 
sudo apt-get install uim uim-anthy uim-common uim-gtk2.0 uim-qt uim-xim
 
</nowiki></pre>
 
</nowiki></pre>
As long as you have followed the above steps (including switching on Japanese language support), you should have all the necessary packages installed. Now we need to set up UIM.
+
As long as you have followed the above steps (including switching on Japanese language support), all that is left now is to set up UIM.
 
=== Making UIM available under a non-Japanese login ===
 
=== Making UIM available under a non-Japanese login ===
Now you want to make UIM (Language input system) available in your English (or other lang) login and not just the Japanese one.  
+
If you're running a non-Japanese locale, you will have to take certain steps to make the UIM input system available.
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo im-switch -s uim-systray
 
sudo im-switch -s uim-systray
 
</nowiki></pre>
 
</nowiki></pre>
This will change the input system over to UIM and tell it to dock itself in the system tray at the top of your screen. You now need to restart your computer. When the system has rebooted and you have logged back into Ubuntu, you should notice a new icon in the top right corner (or wherever your systray is). To check that it is working, open text editor. The icons now displayed in the UIM bar allow you to select different input methods. The first one should be clicked on and set to 'Anthy'. This is the Japanese input system. The second one allows you to choose between character types. Holding SHIFT and hitting SPACE will allow you to toggle between these.
+
This will change the input system over to UIM. At this point you will need to restart X, such as by rebooting, or logging out and hitting Ctrl+Alt+Backspace. When you have once more logged back in, there should be an icon in the system tray, in the panel at the top of your screen (by default).
Note: You might want to set Anthy as your default input method. You can do this in the UIM preferences window by clicking on the spanner and screwdriver icon in the UIM bar.  
+
To verify that it is working, open a text editor such as gedit.
 +
<pre><nowiki>
 +
gedit
 +
</nowiki></pre>
 +
The icons now displayed in the UIM bar will allow you to select different input methods. The first one should be clicked on and set to 'Anthy'; this is the Japanese input system. The second one allows you to choose between character types - holding shift and hitting space will allow you to toggle between these.
 +
* '''NOTE:''' You might want to set Anthy as your default input method. You can do this in the UIM preferences window by clicking on the spanner and screwdriver icon in the UIM bar.  
 
== Setting up the system to display Japanese characters properly ==
 
== Setting up the system to display Japanese characters properly ==
OK, now you've got Japanese input installed (hopefully). But for me, I really couldn't cope with the horrible fonts that defaulted. Here's the next step.
+
If you find that the Japanese characters aren't displayed well, there are a few steps you can take to improve their looks. Do note that you need the Japanese repository enabled to fetch some of the packages mentioned later. See the steps earlier in this wiki entry on how to add it.
Now that you have the Japanese repositories set up (see above), you'll want to get a nice set of fonts.  
+
 
=== Downloading Repository Fonts ===
 
=== Downloading Repository Fonts ===
 +
Install the needed font packages by entering the following in a terminal. Not all of these are free software.
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install msttcorefonts ttf-dejavu ipafont ipamonafont ttf-arphic-ukai ttf-arphic-uming
 
sudo apt-get install msttcorefonts ttf-dejavu ipafont ipamonafont ttf-arphic-ukai ttf-arphic-uming
 
</nowiki></pre>
 
</nowiki></pre>
This will install the Microsoft (Freeware) core fonts and a number of other useful fonts, specifically ones that support Japanese unicode characters.
+
This will install the Microsoft core fonts and a number of other useful fonts, specifically ones that support Japanese unicode characters.
=== Downloading External Fonts ===
+
=== Suggested External Fonts ===
Unfortunately, I am very disappointed in the Ubuntu selection and you will almost certainly want this to be changed to MSGothic and MSMincho. These are Microsoft fonts, but they are freely available to use and are actually from a company called Ricoh. They need to be downloaded and installed manually. They can be found at the following page.
+
Commonly installed fonts are MS Gothic and MS Mincho, fonts initially bought by Microsoft from a company named Ricoh. These are freely available on the web, though they aren't free per se. They can be found at the following page.
 
http://www.linux.ryukent.co.uk/show.php?id=24
 
http://www.linux.ryukent.co.uk/show.php?id=24
So download and extract the files and you need to copy them into the fonts directory. This will need root privileges and is probably easiest done using the file explorer:
+
Extracting them into the fonts directory requires root privileges, and is arguably  easiest done using the Nautilus file explorer.
 +
Enter the following in a terminal or a run box.
 
<pre><nowiki>
 
<pre><nowiki>
gksudo nautilus --browser
+
gksudo nautilus --browser &
</nowiki></pre>
+
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:
+
<pre><nowiki>
+
/usr/share/fonts/truetype/msttcorefonts
+
 
</nowiki></pre>
 
</nowiki></pre>
 +
That will give you a browser with the right privileges. Extract the .ttf font files from the downloaded archive into the default fonts directory at /usr/share/fonts/truetype, preferably in a subdirectory to it to make things more sorted.
 
=== Rebuilding the font cache ===
 
=== Rebuilding the font cache ===
Now we need to rebuild the fonts cache:
+
Now we need to rebuild the fonts cache. Enter the following in a terminal.
 
<pre><nowiki>
 
<pre><nowiki>
sudo fc-cache -f -v
+
sudo fc-cache -fv
 
</nowiki></pre>
 
</nowiki></pre>
 
=== Setting up the font order ===
 
=== Setting up the font order ===
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:
+
At this point you should have functioning Japanese input with your selection of available fonts, though you will notice that they aren't necessarily the ones used to display Japanese characters by default. You can set up the order of fonts in which any given character is displayed. Meaning, if a character doesn't exist in the first font, it will go down the list until it can be displayed. The reasoning is to put a good-looking normal font first in that order, and then add fonts which are likely to have more unicode characters, such as Japanese or unicode fonts.  
 +
Open the ".fonts.conf" file in your home directory in a text editor. It may or may not already exist.
 
<pre><nowiki>
 
<pre><nowiki>
gksudo gedit ~/.fonts.conf
+
gedit ~/.fonts.conf
 
</nowiki></pre>
 
</nowiki></pre>
It should read as follows:
+
Paste the following contents into it and save the file.
 
<pre><nowiki>
 
<pre><nowiki>
 
<?xml version="1.0"?>
 
<?xml version="1.0"?>
第146行: 第154行:
 
  <edit mode="assign" name="embeddedbitmap" >
 
  <edit mode="assign" name="embeddedbitmap" >
 
  <bool>false</bool>
 
  <bool>false</bool>
</edit>
 
</match>
 
<match target="font" >
 
<edit mode="assign" name="autohint" >
 
<bool>true</bool>
 
 
  </edit>
 
  </edit>
 
  </match>
 
  </match>
 
</fontconfig>
 
</fontconfig>
 
</nowiki></pre>
 
</nowiki></pre>
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.
+
Close and reopen any application to see the effects apply. Feel free to move font entries around to find a custom setup that fits you the best.
 +
If you find that more complex character like most kanji are blurry and hard to read, change the value of '''"embeddedbitmap"''' from ''false'' to ''true''.
 +
There are many more font options you can set in your .fonts.conf file, but they are outside the scope of this wiki entry.
 
----
 
----
[[category:CategoryDocumentation]] [[category:CategoryDocumentation]]
 
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2009年5月12日 (二) 17:35的最新版本

HOWTO: Installing Japanese that looks nice on Ubuntu 7.10 (Gutsy): 日本語 Installing Japanese Input and Superior Font Setup in Ubuntu

Introduction

This is a guide to setting up Japanese for Ubuntu 7.10 Gutsy Gibbon. It is intended as a complete guide encompassing all elements required for using Japanese on any language installation of Ubuntu. It covers input (UIM-Anthy) and configuring the Japanese fonts. There are other guides around for older versions of Ubuntu or that use the alternative SCIM. Please note that Kubuntu requires slightly different steps; follow the relevant wiki page accordingly. This is an updated version based on the original 7.04 one, but with some sections changed. Please note that if you follow this guide, your fonts will be reconfigured. This might mean losing some font settings you may have made.

Issues Involved

There are two main issues here: 1.Installing the UIM 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 customization is required to make all the kanji render in the same style, and hiragana and katakana to render in a non-handwriting style.

Japanese Input with UIM

This section covers setting up the Japanese input system using UIM-Anthy. This involves, downloading, installing and configuring it so that you can use it in non-Japanese locales (e.g. your system is in English).

Setting Up Repositories

First make sure you have the needed software sources enabled in order to be able to download the relevant packages. In the Repositories tab in the Synaptic Package Manager, make sure the multiverse and universe repositories are checked. Furthermore, you need to add the Japanese repository. This is easiest done by manually appending the source to the repositories list file.

Open it up in a text editor by running the following command in a terminal, or in a run box (Alt+F2).
gksudo gedit /etc/apt/sources.list

Add the following line at the bottom.

deb http://archive.ubuntulinux.jp/ubuntu-ja gutsy/

Note that you will need to change 'gutsy' if you are using a different release than 7.10. Now refresh your package list, either by choosing Refresh in Synaptic, or by entering the following in a terminal.

sudo apt-get update

At this stage, you will probably get an error saying that the repository is not validated. The following step will correct it.

sudo apt-get install ubuntu-ja-keyring

Adding Ubuntu Language Support

Go to System / Administration / Language Support and select Japanese. This should install the basics.

Installing UIM

Although the default input method SCIM will have been automatically installed when you installed Ubuntu, there are still certain bugs which mean that it will not function correctly in all applications, specifically non-GTK (Gnome) ones. For this reason we will install UIM. This alternative provides the same input converter (Anthy) as SCIM did, but also provides a much more stable and compatible back end.

  • NOTE: This is, at the very least, no longer true in later releases. A properly configured xinput.d file will enable SCIM input in any and all applications.

To install the packages needed for UIM, enter the following in a terminal.

sudo apt-get install uim uim-anthy uim-common uim-gtk2.0 uim-qt uim-xim

As long as you have followed the above steps (including switching on Japanese language support), all that is left now is to set up UIM.

Making UIM available under a non-Japanese login

If you're running a non-Japanese locale, you will have to take certain steps to make the UIM input system available.

sudo im-switch -s uim-systray

This will change the input system over to UIM. At this point you will need to restart X, such as by rebooting, or logging out and hitting Ctrl+Alt+Backspace. When you have once more logged back in, there should be an icon in the system tray, in the panel at the top of your screen (by default). To verify that it is working, open a text editor such as gedit.

gedit

The icons now displayed in the UIM bar will allow you to select different input methods. The first one should be clicked on and set to 'Anthy'; this is the Japanese input system. The second one allows you to choose between character types - holding shift and hitting space will allow you to toggle between these.

  • NOTE: You might want to set Anthy as your default input method. You can do this in the UIM preferences window by clicking on the spanner and screwdriver icon in the UIM bar.

Setting up the system to display Japanese characters properly

If you find that the Japanese characters aren't displayed well, there are a few steps you can take to improve their looks. Do note that you need the Japanese repository enabled to fetch some of the packages mentioned later. See the steps earlier in this wiki entry on how to add it.

Downloading Repository Fonts

Install the needed font packages by entering the following in a terminal. Not all of these are free software.

sudo apt-get install msttcorefonts ttf-dejavu ipafont ipamonafont ttf-arphic-ukai ttf-arphic-uming

This will install the Microsoft core fonts and a number of other useful fonts, specifically ones that support Japanese unicode characters.

Suggested External Fonts

Commonly installed fonts are MS Gothic and MS Mincho, fonts initially bought by Microsoft from a company named Ricoh. These are freely available on the web, though they aren't free per se. They can be found at the following page. http://www.linux.ryukent.co.uk/show.php?id=24 Extracting them into the fonts directory requires root privileges, and is arguably easiest done using the Nautilus file explorer. Enter the following in a terminal or a run box.

gksudo nautilus --browser &

That will give you a browser with the right privileges. Extract the .ttf font files from the downloaded archive into the default fonts directory at /usr/share/fonts/truetype, preferably in a subdirectory to it to make things more sorted.

Rebuilding the font cache

Now we need to rebuild the fonts cache. Enter the following in a terminal.

sudo fc-cache -fv

Setting up the font order

At this point you should have functioning Japanese input with your selection of available fonts, though you will notice that they aren't necessarily the ones used to display Japanese characters by default. You can set up the order of fonts in which any given character is displayed. Meaning, if a character doesn't exist in the first font, it will go down the list until it can be displayed. The reasoning is to put a good-looking normal font first in that order, and then add fonts which are likely to have more unicode characters, such as Japanese or unicode fonts. Open the ".fonts.conf" file in your home directory in a text editor. It may or may not already exist.

gedit ~/.fonts.conf

Paste the following contents into it and save the file.

<?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>
</fontconfig>

Close and reopen any application to see the effects apply. Feel free to move font entries around to find a custom setup that fits you the best. If you find that more complex character like most kanji are blurry and hard to read, change the value of "embeddedbitmap" from false to true. There are many more font options you can set in your .fonts.conf file, but they are outside the scope of this wiki entry.