合成フォント作成環境つくる

## なんで

  * gvim 日本語きれいにしたい 
    * そこまでひどくはないものの、日本語の表示に違和感がある
  * powerline 対応もしたいので Powerline Patched でかつ和文フォント merged なフォントがほしい
  * 自分好みな合成フォントをたくさん時間かけずにつくりたい

## どうする

  * fontforge いれる 
    * homebrew にあるし楽
    * GUI で確認とりたいケース想定して `\--with-x11` オプションつける
    * なるべく自動化したいのでメインは CLI の利用


いつのまにかサイトが今っぽくなってた。

[FontForge is a font editor](http://fontforge.github.io/en-US/ "FontForge is a font editor")


## インストール

```console
$ brew info fontforge

fontforge: stable 20141230 (bottled)
https://fontforge.github.io
/usr/local/Cellar/fontforge/20141230 (1291 files, 34M) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/fontforge.rb
==> Dependencies
Build: autoconf ✔, automake ✔, pkg-config ✔
Required: libtool ✔, gettext ✔, pango ✔, zeromq ✔, czmq ✔, fontconfig ✔, cairo ✔
Recommended: libpng ✔, jpeg ✔, libtiff ✔
Optional: giflib ✘, libspiro ✘

==> Options

--with-giflib
        Build with GIF support
--with-libspiro
        Build with libspiro support
--with-x11
        Build with x11 support
--without-jpeg
        Build without jpeg support
--without-libpng
        Build without libpng support
--without-libtiff
        Build without libtiff support

==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
  mkdir -p /Users/qurage/.local/lib/python2.7/site-packages
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/qurage/.local/lib/python2.7/site-packages/homebrew.pth

$ brew uninstall fontforge                                                                                              
Uninstalling /usr/local/Cellar/fontforge/20141230...

$ brew prune && brew cleanup                                                                                            
Pruned 0 dead formulae
Tapped 45 formulae
Pruned 0 symbolic links and 20 directories from /usr/local
Removing: /usr/local/Cellar/openssl/1.0.1l...
Removing: /Library/Caches/Homebrew/openssl-1.0.1l.yosemite.bottle.tar.gz...

$ brew install fontforge --with-giflib --with-libspiro --with-x11
==> Installing dependencies for fontforge: giflib, libspiro
==> Installing fontforge dependency: giflib
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/giflib-4.1.6.yosemite.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring giflib-4.1.6.yosemite.bottle.2.tar.gz
?  /usr/local/Cellar/giflib/4.1.6: 39 files, 724K
==> Installing fontforge dependency: libspiro
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libspiro-20071029.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring libspiro-20071029.yosemite.bottle.1.tar.gz
?  /usr/local/Cellar/libspiro/20071029: 7 files, 56K
==> Installing fontforge
==> Downloading https://github.com/fontforge/fontforge/archive/20141230.tar.gz
######################################################################## 100.0%
==> ./bootstrap
==> ./configure --prefix=/usr/local/Cellar/fontforge/20141230 --disable-silent-rules --with-x
==> make
==> make install
Warning: fontforge dependency gettext was built with a different C++ standard
library (libc++ from clang). This may cause problems at runtime.
==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
  mkdir -p /Users/qurage/.local/lib/python2.7/site-packages
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/qurage/.local/lib/python2.7/site-packages/homebrew.pth
==> install_name_tool -change @executable_path/../Frameworks/Breakpad.framework/Versions/A/Breakpad /usr/local/Cellar/fontforge/20141230/bin/fontforge /usr/local/Cellar/fontforge/20141230/share/fontforge/osx/FontForge.app/Contents/Frameworks/Breakpad.framework/Versions/A/Breakpad
==> Summary
?  /usr/local/Cellar/fontforge/20141230: 1293 files, 44M, built in 5.4 minutes
brew install fontforge --with-giflib --with-libspiro --with-x11  607.53s user 147.28s system 227% cpu 5:31.29 total

```

## brew linkapps は使えないぽい

### はよ

ふつうにコマンドラインで `$ fontforge` で GUI 起動する。

### 詳細

`$ brew linkapps` で `/Applications/FontForge.app` のシンボリックリンクを作成して起動しようとすると、 "_FontForge is in the wrong folder on your computer." というダイアログが出るのみで起動できない。

![FontForge is in the wrong folder on your computer.](https://qiita-image-store.s3.amazonaws.com/0/3189/7c5378a2-95f2-2af6-5d68-87da9e65a5f7.png)

```console
$ brew linkapps
    :
Linking /usr/local/opt/fontforge/FontForge.app
    :
Finished linking. Find the links under /Applications.

$ la /Applications/fontforge.app
lrwxr-xr-x  1 qurage  admin  38 Jan 25 09:39 /Applications/fontforge.app -> /usr/local/opt/fontforge/FontForge.app

```

ぐぐったら関係ありそうな github issue あった。

`$ brew linkapps` によるシンボリックリンクではなく、 `/Applications` に app を move しろとのこと。

> [on 6 Dec 2014 | Homebrew OS X install broken · Issue #1971 · fontforge/fontforge](https://github.com/fontforge/fontforge/issues/1971#issuecomment-65802923)
> 
> **davelab6 commented on 6 Dec 2014:**
> 
> Homebrew installs FontForge at /usr/local/Cellar/fontforge/, but then it instructs the user to “run brew linkapps to symlink these to /Applications”. Doing so and then double clicking the resulting “FontForge” symlink at /Applications returns this error:
> 
> Please move the FontForge.app to your system /Applications folder.

```console
$ rm /Applications/FontForge.app
remove /Applications/FontForge.app? y
/Applications/FontForge.app

$ cp -R /usr/local/Cellar/fontforge/20141230/share/fontforge/osx/FontForge.app /Applications/
   :

```

FontForge.app アイコンをクリックしてもダイアログは出なくなったものの、何も起こらない。

github issue 続きのコメントにコマンドラインで起動すると GUI のやつ起動すると書いてあったので試したら起動した。

> [on 6 Dec 2014](https://github.com/fontforge/fontforge/issues/1971#issuecomment-65812963)
> 
> **DomT4 commented on 6 Dec 2014**
> 
> Fontforge launches fine if you call it from the CLI rather than using the App bundle button. So `brew install fontforge --with-x11` and then from the command line fontforge. That'll launch the GUI for you.

```console
$ fontforge
Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
 Based on sources from 06:47 JST 26-Jan-2015-ML-D.
 Based on source from git with hash:
no xdefs_filename!
TESTING: getPixmapDir:/usr/local/share/fontforge/pixmaps
TESTING: getShareDir:/usr/local/share/fontforge
TESTING: GResourceProgramDir:/usr/local/bin
trying default theme:/usr/local/share/fontforge/pixmaps/resources
fontforge.hasUserInterface!
PyFF_onAppClosing() cnt:1

```

![fontforge splash image](https://qiita-image-store.s3.amazonaws.com/0/3189/e6f08ae1-0dec-5090-f72d-6fd2910cb1bb.png)