3

It's possible to change the xterm font size by holding ctrl and right-clicking the window. Is it possible to do it without a mouse?

Toothrot
  • 3,435

2 Answers2

8

The default keybindings include what's needed:

           Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \n\
           Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \n\
           Shift <KeyPress> KP_Subtract:smaller-vt-font() \n\

That is (without any customization needed):

  • shiftkeypad + switches to the next-larger font.
  • shiftkeypad - switches to the next-smaller font.

There are two bindings for KP_Add to make it workable by default on some unusual keyboards.

This was originally just for bitmap-fonts (in 1999); TrueType fonts were accommodated in 2008.

It is also possible to do this with an escape-sequence, e.g.,

printf '\033]50;#+1\007'

to switch to the next-larger font, and

printf '\033]50;#-1\007'

to switch to the next-smaller font. The fonts.sh script in the sources makes xterm repeatedly shrink/grow, and when interrupted, restores the original font. (The \007 in the printf is a nonprinting control/G in the script to accommodate very old shells).

Thomas Dickey
  • 76,765
  • Thank you. Would you explain how to do it with an escape sequence as well? I couldn't tell from the linked page. – Toothrot Mar 21 '20 at 18:39
3

try

xterm -fa 'Monospace' -fs 14