Emacs Init: Change Default Face (Font)

By Xah Lee. Date: . Last updated: .

In Emacs 29 (date 2023) , 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:

;; 2023-08-05
;; set default monospace font.
;; Emacs Init: Change Default Face (Font)
;; http://xahlee.info/emacs/emacs/emacs_set_default_face.html

(when (eq system-type 'windows-nt)
  (face-spec-set
   'fixed-pitch
   '((t :family
        (cond
         ((member "Cascadia Mono" (font-family-list)) "Cascadia Mono")
         ((member "Consolas" (font-family-list)) "Consolas")
         (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, font setup

Elisp, font face