^[control-codes live in libghostty-vt

Operating system commands

OSC 50 Set Font

Change xterm's font, or ask which one it is using.

OSC 50 ; Pt ST
ECMA-48
§8.3.89 OSC – Operating System Command, p. 51
xterm
Operating System Commands

OSC 50 ; Pt ST changes xterm’s font to Pt, an X font name such as fixed or 9x15, and OSC 50 ; ? ST asks which font it is using. Pt can instead begin with # and an entry in xterm’s font menu: #3 for the third entry, #+1 for the next one, #-1 for the one before. A query is answered OSC 50 ; name ST, and a query for another menu entry, OSC 50 ; ?+1 ST, names the entry as well as its font (QueryFontRequest, ChangeFontRequest). When xterm is using a TrueType font, set with -fa or its menu, the same sequence sets and queries its face name instead.

A default xterm allows both: font operations are on unless the allowFontOps resource turns them off. Its font is fixed unless a resource says otherwise (DEFFONT), and that is what the case expects it to report. Changing the font changes the size of the window, not the number of rows and columns.

iTerm2 once used OSC 50 for its own commands and moved them to OSC 1337 because of this clash.

libghostty-vt has no OSC 50, and ignores it: fonts are its host’s business. The case that asks is a known difference.

Validation

OSC50-1: Which font

\e]50;?\a
|______|
reply \e]50;fixed\a

OSC50-2: Changing the font leaves the screen as it was

A
\e]50;9x15\a
\e]50;#+1\a
B
|AB____|
cursor 1,3
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.