Kitty Text Sizing (OSC 66)

Render a run of text at a programmatically specified size, weight, and alignment.

  1. 0x1B
    ESC
  2. 0x5D
    ]
  3. 0x36 0x36
    66
  4. 0x3B
    ;
  5. ____
    a
  6. 0x3B
    ;
  7. ____
    t
  8. 0x1B
    ESC
  9. 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).

Attributes

KeyRangeDefaultMeaning
s1-71Integer scale factor applied to the cell metrics.
w0-70Width override in cells. 0 means use the natural width.
n0-150Numerator of the fractional vertical size.
d0-150Denominator of the fractional vertical size.
venumtopVertical alignment: 0 top, 1 bottom, 2 center.
henumleftHorizontal 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.

Payload

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.

Example

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\\'

Behavior in Wintty

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.

See also