To increase the font size of the default
face in the current
buffer, type C-x C-+ or C-x C-=. To decrease it, type
C-x C--. To restore the default (global) font size, type
C-x C-0. These keys are all bound to the same command,
text-scale-adjust
, which looks at the last key typed to
determine which action to take and adjusts the font size accordingly
by changing the height of the default face.
Most faces don’t have an explicit setting of the :height
attribute, and thus inherit the height from the default
face.
Those faces are also scaled by the above commands.
Faces other than default
that have an explicit setting of the
:height
attribute are not affected by these font size changes.
The header-line
face is an exception: it will be scaled even if
it has an explicit setting of the :height
attribute.
Similarly, scrolling the mouse wheel with the Ctrl modifier pressed, when the mouse pointer is above buffer text, will increase or decrease the font size of the affected faces, depending on the direction of the scrolling.
The final key of these commands may be repeated without the leading
C-x and without the modifiers. For instance, C-x C-= C-= C-=
and C-x C-= = = increase the face height by three steps. Each
step scales the text height by a factor of 1.2; to change this factor,
customize the variable text-scale-mode-step
. A numeric
argument of 0 to the text-scale-adjust
command restores the
default height, the same as typing C-x C-0.
Similarly, to change the sizes of the fonts globally, type C-x
C-M-+, C-x C-M-=, C-x C-M-- or C-x C-M-0, or scroll
the mouse wheel with both the Ctrl and Meta modifiers
pressed. To enable frame resizing when the font size is changed
globally, customize the variable
global-text-scale-adjust-resizes-frames
(see Easy Customization Interface).
The commands text-scale-increase
and
text-scale-decrease
increase or decrease the size of the font
in the current buffer, just like C-x C-+ and C-x C--
respectively. You may find it convenient to bind to these commands,
rather than text-scale-adjust
.
The command text-scale-set
scales the size of the font in the
current buffer to an absolute level specified by its prefix argument.
The above commands automatically enable the minor mode
text-scale-mode
if the current font scaling is other than 1,
and disable it otherwise.
The command text-scale-pinch
increases or decreases the text
scale based on the distance between fingers on a touchpad when a pinch
gesture is performed by placing two fingers on a touchpad and moving
them towards or apart from each other. This is only available on some
systems with supported hardware.
The command mouse-wheel-text-scale
also changes the text
scale. Normally, it is run when you press Ctrl while moving the
mouse wheel. The text scale is increased when the wheel is moved
downwards, and it is decreased when the wheel is moved upwards.