The themes are designed to optionally cope well with mixed font
configurations. This mostly concerns org-mode
and markdown-mode
, though
expect to find it elsewhere like in Info-mode
.
In practice it means that the user can safely opt for a more
prose-friendly proportionately spaced typeface as their default, while
spacing-sensitive elements like tables and inline code always use a
monospaced font, by inheriting from the fixed-pitch
face.
Users can try the built-in M-x variable-pitch-mode to see the effect in action.
To make everything use your desired font families, you need to configure
the variable-pitch
(proportional spacing) and fixed-pitch
(monospaced)
faces respectively. It may also be convenient to set your main typeface
by configuring the default
face the same way.
[ The ‘fontaine’ package on GNU ELPA (by the author of the modus-themes) is designed to handle this case. ]
Put something like this in your initialization file (also consider
reading the doc string of set-face-attribute
):
;; Main typeface (set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 110) ;; Proportionately spaced typeface (set-face-attribute 'variable-pitch nil :family "DejaVu Serif" :height 1.0) ;; Monospaced typeface (set-face-attribute 'fixed-pitch nil :family "DejaVu Sans Mono" :height 1.5)
Or employ the face-attribute
function to read an existing value, such as
if you want to make fixed-pitch
use the font family of the default
face:
(set-face-attribute 'fixed-pitch nil :family (face-attribute 'default :family))
The next section shows how to make those work in a more elaborate setup that is robust to changes between the Modus themes.
Configure bold and italic faces.
Note the differences in the :height
property. The default
face must
specify an absolute value, which is the point size Ă— 10. So if you want
to use a font at point size ‘11’, you set the height to ‘110’.1 Whereas every other face must either not specify a
height or have a value that is relative to the default, represented as a
floating point. If you use an integer, then that means an absolute
height. This is of paramount importance: it ensures that all fonts can
scale gracefully when using something like the text-scale-adjust
command
which only operates on the base font size (i.e. the default
face’s
absolute height).
:height
values do not need to be rounded to multiples of ten: the likes of ‘115’
are perfectly valid—some typefaces will change to account for those
finer increments.