As text-scale-mode
docstring says
...
The amount of scaling is determined by the variable
text-scale-mode-amount
: one step scales the global default
face size by the value of the variable text-scale-mode-step
(a negative amount shrinks the text).
The text-scale-increase
, text-scale-decrease
, and
text-scale-set
functions may be used to interactively modify
the variable text-scale-mode-amount
(they also enable or
disable `text-scale-mode' as necessary)."
So only the default face is affected. Looking at face-remap.el
, we
see this works by setting the variable face-remapping-alist
, whose
docstring includes:
Alist of face remappings.
Each element is of the form:
(FACE . REPLACEMENT),
which causes display of the face FACE to use REPLACEMENT instead.
REPLACEMENT is a face specification, i.e. one of the following:
(1) a face name
(2) a property list of attribute/value pairs, or
(3) a list in which each element has the form of (1) or (2).
Indeed if we display this variable value w/o text-scale-mode we see:
face-remapping-alist is a variable defined in ‘C source code’.
Its value is nil
And after having typed C-x C-+
:
Its value is ((default (:height 1.2) default))
Directly setting face-remapping-alist
seems to work, ie try:
(setq face-remapping-alist '((default (:height 2.4) default)
(italic (:height 2.4) italic)))
The functions used by text-scale-mode
to change
face-remapping-alist
are face-remap-add-relative
and
face-remap-remove-relative
. We could modify text-scale-mode
to
call them for both 'default
and 'italic
fonts. Alternatively, we
can advise both functions so that a remapping for the 'italic
font is added/removed as well. Here's the code to do that:
(defun my/face-remap-add-relative-advice (face &rest specs)
"advice to add remap for italic font"
(if (eq face 'default)
(setq my/italic-cookie (apply #'face-remap-add-relative 'italic specs))))
(defun my/face-remap-remove-relative-advice (cookie)
"advice to remove remap for italic font"
(if (eq (car cookie) 'default)
(face-remap-remove-relative my/italic-cookie)))
(advice-add #'face-remap-add-relative :after #'my/face-remap-add-relative-advice)
(advice-add #'face-remap-remove-relative :after #'my/face-remap-remove-relative-advice)
That's a quick hack, it would need more work to handle more fonts, the clean solution may be to change text-scale-mode
so that it can handle any font, but it seems to do what you need.