試験運用中なLinux備忘録・旧記事

はてなダイアリーで公開していた2007年5月-2015年3月の記事を保存しています。

M+アウトラインフォントのCVS版で、漢字グリフを含めてビルドした際の覚え書き

[引用] http://web.archive.org/web/20070714105215/http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/download/index.html#kanji より

かな文字と同様に 7 ウエイト分の漢字制作を開始しましたが、他のフォントから合成される漢字との不統一感を避けるため、実用的な文字数が揃うまでは公開版の TESTFLIGHT に含めない予定です。
画面表示程度であれば不統一感もほとんど気になる事はないと思いますので、UI などに使用する場合は次の方法で漢字込みの CVS 版 M+ FONTS も是非お試しください。

漢字部分はCVS版のみということなので、公式ページに書いてあるとおりに作業。FontForgeを使用するため、事前にディストリのパッケージでインストールしておく。
(2010/7/4)2010年7月の時点では漢字を含めたビルドの流れは同様のようだが、FontForge絶対パスではなくコマンド名(fontforge)で実行しており、以下のような問題はなかった。
以下、以前の内容となる。

$ cvs -d:pserver:anonymous@cvs.sourceforge.jp:/cvsroot/mplus-fonts login
(パスワードは、何も入れずにEnter)
$ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.jp:/cvsroot/mplus-fonts co mplus_outline_fonts
$ cd mplus_outline_fonts
$ MPLUS_FULLSET=yes make
(略)
make[2]: Entering directory `/tmp/work/mplus_outline_fonts/work.d/targets/mplus-1p/thin'
ln -s ../../../../scripts/build-ttf.pe build-ttf.pe
perl ../../../../scripts/split-bearing.pl thin hiragana1 katakana1 miscellaneous1 latin_fullwidth1 latin_proportional1 kanji > set_bearings
perl ../../../../scripts/split-kerning.pl thin hiragana1 katakana1 miscellaneous1 latin_fullwidth1 latin_proportional1 kanji > set_kernings
sed 's/%Fnbase%/mplus-1p/;s/%Family%/m+-1p/g;s/%Weight%/thin/g' ../../../../scripts/set_fontnames.tmpl > set_fontnames
ln -s ../../../../scripts/set_instructions set_instructions
/usr/local/bin/fontforge -script build-ttf.pe mplus-1p-thin.ttf hiragana1 katakana1 miscellaneous1 latin_fullwidth1 latin_proportional1 kanji
make[2]: /usr/local/bin/fontforge: Command not found
make[2]: *** [mplus-1p-thin.ttf] Error 127
make[2]: Leaving directory `/tmp/work/mplus_outline_fonts/work.d/targets/mplus-1p/thin'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/work/mplus_outline_fonts/work.d/targets/mplus-1p'
make: *** [ttf] Error 2

どこかでfontforgeの場所が決め打ちされているらしい。

$ find -name Makefile -exec grep fontforge {} \; -print
        /usr/local/bin/fontforge -script build-ttf.pe $@ $(MODULES)
./work.d/targets/mplus-1p/heavy/Makefile
        /usr/local/bin/fontforge -script build-ttf.pe $@ $(MODULES)
./work.d/targets/mplus-1p/black/Makefile
        /usr/local/bin/fontforge -script build-ttf.pe $@ $(MODULES)
./work.d/targets/mplus-1p/thin/Makefile
        /usr/local/bin/fontforge -script build-ttf.pe $@ $(MODULES)
./work.d/targets/mplus-1p/light/Makefile
        /usr/local/bin/fontforge -script build-ttf.pe $@ $(MODULES)
./work.d/targets/mplus-1p/regular/Makefile
        /usr/local/bin/fontforge -script build-ttf.pe $@ $(MODULES)
./work.d/targets/mplus-1p/medium/Makefile
        /usr/local/bin/fontforge -script build-ttf.pe $@ $(MODULES)
./work.d/targets/mplus-1p/bold/Makefile

置換。

$ find -name Makefile -exec sed -i -e 's|/usr/local/bin/fontforge|/usr/bin/fontforge|' {} \;
$ MPLUS_FULLSET=yes make

としてもまた同じく停止してしまったため、どこかのファイルから生成されているのではないかと思ったら

$ make clean
$ find -exec grep /usr/local/bin/fontforge {} \; -print
        /usr/local/bin/fontforge -script build-ttf.pe $@ $(MODULES)
./scripts/target-Makefile.2.tmpl
#!/usr/local/bin/fontforge -script
./scripts/build-ttf.pe
        Print("      /usr/local/bin/fontforge -script m++ipa.pe    ")
./release/m++ipa.pe

このあたりが怪しかったので、置換してみたところ、clean後最初からやり直しても無事に完了した。

$ for f in scripts/target-Makefile.2.tmpl scripts/build-ttf.pe release/m++ipa.pe; do sed -i -e 's|/usr/local/bin/fontforge|/usr/bin/fontforge|' $f; done
$ MPLUS_FULLSET=yes make
(略)
make[2]: Entering directory `/tmp/work/mplus_outline_fonts/work.d/targets/mplus-2mn/thin'
ln -s ../../../../scripts/build-ttf.pe build-ttf.pe
perl ../../../../scripts/split-bearing.pl thin hiragana2 katakana2 miscellaneous2 latin_fullwidth1 latin_fullwidth2 latin_full_clear1 latin_full_clear2 latin_mono_new1 kanji > set_bearings
perl ../../../../scripts/split-kerning.pl thin hiragana2 katakana2 miscellaneous2 latin_fullwidth1 latin_fullwidth2 latin_full_clear1 latin_full_clear2 latin_mono_new1 kanji > set_kernings
sed 's/%Fnbase%/mplus-2mn/;s/%Family%/m+-2m/g;s/%Weight%/thin/g' ../../../../scripts/set_fontnames.tmpl > set_fontnames
ln -s ../../../../scripts/set_instructions set_instructions
/usr/bin/fontforge -script build-ttf.pe mplus-2mn-thin.ttf hiragana2 katakana2 miscellaneous2 latin_fullwidth1 latin_fullwidth2 latin_full_clear1 latin_full_clear2 latin_mono_new1 kanji
Copyright (c) 2000-2006 by George Williams.
 Executable based on sources from 15:48 3-Jul-2006-ML.
何も読み込んでいません.
何も読み込んでいません.
make[2]: Leaving directory `/tmp/work/mplus_outline_fonts/work.d/targets/mplus-2mn/thin'
make[1]: Leaving directory `/tmp/work/mplus_outline_fonts/work.d/targets/mplus-2mn'

あとは、出来たフォントをp7zipでまとめてみる。

$ mkdir /tmp/work/out
$ find -name "*.ttf" -exec cp {} /tmp/work/out/ \;
$ cd /tmp/work/out/
$ 7z a mplus-cvs-fullset-20070815.7z *.ttf


ビルドエラーの件では、いちいちsedをするのが面倒なら、下でも通るとは思われるが...

$ sudo ln -s /usr/bin/fontforge /usr/local/bin/