Emacs: Set Line Spacing
How to set line spacing?
You can change line spacing by setting the variable line-spacing.
eval-expression then type
(setq line-spacing 0.5)
the value can be a integer or decimal number.
- if integer: it means pixels, added below each line.
- if float: a scaling factor relative to current window's default line height.
- if nil: add no extra spacing.
Toggle Line Spacing Command
Here's a command that lets you toggle line spacing between 2 values.
(defun xah-toggle-line-spacing () "Toggle line spacing between no extra space to extra half line height. URL `http://ergoemacs.org/emacs/emacs_toggle_line_spacing.html' Version 2017-06-02" (interactive) (if line-spacing (setq line-spacing nil) (setq line-spacing 0.5)) (redraw-frame (selected-frame)))
This is useful for switching between reading source code and reading novels. [see Emacs: Novel Reading Mode]
Note that the spacing height between lines also depends on font. See: Emacs: Font Setup.