|
由于习惯了使用emacs进行各种文件的编辑,所以安装完FC5之后第一件事就是下载emacs22 cvs自己编译。
emacs22 cvs版可有下列命令得到:
[xphenix@XPHENIX ~]$ cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/emacs co emacs
下载完毕进入emacs目录,一次运行以下命令,中间可能提示你缺少某些库,那就得你自己装上了。
1. ./configure --with-gtk --with-xpm --with-jpeg --with-gif --with-tiff --with-png
2. make bootstrap
3. make install
至此emacs应该安装好了。
在命令行下输入 emacs 就能打开emacs程序。但是我发现此时它显示的中文很难看,字体很大,和同buffer下的英文字体相比不协调,所以就需要配置 .emacs 文件使其漂亮的显示中文。
网上有很多使emacs显示中文的说明,但是大多是在gbk编码模式下进行配置的。关于在UTF-8和ZH_CN.UTF-8下的介绍则很少,而且在字体方面都是使用的SIMSUN。不过我们既然使用LINUX,还是尽量不要和MS产生纠葛为好。所以我选用的是网上评价非常好的fireflysung。
fireflyfung可以从以下地址下载:
http://www.study-area.org/apt/firefly-font/
将其中的fireflysung.ttf 释出放到/usr/share/fonts/chinese/TrueType 目录下,然后以root身份在这个目录下运行
mkfontscale
mkfontdir
fc-cache -f
最好重启一下X,
下面让我们来看看系统支持的字型有哪些。
运行 xlsfonts | grep sung
在我的电脑上得到两个输出
-misc-ar pl new sung-medium-r-normal--0-0-0-0-p-0-iso10646-1
-misc-ar pl new sung-medium-r-normal--0-0-0-0-p-0-koi8-r
至此表示系统已经能够识别fireflysung字体了。
然后运行 xfontsel 选择具体的字型。
我们可以看到,当 fmly -> ap pl new sung 时, 相应的 pxlsz 为 12, slant 为 r, sWdth 为 normal, rgstry为iso10646或koi8(我们选用前一个),encdng 为 1。
就得到这样一个中文字型: -*-ar pl new sung-*-r-normal-*-12-*-*-*-*-*-iso10646-1
好了,下那在要把这个字型添加到~/.emacs文件中去,格式如下:
(prefer-coding-system 'utf-8)
(create-fontset-from-fontset-spec
"-*-fixed-medium-r-normal-*-14-*-*-*-c-*-fontset-firefly,
chinese-gb2312:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
chinese-big5-1:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
chinese-big5-2:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
chinese-sisheng:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
chinese-cns11643-3:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
chinese-cns11643-4:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
chinese-cns11643-5:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
chinese-cns11643-6:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
chinese-cns11643-7:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
japanese-jisx0208-1978:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
japanese-jisx0208:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
japanese-jisx0212:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
japanese-jisx0213-1:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
japanese-jisx0213-2:-*-ar pl new sung-*-r-normal-*-14-*-*-*-*-*-iso10646-1,
"
)
(set-default-font "fontset-firefly")
(add-to-list 'after-make-frame-functions
(lambda (new-frame) (select-frame new-frame)
(set-default-font "fontset-firefly")))
注意,我在这里字体大小用的是14,而并非系统支持的12,但是我这样改了之后并没有出问题,而且显示的比12号字要清楚的多。
现在重启emacs,是不是好看了许多?下面附图供大家参看。
BTW:我是在参考了水木社区EMACS版的文章之后实验出来的。尽管安装SMTH上的办法没有配置成功,但还是感谢SMTH上那些热衷于帮助他人的朋友。 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|