Emacs uses/defines/handles fonts in ways that you might not be used to. Fonts are treated as attributes of Faces (Emacs Manual: Faces). A Face has several attributes (Emacs Manual: Face Attributes), colors, over/under line, strike-through, size, generic font specification, specific font specification, etc. For your purposes I think you want the :font attribute. In fact, this is what you're doing (under the hood) when you specify a font in default-frame-alist; you're setting the :font attribute of the default face, default-face.
To see a list of all (currently defined) faces do: Meta-x list-faces-display RET. You'll get a list of face names on the left, and abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ styled according to the face on the right. Clicking on the face name will bring you to the customize facility where you can view or edit the face to your whims.
I recommend against doing that for every. Single. Face. You'll go mad. Instead, if you find a stray face that you don't like, use the key-chord that @Drew recommended (C-u C-x =) to find the face name and its current font. You can then use M-x customize-face RET "face name" to customize that face.
If I was in your current situation though I'd do the following.
- Make sure the generic fonts ("serif" "sans" (or "sans serif") and "monospace") for your OS/desktop are set to fonts you like. Emacs will uses these if other more specific fonts aren't defined.
- Using X11? Make sure there's nothing screwy in your user and system
Xdefaults or Xresources - Make sure you're getting your font everywhere.
In macOS I use Aquamacs. Boiling down the font stuff in my init file I have:
(set-frame-font "Menlo:size=12") (setq default-frame-alist nil) (load-theme 'sanityinc-tomorrow-bright t)
This will:
- set the default font
- clear the
default-frame-alist (Aquamacs does (did?) some stuff there that I don't like) - load my chosen theme, which then sets faces as it needs
Of the 350 or so faces defined in my current session, almost all are Menlo derived.
Your specific example
Note, I worked through the following with emacs 26.1 built from source with GTK3 and fontconfig support on Ubuntu 18.04
You list two specific points in your example. The first, the pink-highlighted-quoted text. If you C-u C-x =, you'll see this text is in the Info-quoted face. Drilling into the Info-quoted face, you'll see it inherits from fixed-pitch-serif. In turn, you'll find that fixed-pitch-serif is defined as using the Monospace Serif family. This generic font family (a la "monospace", "sans serif" and "serif") is an Emacs-ism. This is defined in a customizable variable face-font-family-alternatives in faces.el. Manipulating this variable to redefine Monospace Serif to include your choice of Monaco gave me no results. Setting fixed-pitch-serif to use the :family of Monaco worked perfectly fine.
The second example (from your comment) was the header. Doing C-u C-x = again we get info-title-1. From here we get info-title-2 -> info-title-3 -> info-title-4 -> variable-pitch. The face variable-pitch is defined as the font family "Sans Serif". This is a fontconfig generic font family that your system should set. (Locally, I have "Sans Serif" set to "DejaVu Sans".) This should be set to your liking in your DE so that you have a consistent look across your DE. If you want to change it in Emacs, set the face variable-pitch. (I don't recommend setting it to a monospace font, like Monaco, but it's your Emacs.)
These faces, fixed-pitch-serif and variable-pitch are not defined in terms of the default face, but can be set like any other face, via the customize facility (M-x customize-face RET <facename>) or directly. There are two functions you can use to set faces directly. The first is set-face-attribute. You could put the following in your init file.
(set-face-attribute 'fixed-pitch-serif nil :family "Monaco") (set-face-attribute 'variable-pitch :family "Liberation Sans")
Note that the documentation of set-face-attribute states that it is intended for internal use.
The second, set-face-font is a specialization of set-face-attribute. It uses the attributes of the given font to define the given face. The more specific the font, the more specific the attributes of the face.
(set-face-font 'fixed-pitch-serif "Monaco") (set-face-font 'variable-pitch "Liberation Sans")
Additionally, I still recommend using set-frame-font to set your default font. Setting its third argument to t will set the font for all subsequent frames, in addition to the initial frame.
(set-frame-font "Monaco-10" nil t)
See it's documentation via C-h f set-frame-font RET for more details. Putting it all together you could do the followng:
(set-frame-font "Monaco-10" nil t) (set-face-font 'fixed-pitch-serif "Monaco") (set-face-font 'variable-pitch "Liberation Sans")
To get something more to your liking. In fact I have that in a trial ~/.emacs and it's working fine, even with emacsclient -c.
tl;dr
No. There is no magic command, or setting, that will allow you to change all of the fonts in Emacs at once. As pointed out by @drew and @amitp in their comments, you'll need to set faces that don't derive from the default face yourself. In order to set as many as possible, you need to do the following:
- Make sure your system generic fonts ("monospace", "sans serif", "serif") are set to your liking
- Use
set-frame-font or default-frame-alist to set the default font (or more specifically the font of the default face) - Figure out the "root" face that non-conforming faces inherit from, and set that to your liking (a la the
fixed-pitch-serif and variable-pitch examples above)
C-u C-x =to see just what font is used there.DejaVu Sansand text inside quotes isbitstream-CourierC-u C-x =you can see the name of the face and also the name of the font family. To change which font family is used for a face,(set-face-attribute 'facename nil :family "fontname"). For example, the headline can be set with(set-face-attribute 'info-title-2 nil :family "Comic Sans MS")You can also use:heightto set the font height.info-title-3etc. separately. How do I do that?