OSC 66 Text Sizing
Draw text larger than one cell, or in a width the program chooses: kitty's text sizing protocol.
OSC 66 ; metadata ; text ST
- ECMA-48
- §8.3.89 OSC – Operating System Command, p. 51
- Specification
- The text sizing protocol, kitty documentation
OSC 66 ; metadata ; text ST draws text at a size the program chooses, for headings, superscripts and the like, and lets a program say how many cells a piece of text takes rather than leaving the terminal to guess. Its definition is kitty’s text sizing protocol. The text is part of the sequence, at most 4096 bytes of it, and the metadata is key=value pairs separated by ::
| Key | Value | Means |
|---|---|---|
s | 1 to 7 | the scale: each cell of the text becomes an s by s block |
w | 0 to 7 | the width in scaled cells the whole text takes; 0 lets the terminal work it out as usual |
n, d | 0 to 15 | a fraction, n/d, for text smaller than a cell |
v, h | 0 to 2 | where fractionally scaled text sits in its cells: top or left, bottom or right, or centered |
So OSC 66 ; s=2 ; Title ST draws Title twice the usual height and width, taking two rows and ten columns. A program finds out whether a terminal has the protocol by drawing a space with w=2 and then s=2 between cursor position reports, and seeing how far the cursor moved each time.
A default xterm does not have it and ignores it, text and all (the OSC numbers it knows). The cases follow xterm. libghostty-vt parses the sequence and does nothing with it, so it ignores it the same way: the text is not shown at any size, and the cursor does not move. It passes.
Validation
OSC66-1: The text is not shown
A
\e]66;s=2;big\a
B
|AB____|
cursor 1,3
OSC66-2: Nor at a width it chooses
A
\e]66;w=2;x\a # one character in two cells
\e]66;n=1:d=2;hi\a # half sized
B
|AB____|
cursor 1,3