「Uim を使って日本語を入力」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
imported>Tettsyun
(Translated sections into Japanese)
 
(カテゴリを追加)
 
(12人の利用者による、間の134版が非表示)
1行目: 1行目:
[[Category:Internationalization (English)]]
+
[[Category:ローカリゼーション]]
  +
[[en:Input Japanese using uim]]
[[Category:HOWTOs (English)]]
 
  +
{{Related articles start}}
{{i18n|Input Japanese using UIM}}
 
  +
{{Related|ローカリゼーション}}
{{Translateme}}
 
  +
{{Related articles end}}
  +
このページでは [https://code.google.com/p/uim/ uim] を使った日本語入力の方法について説明しています。もしあなたが SCIM を使う場合は [[Smart Common Input Method platform]] を、IBus を使う場合は [[IBus]] を、Fcitx を使う場合は [[Fcitx]] を参照して下さい。
   
  +
== インストール ==
このページは [http://code.google.com/p/uim/ uim] を使った日本語入力の方法について説明します。<br/>
 
  +
日本語入力を行うためには、次のパッケージが必要です。
もしあなたがSCIMを使っているなら、[[Smart Common Input Method platform]] を参照して下さい。
 
   
= ール =
+
* 日本語フォント
  +
* 日本語入力システム (かな漢字変換エンジン)
You need the following packages to input Japanese.
 
  +
* 入力メソッドフレームワーク: uim
   
  +
=== 日本語フォント ===
* Japanese fonts
 
  +
''フォントの設定やその他詳細については[[フォント]]および[[フォント設定]]を参照して下さい。''
* Japanese input method (Kana to Kanji conversion engine): This article describes about [http://en.sourceforge.jp/projects/anthy/ Anthy] and [http://code.google.com/p/mozc/ Mozc].
 
* Input method framework: uim
 
   
== 日本語フォント ==
+
おすすめの日本語フォントは以下の通りです。
  +
==== ゴシック体のみ ====
''see also [[Fonts]] for more detail.''
 
  +
* [https://github.com/adobe-fonts/source-han-sans adobe-source-han-sans] || {{Pkg|adobe-source-han-sans-jp-fonts}} or {{Pkg|adobe-source-han-sans-otc-fonts}}
  +
: Adobe が開発するオープンソース OTF フォント。
   
  +
==== ゴシック体と明朝体 ====
Recommended Japanese fonts are as follows.
 
* [http://ossipedia.ipa.go.jp/ipafont/ IPA fonts] (AUR: {{package AUR|otf-ipafont}})
+
* [http://ossipedia.ipa.go.jp/ipafont/ IPA フォント] ({{Pkg|otf-ipafont}})
  +
: IPA (情報処理推進機構) が提供するオープンソース OTF フォント。ゴシック体 (サンセリフ体) と明朝体 (セリフ体) グリフを含む。
:A high quality and formal style opensource font set including Gothic (sans-serif) and Mincho (serif) glyphs. Default font of openSUSE-ja.
 
* [http://launchpad.net/takao-fonts Takao Fonts] (AUR: {{package AUR|otf-takao}})
 
:A community developed derivatives of IPA Fonts. It aims to fix the problems of IPA fonts promptly. Default of Ubuntu-ja.
 
* [http://dicey.org/vlgothic/ VL Gothic] (AUR: {{package AUR|ttf-vlgothic}})
 
:Default Gothic font of Debian-ja, Fedora-ja, Vine Linux, et al.
 
* [http://www.geocities.jp/ep3797/modified_fonts_01.html UmePlus Gothic] (AUR: {{package AUR|ttf-umeplus}})
 
:Default Gothic font of Mandriva Linux ja environment.
 
   
  +
[[Wikipedia:ja:アスキーアート|2ちゃんねるの Shift JIS アート]]を適切に表示したい場合、次のいずれかのフォントを使うと良いでしょう:
If you want to show [http://en.wikipedia.org/wiki/2channel_Shift_JIS_art 2channel Shift JIS art] properly, use one of the following fonts:
 
* ipamona font (AUR: {{package AUR|ttf-ipa-mona}})
+
* IPAモナーフォント (AUR: {{AUR|ttf-ipa-mona}})
* Monapo font (AUR: {{package AUR|ttf-monapo}})
+
* Monapo フォント (AUR: {{AUR|ttf-monapo}})
   
== uim ==
+
=== uim ===
=== pacman を使う ===
+
==== pacman を使う ====
  +
{{AUR|uim}} を[[インストール]]してください。
Pull down the necessary things with a :
 
# pacman -S uim
 
   
=== PKGBUILD を使ってソースから uim をコンパイル ===
+
==== PKGBUILD を使ってソースから uim をコンパイル ====
  +
例えば、自分でビルドオプションをカスタマイズしたい場合などは ABS を使うなどしてソースからコンパイルできます。
For instance, in the case of the followings, you should compile from source:
 
* Arch repo's package is out-of-date: It's <del>frequently</del> sometimes out-of-date :P
 
* You want to use Anthy(UTF-8): As of uim 1.5.7, Anthy(UTF-8) support is disabled by default (default text encoding is EUC-JP).
 
* You use KDE and want to use uim-qt-tools: All tools for Qt are disabled by default.
 
   
  +
Arch 公式リポジトリでは、uim は以下のビルドオプションをつけてビルドされています (1.8.6 現在):
The one of the easy way to build from source is using ABS.<br />
 
  +
* {{Ic|--with-anthy-utf8}} : Anthy (UTF-8) のサポートを有効にする。
First, install ABS:
 
  +
* {{Ic|--with-qt4-immodule}} : Qt4 immodule をビルドする。
# pacman -S abs
 
  +
* {{Ic|--with-qt4}} : Qt4 で動作する uim-tools をビルドする。
Update ABS:
 
  +
すべてのビルドオプションは[https://code.google.com/p/uim/wiki/InstallUim 公式wiki]を参照してください。
# abs
 
   
  +
KDE4 plasma ウィジェットを使用する場合、ビルドのために (makedepends として) {{AUR|automoc4}} をインストールし、ビルドオプションに {{ic|--enable-kde4-applet}} を追加してください。
Then, copy uim's directory to under your $HOME. For example:
 
$ cp -R /var/abs/extra/uim ~/sources/
 
   
  +
{{Note|{{AUR|uim-debian}} には Qt5 のサポートなど開発版のパッチが含まれています。}}
Next, edit {{Filename|uim/PKGBUILD}}. Typical build options are as follows:
 
* {{Codeline|--with-anthy-utf8}}
 
: Enable Anthy(UTF-8) support
 
* {{Codeline|--disable-gnome-applet}}
 
: Do not build gnome-applet. You can drop gnome-panel from makedepends (also optdepends).
 
* {{Codeline|--with-qt4}}
 
: Build uim-tools for Qt (needs Qt)
 
* {{Codeline|--with-qt4-immodule}}
 
: Build UimQt (Qt immodule support) for Qt4 (needs Qt)
 
   
  +
=== 日本語入力システム ===
Here is a sample of custom PKGBUILD for enable anthy-utf8 support, disable gnome-applet and supports to invert the color of mode icons (see [[#I use darker theme, I cannot read the uim mode icons|below]]) based on uim 1.5.7 in extra.
 
  +
==== Anthy ====
  +
Anthy はオープンソースの世界で最も知られているインプットメソッドの一つです。長い間メンテされていませんでしたが、2010年5月より [https://wiki.debian.org/Teams/DebianAnthy Debian が引き継ぎました。]
   
  +
{{Pkg|anthy}} は公式リポジトリからインストールできます。
## You can invert the color of mode icons by uncommenting below line. This is useful for darker theme.
 
#_icon4darker=yes
 
 
pkgname=uim-custom
 
_pkgname=uim
 
pkgver=1.5.7
 
pkgrel=1
 
pkgdesc="Multilingual input method library"
 
arch=('i686' 'x86_64')
 
url="http://code.google.com/p/uim/"
 
license=('custom')
 
depends=('m17n-lib' 'ncurses' 'gtk2')
 
#makedepends=('gnome-panel' 'pkgconfig' 'gettext' 'intltool')
 
makedepends=('pkgconfig' 'gettext' 'intltool')
 
#optdepends=('gnome-panel: for using the GNOME applet')
 
options=('!libtool')
 
provides=('uim')
 
conflicts=('uim')
 
install=uim.install
 
source=(http://uim.googlecode.com/files/${_pkgname}-${pkgver}.tar.bz2)
 
md5sums=('b84a43fb92d7ceb4bd801a76120c2a71')
 
 
if <nowiki>[[ "$_icon4darker" = "yes" ]];</nowiki> then
 
makedepends=(${makedepends[@]} imagemagick)
 
_modify_icons=(
 
direct_input.png
 
ja_direct.png
 
ja_fullwidth_alnum.png
 
ja_halfkana.png
 
ja_halfwidth_alnum.png
 
ja_hiragana.png
 
ja_katakana.png
 
unknown.png
 
)
 
fi
 
 
build() {
 
cd "${srcdir}/${_pkgname}-${pkgver}"
 
 
# invert the color of mode icons for darker theme
 
if <nowiki>[[ "$_icon4darker" = "yes" ]];</nowiki> then
 
cd pixmaps
 
for _icon in ${_modify_icons[@]}
 
do
 
convert -negate $_icon tmp.${_icon} || return 1
 
mv -f tmp.${_icon} $_icon
 
done
 
cd -
 
fi
 
 
./configure --prefix=/usr --libexecdir=/usr/lib/uim \
 
--with-anthy-utf8 \
 
--disable-gnome-applet \
 
|| return 1
 
make || return 1
 
}
 
 
package() {
 
cd "${srcdir}/${_pkgname}-${pkgver}"
 
 
make DESTDIR="${pkgdir}" install || return 1
 
install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
 
}
 
   
  +
===== cannadic改 =====
Finally, run makepkg under uim directory to make and install package:
 
  +
オリジナル Anthy のデフォルト辞書には EUC-JP (JISX0208) で定義されていない文字 (例えば "①" や "♥" など) は含まれていません。[http://en.sourceforge.jp/projects/alt-cannadic/ alt-cannadic] はそれら文字を含んだ辞書を提供しています。
$ makepkg -s -i
 
   
  +
これを使用するには、[http://en.sourceforge.jp/projects/alt-cannadic/releases/?package_id=6129 cannadic改辞書]をダウンロードし、{{ic|~/.anthy/imported_words_default.d}} 配下に置いてください。
== 日本語入力システム ==
 
  +
$ tar jxvf alt-cannadic-091230.tar.bz2
=== Anthy ===
 
  +
$ mkdir ~/.anthy/imported_words_default.d (if not exist)
Anthy is one of the most popular Japanese input method in open source world. Though it is not maintained for a long time, [http://wiki.debian.org/Teams/DebianAnthy Debian succeeds it] from May 2010.
 
  +
$ cp alt-cannadic-091230/extra/*.t ~/.anthy/imported_words_default.d/
   
  +
詳細は[http://sourceforge.jp/projects/alt-cannadic/wiki/%E4%BD%BF%E3%81%84%E6%96%B9_Anthy-UTF-8 公式サイトのwiki]で確認してください。
To install Anthy :
 
# pacman -S anthy
 
   
  +
{{Warning|この拡張辞書を使う場合は、使用するインプットメソッドは '''Anthy (UTF-8)''' でなければなりません。}}
=== Modified Anthy ===
 
[http://www.geocities.jp/ep3797/anthy_dict_01.html Modified Anthy] is a set of patches and huge extended dictionaries which aims to improve the Kana-Kanji conversion quality of original Anthy.
 
{{Warning|Modified Anthy applies to only Anthy (UTF-8). So you have to build uim with "{{Codeline|--with-anthy-utf8 --without-anthy}}".}}
 
{{Warning|Modified Anthy does not have compatibility of the dictionaries and learning data with original Anthy.}}
 
   
==== PKGBUILD を使って Modified Anthy をコンパイル ====
+
==== Modified Anthy (anthy-ut) ====
  +
[http://www.geocities.jp/ep3797/anthy_dict_01.html Modified Anthy] はオリジナル Anthy のかな漢字変換の品質向上を狙ったパッチ及び辞書のセットです。
Modified Anthy consists two different sources:
 
* Patched source of Anthy by [http://www.fenix.ne.jp/~G-HAL/soft/nosettle/#anthy G-HAL]
 
* Huge extended dictionalies by [http://www.geocities.jp/ep3797/anthy_dict_01.html UTSUMI]
 
   
  +
Modified Anthy は、以下の2つのアップストリームからなっています:
The G-HAL patches allows only hand-operated download so you have to get by yourself from [http://www.fenix.ne.jp/~G-HAL/soft/nosettle/#anthy here]. As of 2010-07-05, latest stable version archive is:
 
  +
* [http://www.fenix.ne.jp/~G-HAL/soft/nosettle/#anthy G-HAL]氏によって作成されているパッチの当てられたAnthy
anthy-9100h.patch13B-23-iconv-ucdict.2010629.alt-depgraph-100603d.alt-cannadic-100603-patch100628.zipdic-201005-patch100614.tar.lzma
 
  +
* [http://www.geocities.jp/ep3797/anthy_dict_01.html UTSUMI]氏によって作成されている巨大な辞書。
Search and get it (or newer archive) from the page.
 
   
  +
{{Warning|Modified Anthy は Anthy (UTF-8) にのみ対応しています。従って uim の設定で使用する (デフォルトの) インプットメソッドは '''Anthy (UTF-8)''' でなければなりません。}}
Here is a sample of the PKGBUILD:
 
  +
{{Warning|Modified Anthy はオリジナル Anthy に対し、辞書及び学習データの互換性がありません。}}
{{Note|The both upstreams do not retain older versions. Please check latest archives each by yourself.}}
 
  +
pkgname=modified-anthy
 
  +
===== PKGBUILD を使って Modified Anthy をコンパイル =====
_pkgname=anthy
 
  +
Modified Anthy は AUR に {{AUR|anthy-ut}}{{Broken package link|{{aur-mirror|anthy-ut}}}} という名前で登録されています。
pkgver=20100710
 
_pkgver=9100h
 
_ghalarc="anthy-9100h.patch13B-23-iconv-ucdict.2010629.alt-depgraph-100603d.alt-cannadic-100603-patch100628.zipdic-201005-patch100614.tar.lzma"
 
_utver=20100710
 
pkgrel=1
 
pkgdesc="Hiragana text to Kana Kanji mixed text Japanese input method"
 
arch=("i686" "x86_64")
 
url="http://sourceforge.jp/projects/anthy/"
 
license=('LGPL' 'GPL')
 
depends=('glibc')
 
options=('!libtool' 'force')
 
provides=("anthy=${_pkgver}")
 
conflicts=('anthy')
 
source=(${_ghalarc}
 
"http://downloads.sourceforge.net/project/mdk-ut/30-source/source/anthy-ut-patches-${_utver}.tar.bz2")
 
md5sums=('6be18e8ef5fec087ead4b6ebf798219b'
 
'd7321adeaed49dda8b06407c64c91973')
 
 
build() {
 
 
cd ${srcdir}
 
 
tar xvf $_ghalarc --lzma
 
 
cd ${srcdir}/${_pkgname}-${_pkgver}
 
 
# UTSUMI dictionalies and patches
 
cat anthy-conf.in ${srcdir}/anthy-ut-patches-${_utver}/ghal-patch/conf > anthy-conf.in.new || return 1
 
mv -f anthy-conf.in.new anthy-conf.in
 
 
cp -f ${srcdir}/anthy-ut-patches-${_utver}/dictionaries/* alt-cannadic/
 
cp -f ${srcdir}/anthy-ut-patches-${_utver}/zipcode/zipcode.t mkworddic/
 
cp -f ${srcdir}/anthy-ut-patches-${_utver}/mkworddic/dict.args.in mkworddic/dict.args.in
 
 
mkdir -p doc-ut
 
cp -f ${srcdir}/anthy-ut-patches-${_utver}/AUTHORS \
 
${srcdir}/anthy-ut-patches-${_utver}/ChangeLog.* \
 
${srcdir}/anthy-ut-patches-${_utver}/README* \
 
${srcdir}/anthy-ut-patches-${_utver}/THANKS \
 
doc-ut
 
autoreconf -fiv || return 1
 
 
./configure --prefix=/usr --sysconfdir=/etc || return 1
 
make EMACS=emacs sysconfdir=/etc || return 1
 
}
 
 
package() {
 
cd ${srcdir}/${_pkgname}-${_pkgver}
 
make EMACS=emacs DESTDIR=$pkgdir install || return 1
 
}
 
   
  +
anthy-ut tarball を入手し、makepkg でビルド及びインストールします:
Finally, run makepkg to make and install package:
 
  +
$ wget https://aur.archlinux.org/packages/anthy-ut/anthy-ut.tar.gz
  +
$ tar xvf anthy-ut.tar.gz
  +
$ cd anthy-ut
 
$ makepkg -s -i
 
$ makepkg -s -i
   
  +
すでに Anthy を使用していた場合は、既存の学習データのフォーマットを変換しなければなりません。
If you have already used original Anthy, you have to convert the existing learning data format.
 
 
$ rm ~/.anthy/last-record1_*.bin
 
$ rm ~/.anthy/last-record1_*.bin
 
$ anthy-agent --update-base-record
 
$ anthy-agent --update-base-record
 
$ rm ~/.anthy/last-record1_*.bin
 
$ rm ~/.anthy/last-record1_*.bin
 
$ anthy-agent --update-base-record
 
$ anthy-agent --update-base-record
  +
(同じ事を2回繰り返していますが、間違いではありません)
(Though this step repeats the same commands twice, it is not mistypes.)
 
   
=== Mozc ===
+
==== Mozc ====
  +
''[[Mozc|Mozc]] を参照してください。''
[http://code.google.com/p/mozc/ Mozc] (on [http://aur.archlinux.org/packages.php?ID=39514 AUR]) is a Japanese open source input method originates from [http://www.google.com/intl/ja/ime/ Google Japanese Input]. It is considered that it has better conversion quality than Anthy as for multi segments conversion (e.g. one sentence) in a lump but the dictionary is not so sufficient. Though Mozc adapts to only ibus and scim input method framework, [http://code.google.com/p/macuim/ macuim] provides uim-mozc plugin and you can use it with {{package AUR|mozc-svn}} on AUR.
 
   
  +
[https://code.google.com/p/mozc/ Mozc] は Chromium OS、Windows、Mac、あるいは Linux など、マルチプラットフォームで動作するよう設計された日本語インプットメソッドエディタ (IME) であり、このオープンソースプロジェクトは [https://www.google.com/intl/ja/ime/ Google 日本語入力] から派生したものです。
==== PKGBUILD を使って Mozc をコンパイル (uim から Mozc を使う) ====
 
  +
First, you get mozc-svn tarball from AUR (or use AUR tools like yaourt) and edit the PKGBUILD to enable uim-mozc. That is, uncomment {{Codeline|_uim_mozc}} line and you can comment out {{Codeline|_ibus_mozc}} line to disable ibus module if unnecessary:
 
  +
{{AUR|Mozc}} は公式には IBus にしか対応していませんが、[https://code.google.com/p/macuim/ macuim] が uim-mozc プラグインを提供しています。
## You can choose the input method framework to use either ibus, uim or both.
 
  +
## If you will be not using ibus, comment out below.
 
  +
===== 無印Mozc =====
#_ibus_mozc="yes"
 
  +
{{AUR|uim-mozc}} が利用できます。
  +
{{Note|これは uim-mozc の kill_line 機能をサポートしていません。}}
  +
他の Mozc パッケージと同様に [[非公式ユーザーリポジトリ#pnsft-pur|pnsft-pur]] リポジトリからインストール可能です。
  +
これを使用する場合は以下を /etc/pacman.conf に追加します:
  +
[pnsft-pur]
  +
SigLevel = Optional TrustAll
  +
Server = https://osdn.net/projects/ponsfoot-aur/storage/pur/x86_64/
  +
{{Note|用意されているのは現在 x86_64 用パッケージのみです。}}
  +
そしてパッケージデータベースを更新します:
  +
# pacman -Syy
  +
インストールするパッケージは以下のようにグループ指定で選択することができます:
  +
# pacman -S mozc-im
  +
または、例えば以下のように直接指定します:
  +
# pacman -S uim-mozc
  +
  +
===== mozc-ut =====
  +
{{AUR|mozc-ut2}} も uim-mozc に対応しています。
  +
{{Note|mozc-ut は {{AUR|uim-mozc}} を使用することもできます。}}
  +
uim-mozc をビルドするには、PKGBUILD を以下のように編集します ({{Ic|1=_uim-mozc=}} の行をコメント解除):
  +
## If you will not be using ibus, comment out below.
  +
_ibus_mozc="yes"
 
## If you will be using uim, uncomment below.
 
## If you will be using uim, uncomment below.
 
_uim_mozc="yes"
 
_uim_mozc="yes"
## If you will be using scim, uncomment below.
+
## If applying patch for uim-mozc fails, try to uncomment below.
#_scim_mozc="yes"
+
#_kill_kill_line="yes"
  +
## This will disable the 'kill-line' function of uim-mozc.
  +
{{Tip|ibus-mozc がいらない場合は {{Ic|1=_ibus_mozc=}} の行をコメントアウトします。}}
   
  +
===== Mozc の登録 =====
==== 日本の郵便番号辞書の構築 (オプション) ====
 
  +
{{Warning|uim のアップグレードや (再) インストールのたびに以下のコマンドを実行して mozc を (再) 登録する必要があります。<br/>
mozc-svn can import Japanese zip code by [http://www.post.japanpost.jp/zipcode/download.html Japan Post] as dictionary seed.
 
  +
# uim-module-manager --register mozc}}
   
  +
==== Google CGI API for Japanese Input ====
To add zip code dictionary, edit the following lines in PKGBUILD:
 
  +
[http://www.google.co.jp/ime/cgiapi.html Google CGI API for Japanese Input] (Google-CGIAPI-Jp) は、Google による、日本語変換をインターネット上で実現するための、CGI サービスです。これは専用のアプリケーションを必要とせず、[https://www.google.com/transliterate ウェブブラウザから使用することができます。]これは Google 日本語入力の CGI 版であるため、変換品質は Mozc より良いようです。
## You can add Japanese zip code provided by Japan Post.
 
## If you want to use it, uncomment below.
 
_zipcode="yes"
 
   
  +
{{Note|このサービスはサーバーとの入力文字列や変換候補のやりとりをプレーンテキストで行っています。(2012年09月現在)}}
==== ビルド、インストール ====
 
Next, build and install:
 
$ makepkg -s -i
 
   
  +
uim もこのサービスに対応しています。uim-im-switcher-gtk/gtk3/qt4 や uim-pref-gtk/gtk3/qt4 で "Google-CGIAPI-Jp" を選択してください。
Finally, register Mozc on uim.
 
# uim-module-manager --register mozc
 
   
  +
== 設定 ==
When you have uninstalled Mozc, unregister it from uim.
 
  +
=== 環境変数 ===
# uim-module-manager --unregister mozc
 
  +
以下を ~/.[[xprofile|xprofile]]、~/.[[xinitrc|xinitrc]]、~/.xsession などに設定します:
   
= 設定 =
 
Add the followings to ~/.[[xprofile]], ~/.[[xinitrc]] or ~/.xsession:
 
== 環境変数 ==
 
 
export GTK_IM_MODULE='uim'
 
export GTK_IM_MODULE='uim'
 
export QT_IM_MODULE='uim'
 
export QT_IM_MODULE='uim'
 
uim-xim &
 
uim-xim &
export XMODIFIERS=@im='uim'
+
export XMODIFIERS='@im=uim'
   
  +
{{Note|
== ツールバーユーティリティ ==
 
  +
* これらの環境変数はデスクトップ環境やウィンドウマネージャーの起動前に export してください。
If you want to use UimToolbar utilities which shows and controls uim mode, add one of the followings too.
 
  +
* X セッションの管理に systemd を使用している場合は[[#systemd_を使用している場合|systemd を使用している場合]]を参照してください。}}
   
  +
=== ツールバーユーティリティ ===
=== uim-toolbar-gtk/qt ===
 
  +
UimToolbar を使用する場合は、以下のうちの一つを追加します。
Using toolbar appears as a window:
 
  +
  +
==== uim-toolbar-gtk/qt ====
  +
ウィンドウとして表示されるツールバーを使用する場合。
  +
  +
GTK+ 2 用:
 
uim-toolbar-gtk &
 
uim-toolbar-gtk &
  +
GTK+ 3 用:
or if you built {{Codeline|--with-qt}}, you can add:
 
uim-toolbar-qt &
+
uim-toolbar-gtk3 &
  +
Qt4 用:
  +
uim-toolbar-qt4 &
  +
  +
==== uim-toolbar-gtk-systray ====
  +
システムトレイ (通知エリア) に表示されるツールバーを使用する場合。
   
  +
GTK+ 2 用:
=== uim-toolbar-gtk-systray ===
 
Using toolbar for system tray:
 
 
uim-toolbar-gtk-systray &
 
uim-toolbar-gtk-systray &
  +
GTK+ 3 用:
  +
uim-toolbar-gtk3-systray &
   
=== パネルアプレット ===
+
==== パネルアプレット ====
  +
GNOME、Xfce、あるいは KDE を使用している場合、パネルアプレットのツールバーも使用できます。Xfce の場合には xfce4-xfapplet が必要です。
Or, if you use GNOME, KDE or Xfce, you can use uim-toolbar panel applet (Xfce requires xfce4-xfapplet-plugin to use uim-applet-gnome and KDE requires to buid uim with {{Codeline|--with-qt}}).
 
   
  +
=== systemd を使用している場合 ===
== uim の外観 ==
 
Configure uim preferences by running :
 
$ uim-pref-gtk
 
which brings forth a GUI.<br />
 
Choose {{Codeline|"Anthy"}}, {{Codeline|"Anthy (UTF-8)"}} or {{Codeline|"Mozc"}} for 'Default input method'.
 
{{Note|Mozc will be not listed in 'Default input method' at first time so you will need to add it into 'Enabled input methods' to use.}}
 
   
  +
[[systemd/ユーザー#Xorg と systemd|X セッションの管理に systemd を使用している場合]]、systemd セッション内で環境変数の設定が必要になります。
   
  +
{{hc|~/.config/systemd/user/uim-env.service|<nowiki>
You can run {{Codeline|uim-xim}} or restart X to test your settings.<br/>
 
  +
[Unit]
Provided everything went well you should be able to input Japanese in X.
 
  +
Description=uim environment initialization
  +
Before=xorg.target
   
  +
[Service]
== Emacs で uim を使う ==
 
  +
Type=oneshot
  +
ExecStart=/usr/bin/systemctl --user set-environment XMODIFIERS=@im=uim
  +
ExecStart=/usr/bin/systemctl --user set-environment GTK_IM_MODULE=uim
  +
ExecStart=/usr/bin/systemctl --user set-environment QT_IM_MODULE=uim
  +
</nowiki>}}
   
  +
{{hc|~/.config/systemd/user/uim.service|<nowiki>
uim provides uim.el the bridge software between Emacs and uim.
 
  +
[Unit]
  +
Description=uim daemon
  +
Wants=uim-env.service
  +
After=xorg.target
   
  +
[Service]
=== マイナーモードで使うための設定 ===
 
  +
ExecStart=/usr/bin/uim-xim
  +
Restart=on-abort
   
  +
[Install]
Here is a sample to use uim with utf-8 encoding. Add the following into your {{Filename|.emacs}} or some other file for Emacs customizing.
 
  +
WantedBy=xorg.target</nowiki>
  +
}}
  +
  +
{{hc|~/.config/systemd/user/uim-toolbar.service|<nowiki>
  +
[Unit]
  +
Description=uim toolbar
  +
PartOf=uim.service
  +
  +
[Service]
  +
ExecStart=/usr/bin/uim-toolbar-of-your-choice
  +
Restart=on-abort
  +
  +
[Install]
  +
WantedBy=uim.service</nowiki>
  +
}}
  +
  +
以下のコマンドでサービスが有効になります:
  +
$ systemctl --user enable uim.service uim-toolbar.service
  +
  +
=== uim の初期設定 ===
  +
以下のコマンドで uim の設定ウィンドウが表示されます :
  +
$ uim-pref-gtk (または、uim-pref-gtk3/uim-pref-qt4)
  +
「全体設定」の「標準の入力方式」で、お気に入りのインプットメソッドを選択します。
  +
{{Note|初めて Mozc をインストールした直後は、Mozc は選択できません。これは Mozc が「使用可能にする入力方式」で有効になっていないためです。その右の「編集」ボタンをクリックして Mozc を有効にしてください。}}
  +
  +
{{Ic|uim-xim}} を起動するか、X の再起動で uim を使用して日本語が入力できるようになります。
  +
  +
=== Emacs で 日本語を入力する ===
  +
uim は uim.el を提供しており、Emacs 上で uim を使用して日本語を入力できます。ここでは Emacs 上で uim を、文字エンコーディング UTF-8 で使用する設定を説明します。
  +
  +
詳細は [https://code.google.com/p/uim/wiki/UimEl 公式 wiki] 参照してください。
  +
  +
==== LEIM かマイナーモードか ====
  +
uim.el を使用する場合、直接マイナーモードで使用するか、LEIM (Library of Emacs Input Method) を使用するかを選択できます。uim.el とそれ以外の IM をよく切り替えて使う場合は LEIM フレームワークを使用してください。
  +
  +
===== マイナーモードで使うための設定 =====
  +
マイナーモードで使用する場合は、以下の設定を {{ic|.emacs.d/init.el}} あるいはその他の Emacs カスタム設定用ファイルに追加します。
 
;; read uim.el
 
;; read uim.el
 
(require 'uim)
 
(require 'uim)
296行目: 245行目:
 
;; key-binding for activate uim (ex. C-\)
 
;; key-binding for activate uim (ex. C-\)
 
(global-set-key "\C-\\" 'uim-mode)
 
(global-set-key "\C-\\" 'uim-mode)
  +
  +
===== LEIM で使うための設定 =====
  +
LEIM で使用する場合は、以下の設定を {{ic|.emacs.d/init.el}} あるいはその他の Emacs カスタム設定用ファイルに追加し、使用するかな漢字変換エンジンをデフォルトに指定します。
  +
;; read uim.el with LEIM initializing
  +
(require 'uim-leim)
 
 
  +
;; set default IM. Uncomment the one of the followings.
  +
;(setq default-input-method "japanese-anthy-utf8-uim") ; Anthy (UTF-8)
  +
;(setq default-input-method "japanese-google-cgiapi-jp-uim") ; Google-CGIAPI-Jp
  +
;(setq default-input-method "japanese-mozc-uim") ; Mozc
  +
  +
==== 既定の文字エンコーディングの指定 ====
  +
uim.el はデフォルトの文字エンコーディングを EUC-JP としていますが、UTF-8 を使用したい場合は以下の設定を追加します。
 
;; Set UTF-8 as preferred character encoding (default is euc-jp).
 
;; Set UTF-8 as preferred character encoding (default is euc-jp).
 
(setq uim-lang-code-alist
 
(setq uim-lang-code-alist
302行目: 263行目:
 
(delete (assoc "Japanese" uim-lang-code-alist)
 
(delete (assoc "Japanese" uim-lang-code-alist)
 
uim-lang-code-alist)))
 
uim-lang-code-alist)))
 
;; Set Hiragana input mode at activating uim with anthy (utf-8).
 
;(setq uim-default-im-prop '("action_anthy_utf8_hiragana"))
 
;; Set Hiragana input mode at activating uim with mozc.
 
;(setq uim-default-im-prop '("action_mozc_hiragana"))
 
Please see [http://code.google.com/p/uim/wiki/UIM_EL Official wiki] for more detail.
 
   
  +
==== インライン変換候補表示機能をデフォルトで有効にする ====
You may need to add the following to disable xim on Emacs into your {{Filename|~/.Xresource}}s or {{Filename|~/.Xdefaults}}.
 
  +
インライン変換候補表示機能とは、変換候補を入力中の文字列のすぐ下(もしくはすぐ上)に縦方向に並べて表示させる機能です。インライン変換候補表示機能をデフォルトで有効にする場合は以下の設定を追加します。
Emacs.UseXIM: false
 
  +
;; set inline candidates displaying mode as default
  +
(setq uim-candidate-display-inline t)
   
  +
==== 入力モードの初期値をひらがな入力にする ====
= トラブルシューティング =
 
  +
uim.el 起動時の入力モードをひらがな入力にする場合は、使用するインプットメソッドに合わせて以下のように編集します。
== Cannot input Japanese on Opera ==
 
  +
;; Set Hiragana input mode at activating uim.
== Opera で日本語入力ができない ==
 
  +
(setq uim-default-im-prop '("action_anthy_utf8_hiragana"
If you use Opera and cannot input Japanese with uim, try to edit environment variable as follows:
 
  +
"action_google-cgiapi-jp_hiragana"
  +
"action_mozc_hiragana"))
  +
  +
==== Emacs 上で C-SPC が IM の入力モードの切り替えに使われてしまうのを抑止する ====
  +
デスクトップ環境上で IM のオン・オフのキー割り当てに C-SPC を設定していると、uim.el がアクティブになっている時 C-SPC は入力モードの切り替えに使用されます。これを抑止し、set-mark-command として使用するには、以下の設定を {{ic|.emacs.d/init.el}} あるいはその他の Emacs カスタム設定用ファイルに追加します。
  +
(add-hook 'uim-load-hook
  +
'(lambda ()
  +
(define-key uim-mode-map [67108896] nil)
  +
(define-key uim-mode-map [0] nil)))
  +
  +
==== Emacs 上で C-SPC が IM のオン・オフで使われてしまうのを抑止する ====
  +
デスクトップ環境上で IM のオン・オフのキー割り当てに C-SPC を設定しており、Emacs 上でもそちらが優先されて C-SPC/C-@ で set-mark-command が使えなくて困る、という場合は、{{ic|~/.Xresources}} か {{ic|~/.Xdefaults}} に以下を追加します。
  +
Emacs*UseXIM: false
  +
  +
== トラブルシューティング ==
  +
=== Opera で日本語入力ができない ===
  +
Opera で日本語が入力できない場合は、以下のように環境変数を変更してみてください:
 
export QT_IM_MODULE='xim'
 
export QT_IM_MODULE='xim'
   
== uim-toolbar-gtk-systray: トレイアイコンがクラッシュ ==
+
=== uim-toolbar-gtk-systray: トレイアイコンがつぶれてま===
  +
DE、WM、あるいはパネルアプリケーションの中には、システムトレイ上に、アプリケーションあたり1個のアイコンスペースしか用意しないものがありますが、uim-toolbar-gtk-systray はそこにデフォルトのツールバーアイコン4,5個をまとめて表示しようとするために潰れてしまいます。ツールバーに表示するアイコンを1個だけにすることで解決します。以下は、入力モードアイコンのみを表示させる例です:
uim-toolbar-gtk-systray isn't compliant with freedesktop.org system tray specs so some icons are shown in one icon space by default. Choose just one of them to solve it. The steps to display only 'Input mode' icon for example as follows:
 
# Run {{Codeline|uim-pref-gtk}}.
+
# {{Ic|uim-pref-gtk}} を起動する。
  +
# 「グループ」の中から「ツールバー」を選択する。
# Click 'Toolbar' on 'Group' list.
 
  +
# 「入力方式切り替えメニュー」および「ボタン」ボックスの中のすべてのチェックボックスのマークを外す。
# Take the all checkmarks off.
 
  +
# 「グループ」の中から、使用する入力メソッド (Anthy、Anthy (UTF-8)、またはMozc)を選択する。
# Click 'Anthy', 'Anthy (UTF-8)' or 'Mozc' which you are using on 'Group' list.
 
  +
# 「ツールバー」ボックスの「有効にするボタン」の右端にある「編集」ボタンをクリックする。
# Click Edit button in 'Toolbar' box -> 'Enable toolbar buttons' line.
 
  +
# 「入力モード」のみ有効にする。
# Enable only 'Input mode' and click 'Close' button.
 
  +
# 「OK」をクリックして設定ウィンドウを閉じる。
# Click 'OK' button to close uim-pref-gtk.
 
  +
トレイアイコンは "あ" (ひらがな入力) または "ー" (直接入力) になっているはずです。
The tray icon will be displayed "あ" (Hiragana mode) or "ー" (Direct mode).
 
  +
  +
=== 暗いテーマを使用しているので uim のモードアイコンが見えません ===
  +
暗いテーマ用のアイコンを使用します (uim 1.6.0 以降)。
  +
# {{Ic|uim-pref-gtk}} を起動する。
  +
# 「グループ」の中から「ツールバー」を選択する。
  +
# 「アイコン」ボックスの「濃色背景向けアイコンを使用する」にチェックマークをつける。
  +
# 「OK」をクリックして設定ウィンドウを閉じる。
  +
  +
=== GTK_IM_MODULE を設定したのに GTK+ 2 アプリケーションで uim が使用できません ===
  +
  +
環境変数 GTK_IM_MODULE を設定してあるのに GTK+ 2 アプリケーションで uim が使用できない場合、{{Ic|gtk-query-immodules-2.0}} によって作成される gtk.immodules の指定が必要です。
  +
  +
GTK+ 2 用のデフォルトパスは {{Ic|/etc/gtk-2.0/gtk.immodules}} です。
  +
  +
環境変数 GTK_IM_MODULE_FILE を設定するか (GTK+ 3 アプリケーションとの互換性はないので ''非推奨'')、im_module_file を設定します (''推奨'')。
  +
  +
以下を {{Ic|/etc/gtk-2.0/gtkrc}} または {{Ic|~/.gtkrc-2.0}} に追加します:
  +
  +
im_module_file "/etc/gtk-2.0/gtk.immodules"
  +
  +
=== 全角モードで子音を入力できません ===
  +
  +
全角モードで子音を入力したい場合、以下を設定ファイルに追加してください。
   
  +
{{Hc|例: ~/.uim.d/customs/custom-google-cgiapi-jp.scm|
== 暗いテーマを使用しているので uim モードのアイコンが見えません ==
 
  +
(define ja-rk-rule-hoge
Modify icons in accordance with your theme (e.g. invert the colors). The icons which should be modified will be as follows:
 
  +
(map
* Path: {{Filename|/usr/share/uim/pixmaps}}
 
  +
(lambda (c)
* Files:
 
  +
(list (cons (list c) ()) (list c c c)))
** {{Filename|direct_input.png}}
 
  +
'("b" "c" "d" "f" "g" "h" "j" "k" "l" "m"
** {{Filename|ja_direct.png}}
 
  +
"p" "q" "r" "s" "t" "v" "w" "x" "y" "z"
** {{Filename|ja_fullwidth_alnum.png}}
 
  +
"A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M"
** {{Filename|ja_halfkana.png}}
 
  +
"N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")))
** {{Filename|ja_halfwidth_alnum.png}}
 
  +
(if (symbol-bound? 'ja-rk-rule-hoge)
** {{Filename|ja_hiragana.png}}
 
  +
(set! ja-rk-rule (append ja-rk-rule-hoge ja-rk-rule)))
** {{Filename|ja_katakana.png}}
 
  +
}}
** {{Filename|unknown.png}}
 
There is a sample PKGBUILD to apply it. See [[#Compiling uim from source using PKGBUILD|above]].
 
   
= 関連文献 =
+
== 関連文献 ==
 
;uim
 
;uim
:[http://code.google.com/p/uim/wiki/OfficialUserDocument uim official document]
+
:[https://github.com/uim/uim/wiki uim 公式ドキュメント]
 
:[http://en.wikibooks.org/wiki/Uim uim on wikibooks]
 
:[http://en.wikibooks.org/wiki/Uim uim on wikibooks]
   
  +
;フォント
;Fonts
 
:[http://www.geocities.jp/ep3797/japanese_fonts.html Japanese fonts showcase]
+
:[http://linuxplayers.g1.xrea.com/japanese_fonts.html 日本語フォントショーケース]
:[http://www.geocities.jp/ep3797/modified_fonts_01.html modified Japanese fonts]
+
:[http://linuxplayers.g1.xrea.com/modified_fonts_01.html modified Japanese fonts]

2023年9月2日 (土) 21:02時点における最新版

関連記事

このページでは uim を使った日本語入力の方法について説明しています。もしあなたが SCIM を使う場合は Smart Common Input Method platform を、IBus を使う場合は IBus を、Fcitx を使う場合は Fcitx を参照して下さい。

目次

インストール

日本語入力を行うためには、次のパッケージが必要です。

  • 日本語フォント
  • 日本語入力システム (かな漢字変換エンジン)
  • 入力メソッドフレームワーク: uim

日本語フォント

フォントの設定やその他詳細についてはフォントおよびフォント設定を参照して下さい。

おすすめの日本語フォントは以下の通りです。

ゴシック体のみ

Adobe が開発するオープンソース OTF フォント。

ゴシック体と明朝体

IPA (情報処理推進機構) が提供するオープンソース OTF フォント。ゴシック体 (サンセリフ体) と明朝体 (セリフ体) グリフを含む。

2ちゃんねるの Shift JIS アートを適切に表示したい場合、次のいずれかのフォントを使うと良いでしょう:

uim

pacman を使う

uimAURインストールしてください。

PKGBUILD を使ってソースから uim をコンパイル

例えば、自分でビルドオプションをカスタマイズしたい場合などは ABS を使うなどしてソースからコンパイルできます。

Arch 公式リポジトリでは、uim は以下のビルドオプションをつけてビルドされています (1.8.6 現在):

  • --with-anthy-utf8 : Anthy (UTF-8) のサポートを有効にする。
  • --with-qt4-immodule : Qt4 immodule をビルドする。
  • --with-qt4 : Qt4 で動作する uim-tools をビルドする。

すべてのビルドオプションは公式wikiを参照してください。

KDE4 plasma ウィジェットを使用する場合、ビルドのために (makedepends として) automoc4AUR をインストールし、ビルドオプションに --enable-kde4-applet を追加してください。

ノート: uim-debianAUR には Qt5 のサポートなど開発版のパッチが含まれています。

日本語入力システム

Anthy

Anthy はオープンソースの世界で最も知られているインプットメソッドの一つです。長い間メンテされていませんでしたが、2010年5月より Debian が引き継ぎました。

anthy は公式リポジトリからインストールできます。

cannadic改

オリジナル Anthy のデフォルト辞書には EUC-JP (JISX0208) で定義されていない文字 (例えば "①" や "♥" など) は含まれていません。alt-cannadic はそれら文字を含んだ辞書を提供しています。

これを使用するには、cannadic改辞書をダウンロードし、~/.anthy/imported_words_default.d 配下に置いてください。

$ tar jxvf alt-cannadic-091230.tar.bz2
$ mkdir ~/.anthy/imported_words_default.d (if not exist)
$ cp alt-cannadic-091230/extra/*.t ~/.anthy/imported_words_default.d/

詳細は公式サイトのwikiで確認してください。

警告: この拡張辞書を使う場合は、使用するインプットメソッドは Anthy (UTF-8) でなければなりません。

Modified Anthy (anthy-ut)

Modified Anthy はオリジナル Anthy のかな漢字変換の品質向上を狙ったパッチ及び辞書のセットです。

Modified Anthy は、以下の2つのアップストリームからなっています:

  • G-HAL氏によって作成されているパッチの当てられたAnthy
  • UTSUMI氏によって作成されている巨大な辞書。
警告: Modified Anthy は Anthy (UTF-8) にのみ対応しています。従って uim の設定で使用する (デフォルトの) インプットメソッドは Anthy (UTF-8) でなければなりません。
警告: Modified Anthy はオリジナル Anthy に対し、辞書及び学習データの互換性がありません。
PKGBUILD を使って Modified Anthy をコンパイル

Modified Anthy は AUR に anthy-utAUR[リンク切れ: アーカイブ: aur-mirror] という名前で登録されています。

anthy-ut tarball を入手し、makepkg でビルド及びインストールします:

$ wget https://aur.archlinux.org/packages/anthy-ut/anthy-ut.tar.gz
$ tar xvf anthy-ut.tar.gz
$ cd anthy-ut
$ makepkg -s -i

すでに Anthy を使用していた場合は、既存の学習データのフォーマットを変換しなければなりません。

$ rm ~/.anthy/last-record1_*.bin
$ anthy-agent --update-base-record
$ rm ~/.anthy/last-record1_*.bin
$ anthy-agent --update-base-record

(同じ事を2回繰り返していますが、間違いではありません)

Mozc

Mozc を参照してください。

Mozc は Chromium OS、Windows、Mac、あるいは Linux など、マルチプラットフォームで動作するよう設計された日本語インプットメソッドエディタ (IME) であり、このオープンソースプロジェクトは Google 日本語入力 から派生したものです。

MozcAUR は公式には IBus にしか対応していませんが、macuim が uim-mozc プラグインを提供しています。

無印Mozc

uim-mozcAUR が利用できます。

ノート: これは uim-mozc の kill_line 機能をサポートしていません。

他の Mozc パッケージと同様に pnsft-pur リポジトリからインストール可能です。 これを使用する場合は以下を /etc/pacman.conf に追加します:

[pnsft-pur]
SigLevel = Optional TrustAll
Server = https://osdn.net/projects/ponsfoot-aur/storage/pur/x86_64/
ノート: 用意されているのは現在 x86_64 用パッケージのみです。

そしてパッケージデータベースを更新します:

# pacman -Syy

インストールするパッケージは以下のようにグループ指定で選択することができます:

# pacman -S mozc-im

または、例えば以下のように直接指定します:

# pacman -S uim-mozc
mozc-ut

mozc-ut2AUR も uim-mozc に対応しています。

ノート: mozc-ut は uim-mozcAUR を使用することもできます。

uim-mozc をビルドするには、PKGBUILD を以下のように編集します (_uim-mozc= の行をコメント解除):

## If you will not be using ibus, comment out below.
_ibus_mozc="yes"
## If you will be using uim, uncomment below.
_uim_mozc="yes"
## If applying patch for uim-mozc fails, try to uncomment below.
#_kill_kill_line="yes"
## This will disable the 'kill-line' function of uim-mozc.
ヒント: ibus-mozc がいらない場合は _ibus_mozc= の行をコメントアウトします。
Mozc の登録
警告: uim のアップグレードや (再) インストールのたびに以下のコマンドを実行して mozc を (再) 登録する必要があります。
# uim-module-manager --register mozc

Google CGI API for Japanese Input

Google CGI API for Japanese Input (Google-CGIAPI-Jp) は、Google による、日本語変換をインターネット上で実現するための、CGI サービスです。これは専用のアプリケーションを必要とせず、ウェブブラウザから使用することができます。これは Google 日本語入力の CGI 版であるため、変換品質は Mozc より良いようです。

ノート: このサービスはサーバーとの入力文字列や変換候補のやりとりをプレーンテキストで行っています。(2012年09月現在)

uim もこのサービスに対応しています。uim-im-switcher-gtk/gtk3/qt4 や uim-pref-gtk/gtk3/qt4 で "Google-CGIAPI-Jp" を選択してください。

設定

環境変数

以下を ~/.xprofile、~/.xinitrc、~/.xsession などに設定します:

export GTK_IM_MODULE='uim'
export QT_IM_MODULE='uim'
uim-xim &
export XMODIFIERS='@im=uim'
ノート:
  • これらの環境変数はデスクトップ環境やウィンドウマネージャーの起動前に export してください。
  • X セッションの管理に systemd を使用している場合はsystemd を使用している場合を参照してください。

ツールバーユーティリティ

UimToolbar を使用する場合は、以下のうちの一つを追加します。

uim-toolbar-gtk/qt

ウィンドウとして表示されるツールバーを使用する場合。

GTK+ 2 用:

uim-toolbar-gtk &

GTK+ 3 用:

uim-toolbar-gtk3 &

Qt4 用:

uim-toolbar-qt4 &

uim-toolbar-gtk-systray

システムトレイ (通知エリア) に表示されるツールバーを使用する場合。

GTK+ 2 用:

uim-toolbar-gtk-systray &

GTK+ 3 用:

uim-toolbar-gtk3-systray &

パネルアプレット

GNOME、Xfce、あるいは KDE を使用している場合、パネルアプレットのツールバーも使用できます。Xfce の場合には xfce4-xfapplet が必要です。

systemd を使用している場合

X セッションの管理に systemd を使用している場合、systemd セッション内で環境変数の設定が必要になります。

~/.config/systemd/user/uim-env.service
[Unit]
Description=uim environment initialization
Before=xorg.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl --user set-environment XMODIFIERS=@im=uim
ExecStart=/usr/bin/systemctl --user set-environment GTK_IM_MODULE=uim
ExecStart=/usr/bin/systemctl --user set-environment QT_IM_MODULE=uim
~/.config/systemd/user/uim.service
[Unit]
Description=uim daemon
Wants=uim-env.service
After=xorg.target

[Service]
ExecStart=/usr/bin/uim-xim
Restart=on-abort

[Install]
WantedBy=xorg.target
~/.config/systemd/user/uim-toolbar.service
[Unit]
Description=uim toolbar
PartOf=uim.service

[Service]
ExecStart=/usr/bin/uim-toolbar-of-your-choice
Restart=on-abort

[Install]
WantedBy=uim.service

以下のコマンドでサービスが有効になります:

 $ systemctl --user enable uim.service uim-toolbar.service

uim の初期設定

以下のコマンドで uim の設定ウィンドウが表示されます :

$ uim-pref-gtk (または、uim-pref-gtk3/uim-pref-qt4)

「全体設定」の「標準の入力方式」で、お気に入りのインプットメソッドを選択します。

ノート: 初めて Mozc をインストールした直後は、Mozc は選択できません。これは Mozc が「使用可能にする入力方式」で有効になっていないためです。その右の「編集」ボタンをクリックして Mozc を有効にしてください。

uim-xim を起動するか、X の再起動で uim を使用して日本語が入力できるようになります。

Emacs で 日本語を入力する

uim は uim.el を提供しており、Emacs 上で uim を使用して日本語を入力できます。ここでは Emacs 上で uim を、文字エンコーディング UTF-8 で使用する設定を説明します。

詳細は 公式 wiki 参照してください。

LEIM かマイナーモードか

uim.el を使用する場合、直接マイナーモードで使用するか、LEIM (Library of Emacs Input Method) を使用するかを選択できます。uim.el とそれ以外の IM をよく切り替えて使う場合は LEIM フレームワークを使用してください。

マイナーモードで使うための設定

マイナーモードで使用する場合は、以下の設定を .emacs.d/init.el あるいはその他の Emacs カスタム設定用ファイルに追加します。

;; read uim.el
(require 'uim)
;; uncomment next and comment out previous to load uim.el on-demand
;; (autoload 'uim-mode "uim" nil t)

;; key-binding for activate uim (ex. C-\)
(global-set-key "\C-\\" 'uim-mode)
LEIM で使うための設定

LEIM で使用する場合は、以下の設定を .emacs.d/init.el あるいはその他の Emacs カスタム設定用ファイルに追加し、使用するかな漢字変換エンジンをデフォルトに指定します。

;; read uim.el with LEIM initializing
(require 'uim-leim)

;; set default IM. Uncomment the one of the followings.
;(setq default-input-method "japanese-anthy-utf8-uim")        ; Anthy (UTF-8)
;(setq default-input-method "japanese-google-cgiapi-jp-uim")  ; Google-CGIAPI-Jp
;(setq default-input-method "japanese-mozc-uim")              ; Mozc

既定の文字エンコーディングの指定

uim.el はデフォルトの文字エンコーディングを EUC-JP としていますが、UTF-8 を使用したい場合は以下の設定を追加します。

;; Set UTF-8 as preferred character encoding (default is euc-jp).
(setq uim-lang-code-alist
      (cons '("Japanese" "Japanese" utf-8 "UTF-8")
           (delete (assoc "Japanese" uim-lang-code-alist) 
                   uim-lang-code-alist)))

インライン変換候補表示機能をデフォルトで有効にする

インライン変換候補表示機能とは、変換候補を入力中の文字列のすぐ下(もしくはすぐ上)に縦方向に並べて表示させる機能です。インライン変換候補表示機能をデフォルトで有効にする場合は以下の設定を追加します。

;; set inline candidates displaying mode as default
(setq uim-candidate-display-inline t)

入力モードの初期値をひらがな入力にする

uim.el 起動時の入力モードをひらがな入力にする場合は、使用するインプットメソッドに合わせて以下のように編集します。

;; Set Hiragana input mode at activating uim.
(setq uim-default-im-prop '("action_anthy_utf8_hiragana"
                            "action_google-cgiapi-jp_hiragana"
                            "action_mozc_hiragana"))

Emacs 上で C-SPC が IM の入力モードの切り替えに使われてしまうのを抑止する

デスクトップ環境上で IM のオン・オフのキー割り当てに C-SPC を設定していると、uim.el がアクティブになっている時 C-SPC は入力モードの切り替えに使用されます。これを抑止し、set-mark-command として使用するには、以下の設定を .emacs.d/init.el あるいはその他の Emacs カスタム設定用ファイルに追加します。

(add-hook 'uim-load-hook
          '(lambda ()
             (define-key uim-mode-map [67108896] nil)
             (define-key uim-mode-map [0] nil)))

Emacs 上で C-SPC が IM のオン・オフで使われてしまうのを抑止する

デスクトップ環境上で IM のオン・オフのキー割り当てに C-SPC を設定しており、Emacs 上でもそちらが優先されて C-SPC/C-@ で set-mark-command が使えなくて困る、という場合は、~/.Xresources~/.Xdefaults に以下を追加します。

Emacs*UseXIM: false

トラブルシューティング

Opera で日本語入力ができない

Opera で日本語が入力できない場合は、以下のように環境変数を変更してみてください:

export QT_IM_MODULE='xim'

uim-toolbar-gtk-systray: トレイアイコンがつぶれてます

DE、WM、あるいはパネルアプリケーションの中には、システムトレイ上に、アプリケーションあたり1個のアイコンスペースしか用意しないものがありますが、uim-toolbar-gtk-systray はそこにデフォルトのツールバーアイコン4,5個をまとめて表示しようとするために潰れてしまいます。ツールバーに表示するアイコンを1個だけにすることで解決します。以下は、入力モードアイコンのみを表示させる例です:

  1. uim-pref-gtk を起動する。
  2. 「グループ」の中から「ツールバー」を選択する。
  3. 「入力方式切り替えメニュー」および「ボタン」ボックスの中のすべてのチェックボックスのマークを外す。
  4. 「グループ」の中から、使用する入力メソッド (Anthy、Anthy (UTF-8)、またはMozc)を選択する。
  5. 「ツールバー」ボックスの「有効にするボタン」の右端にある「編集」ボタンをクリックする。
  6. 「入力モード」のみ有効にする。
  7. 「OK」をクリックして設定ウィンドウを閉じる。

トレイアイコンは "あ" (ひらがな入力) または "ー" (直接入力) になっているはずです。

暗いテーマを使用しているので uim のモードアイコンが見えません

暗いテーマ用のアイコンを使用します (uim 1.6.0 以降)。

  1. uim-pref-gtk を起動する。
  2. 「グループ」の中から「ツールバー」を選択する。
  3. 「アイコン」ボックスの「濃色背景向けアイコンを使用する」にチェックマークをつける。
  4. 「OK」をクリックして設定ウィンドウを閉じる。

GTK_IM_MODULE を設定したのに GTK+ 2 アプリケーションで uim が使用できません

環境変数 GTK_IM_MODULE を設定してあるのに GTK+ 2 アプリケーションで uim が使用できない場合、gtk-query-immodules-2.0 によって作成される gtk.immodules の指定が必要です。

GTK+ 2 用のデフォルトパスは /etc/gtk-2.0/gtk.immodules です。

環境変数 GTK_IM_MODULE_FILE を設定するか (GTK+ 3 アプリケーションとの互換性はないので 非推奨)、im_module_file を設定します (推奨)。

以下を /etc/gtk-2.0/gtkrc または ~/.gtkrc-2.0 に追加します:

 im_module_file "/etc/gtk-2.0/gtk.immodules"

全角モードで子音を入力できません

全角モードで子音を入力したい場合、以下を設定ファイルに追加してください。

例: ~/.uim.d/customs/custom-google-cgiapi-jp.scm
    (define ja-rk-rule-hoge
    (map
    (lambda (c)
    (list (cons (list c) ()) (list c c c)))
    '("b" "c" "d" "f" "g" "h" "j" "k" "l" "m"
    "p" "q" "r" "s" "t" "v" "w" "x" "y" "z"
    "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M"
    "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")))
    (if (symbol-bound? 'ja-rk-rule-hoge)
    (set! ja-rk-rule (append ja-rk-rule-hoge ja-rk-rule)))

関連文献

uim
uim 公式ドキュメント
uim on wikibooks
フォント
日本語フォントショーケース
modified Japanese fonts