Ricty最高!(というか、Inconsolata最高!)
一昨年くらいから、超カッコイイプログラミング用フォント Ricty とviバインドが使えるエディタ Sublime Text 3 や vim + iTerm2 を組み合わせた環境でプログラムや文章を書いています。
Rictyはラテン文字に「Inconsolata」、それ以外(主に日本語表示)に「Migu 1M」を使う合成フォントで、 英数字、日本語どちらをつかても読みやすく、そして使いやすいフォントです。 視認性が高く入力結果の確認が苦なく行えるので書いていて楽しいです。
年末の環境再構築と一緒に、 Mac OSX 10.9(Mavericks)でRictyを一発セットアップするスクリプトを作ってみました。
簡単にセットアップ出来るので、是非一度試してみてください。
セットアップ手順
(事前準備)HomeBrewを使える様にする
HomeBrewのセットアップ方法は 過去記事 を参照の事
Rictyセットアップスクリプト実行!
後は Terminal.app
や iTerm.app
から下記ワンライナーを実行して完成です
% curl -L 'https://gist.github.com/ysaotome/7286145/raw/installing_ricty_on_MacOSX.sh' | bash
- こんなログがながれます。
- 途中、フォントのインストールのためにパスワードが聞かれます。
Password:
に続いてユーザのパスワードを入力してください。
- 途中、フォントのインストールのためにパスワードが聞かれます。
% curl -L 'https://gist.github.com/ysaotome/7286145/raw/installing_ricty_on_MacOSX.sh' | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 869 0 869 0 0 133 0 --:--:-- 0:00:06 --:--:-- 199
==> Installing dependencies for fontforge: gettext, libpng, jpeg, libtiff, freetype, fontconfig
==> Installing fontforge dependency: gettext
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gettext-0.18.3.1.mavericks.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring gettext-0.18.3.1.mavericks.bottle.1.tar.gz
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.
OS X provides the BSD gettext library and some software gets confused if both are in the library path.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/gettext/lib
CPPFLAGS: -I/usr/local/opt/gettext/include
==> Summary
🍺 /usr/local/Cellar/gettext/0.18.3.1: 374 files, 12M
==> Installing fontforge dependency: libpng
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libpng-1.5.17.mavericks.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring libpng-1.5.17.mavericks.bottle.1.tar.gz
🍺 /usr/local/Cellar/libpng/1.5.17: 15 files, 1.0M
==> Installing fontforge dependency: jpeg
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/jpeg-8d.mavericks.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring jpeg-8d.mavericks.bottle.2.tar.gz
🍺 /usr/local/Cellar/jpeg/8d: 18 files, 780K
==> Installing fontforge dependency: libtiff
==> Downloading ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.3.tar.gz
curl: (28) Operation timed out after 5368 milliseconds with 0 out of 0 bytes received
Trying a mirror...
==> Downloading http://download.osgeo.org/libtiff/tiff-4.0.3.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/libtiff/4.0.3 --without-x --disable-lzma --with-jpeg-include-dir=/usr/local/opt/jpeg/include --with-jpeg-lib-dir=/usr/local/opt/jpeg/lib
==> make install
🍺 /usr/local/Cellar/libtiff/4.0.3: 254 files, 3.8M, built in 35 seconds
==> Installing fontforge dependency: freetype
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/freetype-2.5.2.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring freetype-2.5.2.mavericks.bottle.tar.gz
🍺 /usr/local/Cellar/freetype/2.5.2: 59 files, 2.7M
==> Installing fontforge dependency: fontconfig
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/fontconfig-2.11.0.mavericks.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring fontconfig-2.11.0.mavericks.bottle.1.tar.gz
==> /usr/local/Cellar/fontconfig/2.11.0/bin/fc-cache -frv
🍺 /usr/local/Cellar/fontconfig/2.11.0: 445 files, 4.0M
==> Installing fontforge
==> Downloading http://downloads.sourceforge.net/project/fontforge/fontforge-source/fontforge_full-20120731-b.tar.bz2
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file fontforge/startui.c
Hunk #1 succeeded at 50 with fuzz 2.
==> ./configure --prefix=/usr/local/Cellar/fontforge/20120731 --enable-double --without-freetype-bytecode --without-cairo --without-pango --without-x --with-static-imagelibs --enable-pyextension
==> make
==> make install
==> Caveats
For non-homebrew python (2.x), you need to amend your PYTHONPATH like so:
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
==> Summary
🍺 /usr/local/Cellar/fontforge/20120731: 365 files, 12M, built in 66 seconds
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 58464 100 58464 0 0 9879 0 0:00:05 0:00:05 --:--:-- 16013
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
100 4168k 100 4168k 0 0 249k 0 0:00:16 0:00:16 --:--:-- 427k
Archive: migu-1m-20130617.zip
creating: migu-1m-20130617/
inflating: migu-1m-20130617/migu-1m-bold.ttf
inflating: migu-1m-20130617/migu-1m-regular.ttf
creating: migu-1m-20130617/ipag00303/
inflating: migu-1m-20130617/ipag00303/IPA_Font_License_Agreement_v1.0.txt
inflating: migu-1m-20130617/ipag00303/Readme_ipag00303.txt
inflating: migu-1m-20130617/migu-README.txt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 129 100 129 0 0 19 0 0:00:06 0:00:06 --:--:-- 28
100 14449 100 14449 0 0 1052 0 0:00:13 0:00:13 --:--:-- 3621
x yascentur-Ricty-36c4bc7/
x yascentur-Ricty-36c4bc7/README.md
x yascentur-Ricty-36c4bc7/misc/
x yascentur-Ricty-36c4bc7/misc/copyright_reviser.pe
x yascentur-Ricty-36c4bc7/misc/os2version_reviser.sh
x yascentur-Ricty-36c4bc7/misc/print_ricty.c
x yascentur-Ricty-36c4bc7/misc/replace_glyph.pe
x yascentur-Ricty-36c4bc7/misc/ricty_ascii_extractor.pe
x yascentur-Ricty-36c4bc7/misc/ricty_greek_regenerator.pe
x yascentur-Ricty-36c4bc7/ricty_discord_patch.pe
x yascentur-Ricty-36c4bc7/ricty_generator.sh
Ricty Generator 3.2.2
Author: Yasunori Yusa <lastname at save dot sys.t.u-tokyo.ac.jp>
This script is for generating ``Ricty'' font from Inconsolata and Migu 1M.
It requires 2-5 minutes to generate Ricty. Owing to SIL Open Font License
Version 1.1 section 5, it is PROHIBITED to distribute the generated font.
Generate modified Inconsolata.
Find ./yascentur-Ricty-36c4bc7/Inconsolata.otf.
Save Modified-Inconsolata-Regular.sfd.
While making Inconsolata bold, wait a moment...
Save Modified-Inconsolata-Bold.sfd.
Generate modified Migu 1M.
Find ./yascentur-Ricty-36c4bc7/migu-1m-regular.ttf.
While scaling migu-1m-regular.ttf, wait a little...
Save Modified-migu-1m-regular.sfd.
Find ./yascentur-Ricty-36c4bc7/migu-1m-bold.ttf.
While scaling migu-1m-bold.ttf, wait a little...
Save Modified-migu-1m-bold.sfd.
Generate Ricty.
While merging Modified-Inconsolata-Regular.sfd with Modified-migu-1m-regular.sfd, wait a little more...
Save Ricty-Regular.ttf.
While merging Modified-Inconsolata-Bold.sfd with Modified-migu-1m-bold.sfd, wait a little more...
Save Ricty-Bold.ttf.
Remove temporary files.
Generate RictyDiscord-Regular.ttf.
Generate RictyDiscord-Bold.ttf.
Succeeded to generate Ricty!
Password:
- セットアップ終了!簡単!
Font BookでMacにRictyが登録されたか確認
- 「Spotlight」を起動し
font
と入力して[Enter]
で「Font Book」を起動します
- 右上の検索窓に
Ricty
と入力して[Enter]
でRictyが登録されているか検索
- 無事登録されました
Ricty を使ってみよう
Sublime Text 3
そもそも Sublime Text 3 が入ってない人は OS X (10.7 or later is required)
をダウンロードしてインストール
設定ファイルの編集
- メニューの 「Sublime Text」 → 「Preferences」 → 「Settings - User」 を選択
- 開いた設定ファイルに設定を書き込んで Ricty を標準フォントとして設定
"font_face": "Ricty"
以外の項目はお好みに合わせてどうぞ
{
"vintage_start_in_command_mode": true,
"draw_white_space": "all,"
"font_face": "Ricty",
"font_size": 14,
"highlight_line": true,
"line_padding_top": 0,
"tab_size": 4,
"trim_trailing_white_space_on_save": true,
"word_wrap": true
}
- 保存すれば反映されます
vim + iTerm2
そもそも iTerm2 が入ってない人は Stable Releases
をダウンロードしてインストール
vimは HomeBrew がセットアップ済みであればターミナルから brew
コマンドでインストール
% brew install vim
設定ファイルを編集
-
iTerm2を設定
- メニューの 「iTerm」 → 「Preferences」 を選択
-
まずは、 「Profiles」 → 「Text」 タブの中の 「Regular Font」 と 「Non-ASCII Font」 を
Ricty
に変更- フォント選択中に実際の画面がプレビューされるので実際にファイルを開きながら設定すると雰囲気をつかみやすいです
- 次に、 「Profiles」 → 「Terminal」 タブの中の 「Report Terminal Type:」を
xterm-256color
とします
- vimを設定
- vimの設定ファイルを開き
:syntax on
と追記
- vimの設定ファイルを開き
% vim ~/.vimrc
:syntax on
- 保存すれば反映されます
余談
Windowsの人
会社のWindowsでも使っていますが、どうやて入れたか覚えていない。。。調べてみたら下記手順が良さげ
ちなみにWindowsのエディタはSublime Text 3で、ターミナルはXshell使ってます
Sublime Textは Eiji Kitamura さんの Sublime Text 2 のススメ に触発されて導入したのがきっかけだった気がします。
Ricty生成スクリプトの補助スクリプト
Ricty はライセンスの関係でフォント自体の配布はせずに、生成スクリプトだけ配布されています。
今回は下記の様なスクリプトを用意して生成スクリプトを補助しています。