Emacs Init: Modify Default Face (Font)

By Xah Lee. Date: . Last updated: .

In Emacs 29 (Released 2023-07) , keybinding in help output are shown with monospaced font. But it's bitmapped and ugly. You can change it.

put this in your Emacs Init File:

;; set default monospace font
(face-spec-set
 'fixed-pitch
 '((t :family
      (cond
       ((eq system-type 'windows-nt)
        (if (member "Consolas" (font-family-list))
            "Consolas-14"
          "Courier New"))
       ((eq system-type 'darwin)
        (if (member "Menlo" (font-family-list))
            "Menlo-16"
          "Courier New"))
       ((eq system-type 'gnu/linux)
        (if (member "DejaVu Sans Mono" (font-family-list))
            "DejaVu Sans Mono"
          "Monospace"))
       (t "Monospace"))))
 'face-defface-spec
 )

the face fixed-pitch is defined in faces.el like this

(defface fixed-pitch
  '((t :family "Monospace"))
  "The basic fixed-pitch face."
  :group 'basic-faces)

(defface help-key-binding
  '((((class color) (min-colors 88) (background light))
     :background "grey96" :foreground "DarkBlue"
     ;; We use negative thickness of the horizontal box border line to
     ;; avoid enlarging the height of the echo-area display, which
     ;; would then move the mode line a few pixels up.  We use
     ;; negative thickness for the vertical border line to avoid
     ;; making the characters wider, which then would cause unpleasant
     ;; horizontal shifts of the cursor during C-n/C-p movement
     ;; through a line with this face.
     :box (:line-width (-1 . -1) :color "grey80")
     :inherit fixed-pitch)
    (((class color) (min-colors 88) (background dark))
     :background "grey19" :foreground "LightBlue"
     :box (:line-width (-1 . -1) :color "grey35")
     :inherit fixed-pitch)
    (((class color grayscale) (background light)) :background "grey90"
     :inherit fixed-pitch)
    (((class color grayscale) (background dark)) :background "grey25"
     :inherit fixed-pitch)
    (t :background "grey90" :inherit fixed-pitch))
  "Face for keybindings in *Help* buffers.

This face is added by `substitute-command-keys', which see.

Note that this face will also be used for key bindings in
tooltips.  This means that, for example, changing the :height of
this face will increase the height of any tooltip containing key
bindings.  See also the face `tooltip'."
  :version "28.1"
  :group 'help)

Emacs Face

Emacs and Unicode

File Encoding

Unicode Font Setup

Emacs Font Setup