ubuntu9.04に外部fontを追加しデフォルトフォントにするには

meiryoKeGothicなどの外部フォントをubuntu9.04に追加する。
今までは~/.fonts/以下にインストールしていたが他ユーザにも適用できるようにする。

フォントをインストール

$ cd /usr/share/fonts/truetype/
$ sudo tar xzvf ~/ttf-ms.tgz
$ ls ttf-ms
meiryoKeGothicB.ttc  meiryoKeGothic.ttc

まあ、/usr/share/fonts/truetypeにディレクトリを掘ってttfフォントを置けばOK

デフォルトにする

/etc/fonts/conf.avail/69-language-selector-ja-jp.confを書き換える

$ sudo sed -re "s/IPAMonaPGothic/MeiryoKe_PGothic<\/string>\n\t\t\t<string>IPAMonaPGothic/" -e "s/IPAMonaGothic/MeiryoKe_Gothic<\/string>\n\t\t\t<string>IPAMonaGothic/" -i /etc/fonts/conf.avail/69-language-selector-ja-jp.conf

以下のようになっていればOK

<fontconfig>

	<match target="pattern">
		<test qual="any" name="family">
			<string>sans-serif</string>
		</test>
		<edit name="family" mode="prepend" binding="strong">
			<string>MeiryoKe_PGothic</string>
			<string>IPAMonaPGothic</string>
			<string>IPAPGothic</string>
			<string>VL PGothic</string>
			<string>Sazanami Gothic</string>
			<string>Kochi Gothic</string>
		</edit>
	</match> 
	<match target="pattern">
		<test qual="any" name="family">
			<string>serif</string>
		</test>
		<edit name="family" mode="prepend" binding="strong">
			<string>IPAMonaPMincho</string>
			<string>IPAPMincho</string>
			<string>Sazanami Mincho</string>
			<string>Kochi Mincho</string>
		</edit>
	</match> 
	<match target="pattern">
		<test qual="any" name="family">
			<string>monospace</string>
		</test>
		<edit name="family" mode="prepend" binding="strong">
			<string>MeiryoKe_Gothic</string>
			<string>IPAMonaGothic</string>
			<string>IPAGothic</string>
			<string>VL Gothic</string>
			<string>Sazanami Gothic</string>
			<string>Kochi Gothic</string>
		</edit>
	</match> 
</fontconfig>

最後にfc-listででも確認とっておけばOK