Kitty Text Sizing (OSC 66)
Render a run of text at a programmatically specified size, weight, and alignment.
- 0x1B
- ESC
- 0x5D
- ]
- 0x36 0x36
- 66
- 0x3B
- ;
- ____
- a
- 0x3B
- ;
- ____
- t
- 0x1B
- ESC
- 0x5C
- \
OSC 66 is Kitty's text sizing protocol. It lets a program render a run of text at a chosen scale, fractional cell width, and alignment within the covered cells, without permanently changing the terminal's font metrics. The full specification is the Kitty text sizing protocol.
The first field a is a colon-separated list of key=value attributes.
The second field t is the payload text. Both fields are required, but
the attribute list may be empty (OSC 66;;text ST).
| Key | Range | Default | Meaning |
|---|---|---|---|
s | 1-7 | 1 | Integer scale factor applied to the cell metrics. |
w | 0-7 | 0 | Width override in cells. 0 means use the natural width. |
n | 0-15 | 0 | Numerator of the fractional vertical size. |
d | 0-15 | 0 | Denominator of the fractional vertical size. |
v | enum | top | Vertical alignment: 0 top, 1 bottom, 2 center. |
h | enum | left | Horizontal alignment: 0 left, 1 right, 2 center. |
Attributes are colon-separated (not semicolon-separated) so the payload can contain semicolons safely. Unknown attributes are ignored. An invalid attribute value invalidates only that attribute, not the whole sequence.
The payload t is a UTF-8 string of the text to render at the requested
size. Wintty enforces two constraints on the payload:
- It must be escape-code-safe UTF-8 (no embedded control sequences).
- It must be at most 4096 bytes in length.
If either check fails the entire OSC is discarded.
Render the word Hello at 2x scale with default alignment:
printf '\033]66;s=2;Hello\033\\'
Render the same word centered both vertically and horizontally within a 2x-scaled box:
printf '\033]66;s=2:v=2:h=2;Hello\033\\'
Note
Wintty parses OSC 66 against the published spec, including all six attributes, the colon-separated attribute syntax, and the UTF-8 safety check on the payload. Nothing consumes the parsed command yet: it is routed to a no-op arm in the terminal stream and there is no downstream handler, so the payload text is discarded and never rendered. A program that sends OSC 66 today will see its text vanish, not appear at the default size. Emit the sequence only behind a capability check. Parsing is stable, so the wire format will not change when rendering lands.
- The upstream Kitty text sizing protocol specification for the authoritative grammar and rendering rules.