# Text Sizing (OSC 66)

> Draw text larger than one cell, or in a width the program chooses: kitty's text sizing protocol.

- **Sequence:** `OSC 66 ; metadata ; text ST`
- **ECMA-48:** [§8.3.89 OSC – Operating System Command, p. 51](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n64/mode/1up)
- **Specification:** [The text sizing protocol, kitty documentation](https://sw.kovidgoyal.net/kitty/text-sizing-protocol/)

`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](https://sw.kovidgoyal.net/kitty/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](https://control-codes.page/csi/dsr/index.html.md), 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](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L3476-L3504)).
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

Input, one step per line:

```text
A
\e]66;s=2;big\a
B
```

Expected screen:

```text
|AB____|
cursor 1,3
```

### OSC66-2: Nor at a width it chooses

Input, one step per line:

```text
A
\e]66;w=2;x\a     # one character in two cells
\e]66;n=1:d=2;hi\a  # half sized
B
```

Expected screen:

```text
|AB____|
cursor 1,3
```

---

This is the Markdown version of <https://control-codes.page/osc/text-sizing/>. On that page every validation case runs live in libghostty-vt, the terminal emulation core of Ghostty, compiled to WebAssembly.

The validation cases are written in the notation described in <https://control-codes.page/notation/index.html.md>.
