Emacs のフォントについて

以下のものを *scaratch* なりで eval すると

(mapcar (lambda (f)
          (cons f
                (shell-command-to-string 
                 (format "fc-match -v '%s'|grep spacing|awk '{printf(\"%%s\",$2)}'" f))))
        (font-family-list))
(("fixed" . "110(i)(s)") ("nil" . "90(i)(s)") ("fixed" . "110(i)(s)") ("nil" . "90(i)(s)") ("fixed" . "110(i)(s)") ("courier" . "100(i)(s)") ("helvetica" . "") ("new century schoolbook" . "") ("symbol" . "") ("times" . "") ("courier" . "100(i)(s)") ("helvetica" . "") ("new century schoolbook" . "") ("symbol" . "") ("times" . "") ("ethiomx16f" . "90(i)(s)") ("fixed" . "110(i)(s)") ("song" . "90(i)(s)") ("gothic" . "") ("mincho" . "90(i)(s)") ("fixed" . "110(i)(s)") ("song" . "90(i)(s)") ("fixed" . "110(i)(s)") ("fangsong ti" . "90(i)(s)") ("song ti" . "90(i)(s)") ("fixed" . "110(i)(s)") ("ethiomx16f" . "90(i)(s)") ("fixed" . "110(i)(s)") ("song" . "90(i)(s)") ("gothic" . "") ("mincho" . "90(i)(s)") ("fixed" . "110(i)(s)") ("song" . "90(i)(s)") ("fixed" . "110(i)(s)") ("fangsong ti" . "90(i)(s)") ("song ti" . "90(i)(s)") ("fixed" . "110(i)(s)") ("gothic" . "") ("marumoji" . "90(i)(s)") ("mincho" . "90(i)(s)") ("gothic" . "") ("marumoji" . "90(i)(s)") ("mincho" . "90(i)(s)") ("gothic" . "") ("mona" . "") ("gothic" . "") ("biwidth" . "90(i)(s)") ("fixed" . "110(i)(s)") ("biwidth" . "90(i)(s)") ("fixed" . "110(i)(s)") ("fxd" . "110(i)(s)") ("goth_p" . "") ("gothic" . "") ("hlv" . "") ("hlvw" . "") ("qub" . "") ("sys" . "") ("fxd" . "110(i)(s)") ("goth_p" . "") ("gothic" . "") ("hlv" . "") ("hlvw" . "") ("qub" . "") ("sys" . "") ("fixed" . "110(i)(s)") ("nil" . "90(i)(s)") ("fixed" . "110(i)(s)") ("nil" . "90(i)(s)") ("fixed" . "110(i)(s)") ("courier" . "100(i)(s)") ("helvetica" . "") ("new century schoolbook" . "") ("symbol" . "") ("times" . "") ("courier" . "100(i)(s)") ("helvetica" . "") ("new century schoolbook" . "") ("symbol" . "") ("times" . "") ("fixed" . "110(i)(s)") ("xtis24.pcf" . "100(i)(s)") ("Century Schoolbook L" . "") ("Helvetica" . "") ("M+1MN+IPAG" . "90(i)(s)") ("taipei16" . "100(i)(s)") ("taipei24" . "100(i)(s)") ("Andale Mono" . "100(i)(s)") ("Mona" . "") ("Trebuchet MS" . "") ("xtis24" . "100(i)(s)") ("Webdings" . "") ("DejaVu Sans Mono" . "100(i)(s)") ("Arial Black" . "") ("IPA明朝" . "90(i)(s)") ("Verdana" . "") ("ethio16f-uni" . "90(i)(s)") ("URW Palladio L" . "") ("Bitstream Vera Sans" . "") ("東風明朝" . "") ("M+2M+IPAG" . "90(i)(s)") ("Bitstream Vera Sans Mono" . "100(i)(s)") ("URW Gothic L" . "") ("ethio24f-uni" . "90(i)(s)") ("Dingbats" . "") ("URW Chancery L" . "") ("M+1P+IPAG" . "") ("Times New Roman" . "") ("IPA モナー UIゴシック" . "") ("Bitstream Vera Serif" . "") ("M+ 1mn" . "90(i)(s)") ("DejaVu Sans" . "") ("M+2C+IPAG" . "") ("IPA モナー P明朝" . "") ("DejaVu Sans" . "") ("ethio24f-uni.pcf" . "90(i)(s)") ("IPAゴシック" . "90(i)(s)") ("DejaVu Serif" . "") ("Times" . "") ("IPA モナー 明朝" . "90(i)(s)") ("M+1C+IPAG" . "") ("IPA P明朝" . "") ("M+1M+IPAG" . "90(i)(s)") ("Comic Sans MS" . "") ("DejaVu Sans" . "") ("unifont.pcf" . "90(i)(s)") ("M+2P+IPAG" . "") ("Gothic" . "") ("Liberation Mono" . "100(i)(s)") ("Nimbus Sans L" . "") ("Biwidth" . "90(i)(s)") ("hlv" . "") ("goth_p" . "") ("fxd" . "110(i)(s)") ("vt100-graphics.pcf" . "90(i)(s)") ("ethio16f-uni.pcf" . "90(i)(s)") ("Standard Symbols L" . "") ("東風ゴシック" . "") ("Nimbus Mono L" . "100(i)(s)") ("taipei24.pcf" . "100(i)(s)") ("Courier" . "100(i)(s)") ("Liberation Serif" . "") ("IPA モナー Pゴシック" . "") ("taipei16.pcf" . "100(i)(s)") ("hlvw" . "") ("IPA Pゴシック" . "") ("Nimbus Roman No9 L" . "") ("Liberation Sans" . "") ("Fixed" . "110(i)(s)") ("IPA モナー ゴシック" . "90(i)(s)") ("Georgia" . "") ("unifont" . "90(i)(s)") ("cursor.pcf" . "100(i)(s)") ("Arial" . "") ("Courier New" . "100(i)(s)") ("DejaVu Serif" . "") ("M+ 1c" . "") ("M+ 1m" . "90(i)(s)") ("M+ 2p" . "") ("M+ 2m" . "90(i)(s)") ("M+ 1p" . "") ("M+ 2c" . "") ("New Century Schoolbook" . "") ("Impact" . "") ("sys" . "") ("qub" . "") ("URW Bookman L" . ""))

こんなんが出てきます。

これのうち 90 が FC_DUAL (二種文字幅) でHEADのEmacsやパッチがあたってるものでは奇麗に表示できます。 100 が FC_MONO (単一文字幅) でどれででも奇麗にいけます。書いてないのは PROPORTIONAL (文字幅いろいろ) でこれはインデントがごちゃごちゃになりがちです (PROPORTIONAL を名乗っているだけで実質 FC_DUALなものならOK)。

でも、 FC_MONO なものはだいたいが英文フォントで日本語で使うには微妙です。なので、FC_DUAL をうまく表示できなければ、無理矢理 PROPORTIONAL 認識させてやれば、まぁうまくやってくれます。

http://garakuta.homelinux.org/~nosuke/diary/diary.html?y=2008&m=10&d=15&n=1 <- このあたりを参考に

  • Emacs で "(set-default-font "IPAGothic-16:spacing=0")" のように ":spacing=0" をつける。
  • ~/.fonts.conf に以下のように書く
 <match target="font">
  <test name="family" compare="eq">
    <string>IPAGothic</string>
  </test>
  <edit name="spacing"><int>0</int></edit>
 </match>

これで spacing が 0 すなわち PROPORTIONAL 認識して文字幅をまともに計算してくれます。

おまけ
fc-match -v の antialias の行を見ればアンチエイリアスがわかると思いますね。