在 Emacs 上设置等宽字体?

use*_*976 6 linux fonts emacs ubuntu

我曾经使用以下命令在 Ubuntu 系统上的 emacs(在 X11 上)上使用 liberation mono 字体,并且效果很好:

(custom-set-faces
  '(default ((t (:inherit nil :stipple nil :background "lightgrey" :foreground "gray20" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :width normal :height 120 :family "liberation mono"))))
  '(background "blue")
  '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "Turquoise"))))
  '(font-lock-comment-face ((t (:foreground "darkred"))))
  '(font-lock-constant-face ((((class color) (background dark)) (:bold t :foreground "DarkOrchid"))))
  '(font-lock-doc-string-face ((t (:foreground "lightblue"))))
  '(font-lock-function-name-face ((t (:foreground "blue"))))
  '(font-lock-keyword-face ((t (:bold t :foreground "steelblue"))))
;  '(font-lock-keyword-face ((t (:bold t :foreground "CornflowerBlue"))))
  '(font-lock-preprocessor-face ((t (:italic nil :foreground "CornFlowerBlue"))))
  '(font-lock-reference-face ((t (:foreground "DodgerBlue"))))
  '(font-lock-string-face ((t (:foreground "Aquamarine4")))))
Run Code Online (Sandbox Code Playgroud)

它看起来像这样:

在此处输入图片说明

我们的系统管理员升级到新版本的 Ubuntu,现在字体在 emacs 中看起来完全不同。它看起来不再抗锯齿,看起来“不那么大胆”,看起来像这样:

在此处输入图片说明

我试图让它看起来像以前一样。基本上我想要一个看起来尽可能接近 Mac OS X 上的 Monaco 固定宽度字体的字体外观,在我的终端上看起来像这样:

在此处输入图片说明

如何才能做到这一点?想法?想不通。谢谢。

qme*_*ega 1

您可以尝试使用较低级别的set-frame-font.

(set-frame-font "Liberation Mono-14:antialias=1")
Run Code Online (Sandbox Code Playgroud)

将 14 更改为您想要的任何尺寸。该antialias选项应该是不言自明的;1为开,0为关。

您还可以使用诸如Liberation Mono-bold-14:antialias=1粗体文本(或Liberation Mono-14:weight=bold:antialias=1.

如果您的身高 120(在您的原始配置中)很重要,请添加:height=120.

官方手册中有更详细的信息,尽管它看起来没有列出所有选项。