如何在emacs中设置自定义字体?
答
你可以使用:
(set-default-font "ProggyClean")
它被废弃了,应该是
(set-frame-font "ProggyClean")
从Emacs的23.1
在你.emacs
,或者你可以做M-x: customize-face: default
并设置ProggyClean
为 “字体家庭”。
答
只需在您的.emacs中插入set-default-font将不会在多个帧中工作 - 每个新帧都将返回到旧的默认值。自定义确实与多个框架一起工作,但我从未设法让它在不同的平台上正常工作(即使对于相同的字体,不同的平台也有不同的字体设置)。
所以!这是我在.emacs中获得的。它可以在linux,win32和cygwin中工作,并且可以与多个框架一起工作(因此也适用于emacs客户端)。
(defconst win32p (eq system-type 'windows-nt) "Are we running on a Windows system?")
(defconst cygwinp (eq system-type 'cygwin) "Are we running on Cygwin?")
(defconst linuxp (or (eq system-type 'gnu/linux) (eq system-type 'linux)) "Are we running on Linux?")
;;font setups
(defvar vsc-little-font "" "*My lovely little font")
(when linuxp
(setq vsc-little-font "ProggyTinyTT-8"))
(when cygwinp
(setq vsc-little-font "ProggyTinyTT-16"))
(when win32p
(setq vsc-little-font "-outline-ProggyTinyTT-normal-r-normal-normal-16-120-96-96-c-*-iso8859-1"))
(add-to-list 'default-frame-alist (cons 'font vsc-little-font))
(add-to-list 'initial-frame-alist (cons 'font vsc-little-font))
我在哪里必须放下载的字体? – 2010-03-01 21:58:44
嗨Lukasz,你以正常的方式安装字体,即将其放入$ WINDOWS \ FONTS文件夹或Linux下〜/ .fonts并运行fc-cache。没有特殊的emacs需要的东西。 – danielpoe 2010-03-02 08:04:35