Glint frame streams
- Status
- NORMATIVE for format version 8
- Draft
- Draft 00, 2026-11-26
- Markdown
- /drafts/00/streams.md
- Record tables
- /drafts/00/records.json, 35 tables
Contents
Status: NORMATIVE for format version 8. This document is part of the Glint stream format specification. It defines the bytes of the six streams of a frame, and the rules that make a frame valid.
A Keyframe carries the six streams. A Delta writes them from the streams of a base frame (see “Delta operations” in the specification). The streams are the inputs of the client’s raster plan:
| Index | Stream | Content |
|---|---|---|
| 0 | Commands | Paint commands in paint order |
| 1 | Glyphs | Glyph entries that the text commands address |
| 2 | Scroll table | Scroll offsets that the commands and clip entries select |
| 3 | Gradient stops | Stop entries that the gradient extensions address |
| 4 | Scrollbar rows | Scrollbar parts that the scrollbar markers paint |
| 5 | Resource requests | The glyphs and paths that the frame draws |
Conventions
- All integers are little-endian. An f32 is an IEEE 754 binary32 value and an f64 is an IEEE 754 binary64 value, little-endian.
- An offset is a decimal byte offset from the start of the record. A record has no padding that a table does not show. The format requires no alignment of a record or of a field.
- A byte that no table defines is reserved. A producer writes 0 there. A client ignores it.
- A flag bit that no table defines is reserved. A producer writes 0. A client ignores it.
- “Must” is a rule for the producer. A client rejects a frame that breaks a rule of this document: it reports the error and closes the connection. “Validation” gives the checks of a client and the rules that a client need not check.
sis the device scale of the Configuration message.(vx, vy)is the origin of the visible rectangle of the Configuration message, in CSS px.- “The raster plan” is the work of the client that turns the streams of a frame and its resources into draws, in the order of the commands.
Machine-read tables
Each table that follows a marker <!-- record: NAME SIZE --> gives the fields of record NAME, which is SIZE bytes. The columns are Offset, Size, Type, Field and Meaning. A type is u8, u16, u32, f32 or f64, or an array such as f32[4]. The field name is an identifier in code style. The site publishes them as JSON at /spec/records.json.
Coordinates and colors
Spaces
| Space | Definition |
|---|---|
| Local space | The space of the geometry of a command. Unit: CSS px. The y axis points down. Without a transform extension, local space is layer space. |
| Layer space | The canvas of the document in CSS px, origin at the canvas origin, y down, without the scroll offsets of the current scroll scope (“unshifted”). |
| Device space | The pixels of the frame raster. Origin: the top-left pixel of the visible rectangle. The y axis points down. |
A layer-space point P of a command under scroll reference r maps to device space as:
device = s × (P + T[r]) − s × (vx, vy)
T[r] is scroll entry r of stream 2. For r = 0, T[r] = (0, 0).
Transform extension
A command whose transform flag is set carries this 24-byte block after its base record. A later extension of the command follows the block.
transform24 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 24 | f32[6] | matrix | The affine matrix(a, b, c, d, e, f) of CSS: x' = a·x + c·y + e, y' = b·x + d·y + f. It maps local space to layer space. a to d have no unit; e and f are CSS px in layer space. |
The client draws a command with a transform at device = s × (M · local + (e, f) + T[r]) − s × (vx, vy), where M is the linear part. Without a transform, M is the identity and (e, f) is 0. The raster plan does not check that the matrix is invertible or finite. A transform also turns off the pixel snapping of a rect and of a box shadow; an image snaps also with a transform.
Color encoding
A color is four f32 values: red, green, blue, alpha.
- Red, green and blue are encoded sRGB (the sRGB transfer function is applied). The range is extended: a value can be less than 0 or more than 1.
- Alpha is straight (not premultiplied), 0 to 1.
- In render mode 0 the client uses the values as they are. In render mode 1 (high dynamic range) the client decodes the three components with the extended sRGB transfer function and converts them from linear sRGB to linear Rec. 2020; alpha stays.
Pixel snapping
A rect, a box shadow, an image and a clip entry snap their box when the rules of the record say so. The client then snaps the box to whole CSS px before it scales: x' = round(x), w' = round(x + w) − round(x), and the same for y and h, with round(v) = floor(v + 0.5). Border widths and radii do not snap.
Stream 0: commands
Stream 0 is a sequence of commands without separators. A command starts at the byte after the end of the previous command. The commands must end exactly at the end of the stream. Every command size is a multiple of 4.
Command header
Every command starts with a 4-byte header.
| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | The command kind (see “Command opcodes”). |
| 1 | 1 | u8 | flags | Flags that each command defines. The flags that select extensions also select the size. 0 when the command defines no flags. |
| 2 | 2 | u16 | word | A value that each command defines. 0 when the command defines none. |
Command opcodes
| Opcode | Record | Size in bytes | Meaning |
|---|---|---|---|
| 1 | rect | 148, + 24 with a transform, + 40 with a gradient | A rectangle with a fill, a border and radii |
| 2 | text | 56, + 24 with a transform, + 24 with a shadow | A run of glyphs |
| 3 | image | 40, + 24 with a transform | An image or a color glyph bitmap |
| 4 | box-shadow | 120, + 24 with a transform | A box shadow |
| 5 | push-clip | 4 + 80 × entry count | Replace the clip state |
| 6 | pop-clip | 4 | Restore the clip state |
| 7 | push-group | 24 + 84 × segment count | Start a compositing group |
| 8 | pop-group | 4 | Composite the group |
| 9 | svg-path | 40, + 24 with a transform, + 40 with a gradient | A path from the path atlas |
| 10 | push-backdrop-filter | 88 + 84 × segment count | Filter the backdrop |
| 11 | pop-backdrop-filter | 4 | End of a backdrop filter |
| 12 | push-mask | 4 | Start a mask accumulator |
| 13 | push-mask-layer | 4 | Start a mask layer |
| 14 | pop-mask-layer | 4 | Add the layer to the accumulator |
| 15 | push-background | 4 | Start a background accumulator |
| 16 | push-blend-layer | 4 | Start a background layer with a blend mode |
| 17 | pop-blend-layer | 4 | Blend the layer into the accumulator |
| 18 | pop-background | 4 | Composite the accumulator |
| 20 | set-scroll | 8 | Select the scroll entry of the next draws |
| 22 | scrollbar | 8 | Paint the scrollbar rows of one scroller |
| 23 | color-glyph | 12 | Draw a color glyph cache slot |
Opcode 0, opcode 19, opcode 21 and opcodes 24 to 255 are not commands. A frame that holds one is invalid: the client reports error 18.
Rect (1)
A filled and bordered rectangle with elliptical corner radii.
rect148 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 1. |
| 1 | 1 | u8 | flags | See the flags below. |
| 2 | 2 | u16 | borderStyles | Four 4-bit border styles: bits 0–3 top, 4–7 right, 8–11 bottom, 12–15 left. 0 is solid on all sides. |
| 4 | 4 | f32 | x | Left edge of the border box. CSS px, local space. |
| 8 | 4 | f32 | y | Top edge of the border box. CSS px, local space. |
| 12 | 4 | f32 | width | Width of the border box. CSS px. |
| 16 | 4 | f32 | height | Height of the border box. CSS px. |
| 20 | 16 | f32[4] | fill | Fill color. With a gradient, the gradient replaces it; the producer still writes a solid color here. |
| 36 | 16 | f32[4] | borderTopColor | Color of the top border. |
| 52 | 16 | f32[4] | borderRightColor | Color of the right border. |
| 68 | 16 | f32[4] | borderBottomColor | Color of the bottom border. |
| 84 | 16 | f32[4] | borderLeftColor | Color of the left border. |
| 100 | 4 | f32 | borderTop | Width of the top border. CSS px. |
| 104 | 4 | f32 | borderRight | Width of the right border. CSS px. |
| 108 | 4 | f32 | borderBottom | Width of the bottom border. CSS px. |
| 112 | 4 | f32 | borderLeft | Width of the left border. CSS px. |
| 116 | 32 | f32[8] | radii | Corner radii, CSS px, as (x, y) pairs: top-left, top-right, bottom-right, bottom-left. A circular corner has x = y; a square corner has 0, 0. |
Extensions, in this order: the transform extension (flag 0x08), then the gradient extension (flag 0x04). The size is 148, 172, 188 or 212 bytes.
| Bit | Value | Name | Meaning |
|---|---|---|---|
| 0 | 0x01 | FILL | Paint the fill. |
| 1 | 0x02 | BORDER | Paint the border ring. |
| 2 | 0x04 | GRADIENT | A gradient extension follows. |
| 3 | 0x08 | TRANSFORM | A transform extension follows. |
| 4 | 0x10 | NO_PIXEL_SNAP | Do not snap the box (SVG shape geometry). |
| 5 | 0x20 | AREA_COVERAGE | Antialias the edges by exact pixel area, not by the CSS ramp (SVG shape geometry). |
| 6 | 0x40 | SVG_STROKE | The border ring is an SVG stroke: its contours are the offsets of the midline (the box inset by half the border width) by half the border width. |
flags & 3 selects the paint: 3 fill and border in one draw, 1 the fill only (over the full outer shape; the producer writes border widths 0), 2 the border only. 0 is invalid: the client reports error 18. The box snaps (see “Pixel snapping”) unless TRANSFORM or NO_PIXEL_SNAP is set.
Border styles: 0 solid, 1 double, 2 dashed, 3 dotted, 4 inset, 5 outset, 6 groove, 7 ridge, 8 none, 9 hidden. A side with style 8 or 9 must have width 0. Values 10 to 15 are not defined; a client paints them solid.
Gradient extension
Rect (1) and SVG path (9) share this 40-byte block.
gradient40 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | kind | Bits 0–5: the kind, 1 to 7. Bits 6–7: the extend mode: 0 pad, 1 repeat, 2 reflect. 3 is invalid. |
| 1 | 1 | u8 | stopCount | The number of stop entries in stream 3, 1 to 255. |
| 2 | 1 | u8 | flags | Bit 0: TILED. The client wraps the position modulo the origin box (floor division). The producer sets it only when the origin box differs from the painted box. Bits 1–7 are 0. |
| 3 | 1 | u8 | interpolation | Bits 0–3: the color space, 0 to 14. Bits 4–5: the hue method. See the tables below. |
| 4 | 4 | u32 | stopIndex | The index of the first stop entry in stream 3. The stops are the entries stopIndex to stopIndex + stopCount − 1. |
| 8 | 16 | f32[4] | geometry | Four values for each kind (see below). |
| 24 | 16 | f32[4] | origin | CSS kinds: the origin box (dx, dy, width, height) in CSS px; dx and dy are from the top-left of the painted box. COLR kinds: e, f, parameter 0, parameter 1. |
| Kind | Name | geometry | Client rule for the position t |
|---|---|---|---|
| 1 | linear | dx, dy (the unit direction, y down), length (CSS px), 0 | t = 0.5 + dot(p − S/2, (dx, dy)) / max(length, 1e−6), where p is the position in the origin box and S its size |
| 2 | radial | cx, cy, rx, ry (CSS px, origin-box space) | t = √(((px − cx)/rx)² + ((py − cy)/ry)²) |
| 3 | conic | cx, cy (CSS px), the start angle (radians, 0 up, clockwise), 0 | t = fract((atan2(py − cy, px − cx) + π/2 − start) / 2π) |
| 4 | COLR linear | a, b, c, d | t = u.x |
| 5 | COLR radial | a, b, c, d | circles with centers (0, 0) and (1, 0) and radii p0 + t·(p1 − p0); the larger root t with a radius of 0 or more; no root paints nothing |
| 6 | COLR concentric radial | a, b, c, d | as kind 5 with both centers at (0, 0) |
| 7 | COLR sweep | a, b, c, d | t = (atan2(u.y, u.x) − p0)/(p1 − p0), the angle in [0, 2π), y up; t = 0 when |p1 − p0| < 1e−9 |
For the COLR kinds, u = (a·x + c·y + e, b·x + d·y + f) maps the position in the painted box (local units, origin at the top-left of the box) to the canonical space of the gradient. Kinds 1, 2 and 3 are for Rect; kinds 4 to 7 are for SVG path; kinds 1 and 2 are also for SVG path. The client reports error 18 for a kind that the opcode does not have and for a flag other than TILED.
An OKLCH colour plane of a colour picker is not a gradient kind: the producer sends the plane as an image (see “Color picker planes”).
The extend mode gives the color of a position t outside the span from the first to the last stop position:
| Mode | Name | Kinds | Client rule |
|---|---|---|---|
| 0 | pad | 1 to 7 | Before the first stop, the first stop color. After the last stop, the last stop color. |
| 1 | repeat | 1 to 7 | t wraps into the span. For the CSS kinds 1 to 3, this is a repeating gradient. |
| 2 | reflect | 4 to 7 | t reflects into the span: every second repeat of the span runs from the last stop to the first stop. |
Extend mode 3 is invalid. Reflect is for the COLR kinds 4 to 7 only. The client decoder reports error 18 for extend mode 3 and for reflect on a CSS kind.
| Space | CSS name | Space | CSS name |
|---|---|---|---|
| 0 | srgb | 8 | oklch |
| 1 | srgb-linear | 9 | display-p3 |
| 2 | lab | 10 | display-p3-linear |
| 3 | oklab | 11 | a98-rgb |
| 4 | xyz-d65 | 12 | prophoto-rgb |
| 5 | hsl | 13 | rec2020 |
| 6 | hwb | 14 | xyz-d50 |
| 7 | lch | 15 | not defined: the raster plan rejects the frame |
Hue methods (spaces 5 to 8 only): 0 shorter, 1 longer, 2 increasing, 3 decreasing, as CSS Color 4 §12.4 defines them. The client interpolates in the space with premultiplied alpha and does not premultiply the hue. The producer writes interpolation 0 for a gradient without an in clause and for the COLR kinds.
Stops: stop i of the gradient is entry stopIndex + i of stream 3, at byte 28 × (stopIndex + i). The entries of each gradient must lie in stream 3. The client prepares the stops as “Stream 3: gradient stops” states.
Color picker planes
A producer that paints the OKLCH colour plane of a colour picker sends each plane as two commands in its place:
- An Image command (opcode 3) of the plane image, at the rect’s box, with the rect’s transform. Its NO_PIXEL_SNAP flag is set when the rect has a transform or NO_PIXEL_SNAP. Plane
nof a frame (in the order of stream 0, from 0) is decoded image0x7F00 + n; a frame has at most 256 planes. - When the rect paints a border wider than 0, a Rect command of the border only, with a transparent fill. A rect that paints only its border paints no plane.
The producer sends the plane image as an Image message before the frame. It is 8-bit RGBA, straight alpha, encoded sRGB, at the rect’s size in device pixels (at most 1024 on a side). The producer sends it again only when the plane’s size, radii, device scale or parameters change, and releases it when no frame paints it. A client draws it as any decoded image.
Text (2)
One run of glyphs of one font at one size.
text56 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 2. |
| 1 | 1 | u8 | flags | See the flags below. |
| 2 | 2 | u16 | glyphCount | The number of glyph entries, 0 to 65535. |
| 4 | 4 | u32 | glyphOffset | The byte offset of the first glyph entry in stream 1, a multiple of 14. The entries follow one another, 14 bytes each. |
| 8 | 4 | f32 | x | The origin of the run. CSS px, local space. The pen of each glyph is from this origin. |
| 12 | 4 | f32 | y | The top of the line box. CSS px, local space. |
| 16 | 4 | f32 | fontSize | The font size. CSS px. The client draws at floor(fontSize × 100) / 100. |
| 20 | 4 | f32 | baseline | The distance from y down to the baseline. CSS px. |
| 24 | 16 | f32[4] | color | The fill color. A command with SHADOW uses the color of the shadow. |
| 40 | 4 | f32 | opticalSize | The size for the opsz axis of the outlines. CSS px at scale 1. It differs from fontSize for synthesized small capitals. |
| 44 | 2 | u16 | unitsPerEm | The units per em of the font (head.unitsPerEm). Must not be 0. |
| 46 | 2 | u16 | font | The font number of the connection (see “Font numbers” in the resources). |
| 48 | 2 | u16 | weight | The font weight in CSS units, 1 to 1000. The outlines use it for the wght axis. |
| 50 | 2 | u16 | variationKey | 0, or a variation key of the connection, 1 to 255 (see “Variation key” in the resources). |
| 52 | 1 | u8 | style | 0 normal, 1 italic. Another value is 0. |
Bytes 53 to 55 are reserved.
| Bit | Value | Name | Meaning |
|---|---|---|---|
| 0 | 0x01 | TRANSFORM | A transform extension follows. |
| 1 | 0x02 | SHADOW | A text-shadow extension follows. |
| 2 | 0x04 | SYNTHETIC_OBLIQUE | The client shears the run (see “Synthetic oblique” below). |
Extensions, in this order: the transform extension (flag 0x01), then the text-shadow extension (flag 0x02). The size is 56, 80 or 104 bytes.
text-shadow24 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 16 | f32[4] | color | The shadow color. It replaces color. |
| 16 | 4 | f32 | offsetX | Added to x, before the transform. CSS px. |
| 20 | 4 | f32 | offsetY | Added to y, before the transform. CSS px. |
Glyph placement. With (dx, dy) the shadow offset (or 0), F = floor(fontSize × 100) / 100 × s and k = F / unitsPerEm:
- The origin of the run is
ox = grid(x × s + dx × s); the baseline isby = grid(y × s + dy × s) + grid(baseline × s), wheregrid(v)roundsvto the nearest 1/256, ties to even. - The origin of glyph entry
i(font units (0, 0)) is at(ox + (penX + inkX) × k, by − inkY × k)device px of the local space; font units have y up. - The transform and the scroll entry apply (see “Coordinates and colors”).
Synthetic oblique: with SYNTHETIC_OBLIQUE, the client shears the run by 0.25 about the baseline: a local point (x, y) draws at x − 0.25 × (y − by). The producer sets SYNTHETIC_OBLIQUE when style is 1 and the font is not italic: head.macStyle bit 1 and OS/2.fsSelection bit 0 of the font are both 0.
glyphOffsetmust be a multiple of 14. The glyph span (glyphOffset,glyphCount × 14bytes) must lie in stream 1.weightmust be 1 to 1000.variationKeymust be less than 256.fontmust be less than the number of Font messages of the connection before the frame (error 8).- Stream 5 must hold a glyph row for each glyph of the span whose ID is not 65535 (see “Stream 5: resource requests”).
- A run of more than 65535 glyphs takes several commands with the same
x. A text shadow is a copy of the command with SHADOW, before the command, on the same glyph span; a blurred shadow is in a push group with one blur segment.
The weight is the CSS weight of the text, such as 450, unchanged in the command and in the glyph rows. The optical size is in CSS px at every device scale: the raster plan applies the device scale.
Image (3)
A textured quad.
image40 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 3. |
| 1 | 1 | u8 | flags | See the flags below. |
| 2 | 2 | u16 | image | The image index in the space of kind (see “Identities” in the resources). |
| 4 | 4 | f32 | x | Left of the destination. CSS px, local space. |
| 8 | 4 | f32 | y | Top of the destination. CSS px, local space. |
| 12 | 4 | f32 | width | Width of the destination. CSS px. |
| 16 | 4 | f32 | height | Height of the destination. CSS px. |
| 20 | 16 | f32[4] | source | The source rectangle (x, y, width, height) as fractions 0 to 1 of the image, origin at the top-left. |
| 36 | 1 | u8 | kind | The image kind: 0 a decoded image, 1 a color glyph bitmap. Another value is error 18. |
| 37 | 3 | u8[3] | reserved | 0. |
Extension: the transform extension (flag 0x01). The size is 40 or 64 bytes.
| Bit | Value | Name | Meaning |
|---|---|---|---|
| 0 | 0x01 | TRANSFORM | A transform extension follows. |
| 1 | 0x02 | PIXELATED | Sample with the nearest texel at mip level 0. |
| 2 | 0x04 | NO_PIXEL_SNAP | Do not snap the destination. |
| 3 | 0x08 | ABUT_LEFT | The left edge touches another draw: no antialiasing on it. |
| 4 | 0x10 | ABUT_TOP | The same for the top edge. |
| 5 | 0x20 | ABUT_RIGHT | The same for the right edge. |
| 6 | 0x40 | ABUT_BOTTOM | The same for the bottom edge. |
| 7 | 0x80 | — | Reserved: 0. A client reports error 18 for bit 7. |
- An index outside the space of its kind is error 18 (the value is the index). The index of kind 0 is less than 32768; the index of kind 1 is less than 16384.
- Kind 0, a decoded image: when
flags & 0x04is 0 the destination snaps (see “Pixel snapping”), also with a transform. The client samples the source rectangle into the destination. - Kind 1, a color glyph bitmap:
x,y,width,heightare the em square above the glyph origin: the origin is(x, y + height)and the font size isheight. The glyph box of the Image message places the bitmap: leftx + left × height, topy + height + top × height, sizewidth × heightbyheight × heightin ems of the box. Without a transform the client snaps the origin: y to a whole device pixel, x to a whole device pixel when the box has whole pixel 1, else to a quarter device pixel. The destination does not snap by “Pixel snapping”.
Color glyph (23)
One color glyph cache slot, drawn from its cache page.
color-glyph12 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 23. |
| 1 | 1 | u8 | flags | 0. |
| 2 | 2 | u16 | slot | A color glyph cache slot of the connection (see “Color glyph” in the resources). A slot that no Color glyph message installed is error 18. |
| 4 | 4 | f32 | x | The x of the glyph origin. CSS px, local space. |
| 8 | 4 | f32 | y | The y of the glyph origin. CSS px, local space. |
The command has no extension. The client draws the slot from its cache page at the snapped origin (floor(sx + 1/8), floor(sy + 1/2)), where (sx, sy) is the device position of the origin: the device scale and the scroll entry apply. The draw covers the box of the slot from the origin. The producer writes this command only for axis-aligned text without a scale.
SVG path (9)
A path of the client’s path atlas, with one color or a gradient.
svg-path40 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 9. |
| 1 | 1 | u8 | flags | See the flags below. |
| 2 | 2 | u16 | path | The path index in the space of kind (see “Identities” in the resources). |
| 4 | 4 | f32 | x | Left of the rectangle that the bounds of the path map to. CSS px, local space. |
| 8 | 4 | f32 | y | Top of that rectangle. |
| 12 | 4 | f32 | width | Width of that rectangle. |
| 16 | 4 | f32 | height | Height of that rectangle. |
| 20 | 16 | f32[4] | color | The fill color, with fill-opacity in its alpha. |
| 36 | 1 | u8 | kind | The path kind: 0 an SVG path, 1 a color glyph layer, 2 a text stroke. 3 and above are error 18. |
| 37 | 3 | u8[3] | reserved | 0. |
The 40 bytes of fields are followed by the transform extension (flag 0x01), then the gradient extension (flag 0x02): the transform extension starts at byte 40, the gradient extension at byte 40 or 64. The size is 40, 64, 80 or 104 bytes. An index outside the space of its kind is error 18 (the value is the index).
| Bit | Value | Name | Meaning |
|---|---|---|---|
| 0 | 0x01 | TRANSFORM | A transform extension follows. |
| 1 | 0x02 | GRADIENT | A gradient extension follows. The gradient replaces the color. |
| 2 | 0x04 | GLYPH_ORIGIN | A color glyph layer. With TRANSFORM, the client snaps the translation to (floor(E + 1/8), floor(F + 1/2)) device px. |
| 3 | 0x08 | ENTRY_BOUNDS | A path in local CSS px: a stroked glyph outline, or a stroke that does not scale, mapped into the host space. The client ignores x, y, width and height and draws the path at its own bounds; path units are CSS px. x, y, width and height bound the path. |
The client maps a path point p with the bounds (bx0, by0, bx1, by1) of the path (in path units) to local space: (x + (p.x − bx0) × width / (bx1 − bx0), y + (p.y − by0) × height / (by1 − by0)). Then the transform and the scroll entry apply. The producer writes the bounds of the path after the SVG viewport mapping, so the map is the viewport map. Stream 5 must hold a path row for the path kind and the path index.
Box shadow (4)
One CSS box shadow. The producer resolves its offset, spread and radii.
box-shadow72 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 4. |
| 1 | 1 | u8 | flags | Bit 0 (0x01) INSET. Bit 1 (0x02) TRANSFORM: a transform extension follows. The other bits are reserved. |
| 4 | 4 | f32 | x | Left of the shadow rectangle. CSS px, local space. Outset: the border box moved by the offset and grown by the spread. Inset: the hole, the border box moved by the offset and shrunk by the spread. |
| 8 | 4 | f32 | y | Top of the shadow rectangle. CSS px. |
| 12 | 4 | f32 | width | Width of the shadow rectangle. CSS px. |
| 16 | 4 | f32 | height | Height of the shadow rectangle. CSS px. |
| 20 | 32 | f32[8] | radii | The radii after the spread (CSS Backgrounds 3 §7.1), as Rect radii. |
| 52 | 16 | f32[4] | color | Shadow color. |
| 68 | 4 | f32 | blurSigma | The standard deviation of the blur: the CSS blur radius / 2. CSS px. 0 is no blur. |
Extensions, in this order: the transform extension (flag 0x02), then the border-box extension. Every box shadow has the border-box extension. The size is 120 or 144 bytes.
box-shadow-border-box48 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 16 | f32[4] | box | The border box of the element (x, y, width, height) without the offset and the spread. CSS px, local space. |
| 16 | 32 | f32[8] | radii | The border radii of the element without the spread, as Rect radii. |
- INSET: the shadow paints inside the border box and outside the hole.
- Outset: the client clips the shadow out of the border box when the box has a width and a height above 0. The client does not clip an outset shadow whose box has a width or a height of 0.
- The box snaps (see “Pixel snapping”) when TRANSFORM is clear.
- The producer emits the shadows of one element in reverse list order, so that the first shadow paints on top.
Clip entry
Push clip (5) carries clip entries. Push backdrop filter (10) carries one.
clip-entry80 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | flags | Bit 0 (0x01) ENABLED_X: clip on x. Bit 1 (0x02) ENABLED_Y: clip on y. Bit 2 (0x04) AFFINE. Bit 3 (0x08) PATH_MASK: the path-mask fields replace the radii. Bit 4 (0x10) AREA. Bit 5 (0x20) GLYPH_ORIGIN. |
| 4 | 4 | f32 | x | Left of the clip rectangle. CSS px; layer space without AFFINE, local space with it. |
| 8 | 4 | f32 | y | Top of the clip rectangle. |
| 12 | 4 | f32 | width | Width of the clip rectangle. |
| 16 | 4 | f32 | height | Height of the clip rectangle. |
| 20 | 32 | f32[8] | radii | Corner radii, as Rect radii. |
| 52 | 24 | f32[6] | affine | With AFFINE: a, b, c, d, e, f from local space to layer space, as the transform extension. Without AFFINE: 0. |
| 76 | 2 | u16 | scrollReference | The scroll entry of this clip entry: an entry of stream 2. 0: no scroll offset. |
clip-path-mask80 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 20 | 4 | u32 | path | The path index of the mask, in the space of pathKind (see “Identities” in the resources). |
| 24 | 4 | f32 | pathScale | Local units for each path unit. |
| 28 | 16 | f32[4] | pathBox | The box of the path (x min, y min, x max, y max) in path units. |
| 44 | 1 | u8 | pathKind | The path kind: 0 an SVG path, 1 a color glyph layer, 2 a text stroke. Another value is error 18. |
| 45 | 7 | u8[7] | reserved | 0. |
The second table gives the fields of an entry with PATH_MASK at bytes 20 to 51. An index outside the space of pathKind is error 18. An entry without PATH_MASK keeps bytes 44 to 51 as radii.
- A pixel is in the clip state when it is in every entry. The client tests each entry in its own space.
- ENABLED_X clips to
x .. x + width; ENABLED_Y clips toy .. y + height. An entry with neither bit clips nothing. The producer sets both bits on a rectangle entry and neither bit on a path-mask entry. - AREA (an SVG viewport): an axis-aligned entry clips each pixel by the area that it covers, not by the pixel center.
- An entry without AFFINE, PATH_MASK and AREA snaps to whole CSS px (see “Pixel snapping”).
- AFFINE: when
b = c = 0,a > 0andd > 0, the client folds the affine into an axis-aligned rectangle. Otherwise it tests the pixel in local space through the inverse affine. The affine must be invertible. - GLYPH_ORIGIN (with AFFINE only): the translation is a color glyph origin. The client snaps it in device px:
E = floor(E + 1/8),F = floor(F + 1/2). - PATH_MASK: the path outline masks the content. Only the first push clip inside a push group gives the group its path mask; the group composites through it.
Push clip (5) and pop clip (6)
push-clip4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 5. |
| 2 | 2 | u16 | entryCount | The number of clip entries that follow, 0 to 8. 0 is no clip. |
pop-clip4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 6. |
A push replaces the clip state with its entries; it does not intersect them with the earlier state. A pop restores the state before the matching push. More than 8 entries make the frame invalid; the raster plan rejects it.
Filter segment
Push group (7) and push backdrop filter (10) carry a list of filter segments. The client applies them in order.
filter-segment84 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | kind | 1 matrix, 2 blur, 3 drop shadow. |
| 4 | 80 | f32[20] | values | The values of the kind (below). |
| Kind | values |
|---|---|
| 1 matrix | A 4 × 5 color matrix, row major: rows R, G, B, A; columns R, G, B, A and a constant. out[r] = Σ m[r][c] × in[c] + m[r][4]. |
| 2 blur | 0: sigma x, 1: sigma y. CSS px, through the element transform. Values 2 to 19 are 0. |
| 3 drop shadow | 0: dx, 1: dy (CSS px, through the linear part of the element transform), 2: sigma x, 3 to 6: color, 7: sigma y. Values 8 to 19 are 0. |
The values that a kind does not use must be 0. The client draws a blur as three box blurs on each axis with the box width floor(σ × s × 1.8799712 + 0.5).
Push group (7) and pop group (8)
push-group24 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 7. |
| 1 | 1 | u8 | flags | Bits 1–4: the blend mode, 0 to 15. Bit 5 (0x20): MASK. |
| 2 | 2 | u16 | segmentCount | The number of filter segments that follow. 0 is no filter. |
| 4 | 1 | u8 | composite | The composite operator, 0 to 13. |
| 20 | 4 | f32 | alpha | The opacity of the group, 0 to 1. |
pop-group4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 8. |
The content until the matching pop draws into an offscreen target. The pop applies the filter segments, multiplies by the opacity and composites the target through the clip state of the push.
- Composite 0 composites source-over with the blend mode. Another composite operator reads the target pixels and replaces them with the Porter-Duff result on premultiplied color; the clip coverage mixes the result with the target.
- The blend modes plus-lighter and plus-darker do not fit in 4 bits. The producer writes blend mode 0 with composite 12 or 13 for them.
- MASK: the pop multiplies the alpha of the group by the top mask accumulator and removes the accumulator.
Blend modes: 0 normal, 1 multiply, 2 screen, 3 overlay, 4 darken, 5 lighten, 6 color-dodge, 7 color-burn, 8 hard-light, 9 soft-light, 10 difference, 11 exclusion, 12 hue, 13 saturation, 14 color, 15 luminosity.
Composite operators: 0 source-over, 1 clear, 2 source, 3 destination, 4 destination-over, 5 source-in, 6 destination-in, 7 source-out, 8 destination-out, 9 source-atop, 10 destination-atop, 11 xor, 12 plus, 13 plus-darker.
Push backdrop filter (10) and pop backdrop filter (11)
push-backdrop-filter8 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 10. |
| 2 | 2 | u16 | segmentCount | The number of filter segments that follow. |
pop-backdrop-filter4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 11. |
The segments follow the 8-byte record. One clip entry follows the segments: the border box of the element with its radii. The client filters what is painted behind the element and composites the result back through that entry. The entry does not clip the content and is not part of the clip state. The pop does no work.
Mask commands (12, 13, 14)
push-mask4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 12. |
push-mask-layer4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 13. |
| 1 | 1 | u8 | mode | 0 match-source, 1 alpha, 2 luminance. |
| 2 | 1 | u8 | composite | 0 add, 1 subtract, 2 intersect, 3 exclude. |
pop-mask-layer4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 14. |
Push mask starts a mask accumulator with coverage 0. The content of a mask layer draws into a scratch target. The pop converts the scratch to coverage by the mode (match-source is alpha) and composites it into the accumulator by the composite operator (CSS Masking 1 §5.7). A masked push group (MASK flag) uses and removes the accumulator.
Background commands (15, 16, 17, 18)
push-background4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 15. |
push-blend-layer4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 16. |
| 1 | 1 | u8 | mode | The blend mode of the layer, 0 to 15 (see “Push group”). |
pop-blend-layer4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 17. |
pop-background4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 18. |
The background layers of one element draw into an accumulator from push background to pop background. A layer between push blend layer and pop blend layer draws into a scratch target; the pop blends it over the accumulator with the mode. Pop background composites the accumulator over the target with blend mode normal (CSS Compositing 1 §5.2). The producer emits these commands only when a background layer has a blend mode other than normal.
Set scroll (20)
set-scroll8 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 20. |
| 2 | 2 | u16 | scrollReference | The scroll entry of the draws that follow. |
The current scroll reference is 0 at the start of the stream. Set scroll changes it; push and pop commands do not save or restore it. It applies to Rect, Text, Image, Color glyph, Box shadow and SVG path. A clip entry has its own reference. Scrollbar rows and filter values take no scroll offset.
Scrollbar (22)
scrollbar8 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 1 | u8 | opcode | 22. |
| 4 | 4 | u32 | group | The scrollbar group of the scroller whose scrollbar rows paint here, or 0xFFFFFFFF for the viewport. |
The producer numbers the scrollbar groups of a frame from 0, in the order of the scrollbar commands of stream 0. The marker paints the scrollbar rows of stream 4 whose group is equal to this group, in row order, under the current clip state. A marker without rows paints nothing. The producer wraps each marker in the clips of its scroller; the viewport marker comes after all other paint, without a clip.
Order of the commands
The opening and closing commands nest on two stacks. The clips nest on the clip stack:
| Opening | Closing |
|---|---|
| Push clip (5) | Pop clip (6) |
The other opening and closing commands nest on the group stack:
| Opening | Closing |
|---|---|
| Push group (7) | Pop group (8) |
| Push backdrop filter (10) | Pop backdrop filter (11) |
| Push mask layer (13) | Pop mask layer (14) |
| Push background (15) | Pop background (18) |
| Push blend layer (16) | Pop blend layer (17) |
- A pop clip closes the innermost open push clip. A closing command of the group stack must close the innermost open command of the group stack. A command of one stack does not close or check a command of the other stack: push group, push clip, pop group, pop clip is a valid sequence.
- No command of either stack stays open at the end of the stream.
- The clip state of a command is the clip state of the innermost open push clip (no clip when no push clip is open). A pop group composites through the clip state of its push group.
- Push mask (12) has no closing command. The command after it must be push mask layer (13). A push mask layer must follow push mask or pop mask layer. A push group with MASK must follow pop mask layer, and the command after a pop mask layer must be push mask layer or a push group with MASK. Set scroll (20) between them does not count: the rule applies to the commands without it.
- The producer orders the commands of one element as: push backdrop filter, the mask sequence, push group, push clip, the content, pop clip, pop group, pop backdrop filter.
The raster plan checks every rule of this section (failure 3, see “Validation”). A frame that breaks a rule of this section is invalid for every client.
Stream 1: glyphs
Stream 1 is an array of 14-byte glyph entries. The length must be a multiple of 14. The client limits the number of entries (see “Limits” in the specification).
glyph14 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 2 | u16 | glyph | The glyph ID in the font. 65535: no glyph; the client draws nothing for it. |
| 2 | 4 | f32 | penX | The pen position from the x of the text command. Font units. |
| 6 | 4 | f32 | inkX | The x offset of the glyph from its pen. Font units. |
| 10 | 4 | f32 | inkY | The y offset of the glyph from its pen. Font units, y up. |
Several text commands can address one span: a text shadow and its text, or the parts of a selected run.
Stream 2: scroll table
Stream 2 is an array of 8-byte entries. Entry k is at byte 8 × k. The length must be a multiple of 8 and at least 8.
scroll-entry8 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 4 | f32 | x | The shift that the client adds to an unshifted x. CSS px. |
| 4 | 4 | f32 | y | The shift that the client adds to an unshifted y. CSS px. |
- An entry is the negative of the cumulative scroll offset of its scope: a scope scrolled down by 100 px has
y = −100. - Entry 0 must be zero. Reference 0 gives no shift.
- The producer numbers the scroll entries that stream 0 references (the set scroll commands and the clip entries) from 1, in the order of their first reference in stream 0. Stream 2 holds entry 0 and these entries: its length is
8 × (1 + n)fornreferenced entries. A frame without references has a stream 2 of 8 bytes. - Every scroll reference of stream 0 must be less than the number of entries.
- A frame that only scrolls changes only this stream.
Stream 3: gradient stops
Stream 3 is an array of 28-byte stop entries. Entry k is at byte 28 × k. The length must be a multiple of 28. A gradient extension addresses stopCount consecutive entries from entry stopIndex.
The producer writes the stops that the gradients of stream 0 use, in the order of their first use in stream 0. It writes each set of equal stops once: two gradients with equal stops address the same entries. Stream 3 holds no other entries.
gradient-stop28 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 4 | f32 | position | The position on the gradient line, a fraction (CSS kinds), or the color line offset (COLR kinds). NaN: no position. |
| 4 | 16 | f32[4] | color | Components 0, 1 and 2 of the stop color in the interpolation space of the gradient that addresses the entry (see the table below), then the straight alpha. |
| 20 | 4 | u32 | missing | Bits 0–2: component 0, 1 or 2 of the interpolation space is missing (CSS none, or a powerless hue). Bit 3: alpha is missing. Bit 4: the entry is a color hint. |
| 24 | 4 | f32 | length | CSS px along the gradient line, added to the position. Kinds 1 and 2 only; 0 for the other kinds. |
| Space | Components 0, 1, 2 |
|---|---|
| 0 srgb | r, g, b, encoded |
| 1 srgb-linear | r, g, b |
| 2 lab | L (0 to 100), a, b; D50 |
| 3 oklab | L (0 to 1), a, b |
| 4 xyz-d65 | X, Y, Z |
| 5 hsl | h (degrees, 0 to 360), s, l (fractions) |
| 6 hwb | h (degrees), w, b (fractions) |
| 7 lch | L, C, h (degrees); D50 |
| 8 oklch | L, C, h (degrees) |
| 9 display-p3 | r, g, b, sRGB transfer |
| 10 display-p3-linear | r, g, b |
| 11 a98-rgb | r, g, b, transfer 563/256 |
| 12 prophoto-rgb | r, g, b |
| 13 rec2020 | r, g, b, transfer 2.4 |
| 14 xyz-d50 | X, Y, Z |
Two gradients in different spaces with equal colors address different entries, because their components differ.
The client prepares the stops of a gradient in this order:
- Position:
position + length / L, whereLisgeometry[2]for kinds 1 and 2 (the length orrx, CSS px) when it is more than 0. - Fix-up (CSS Images 3 §3.5.3): a first NaN position becomes 0, a last NaN position becomes 1, each position becomes the maximum of itself and the positions before it, and each run of NaN positions spreads evenly between its neighbors.
- Hints: the client replaces each hint with 9 stops between the entry before it (L) and the entry after it (R), with the colors
((x − L)/(R − L))^(log 0.5 / log((H − L)/(R − L)))of the mix of L and R, where H is the hint position. A hint must not be the first or the last entry, and two hints must not be neighbors. - Missing components: in each pair of neighboring stops, a missing component takes the value of the other stop; a component that both stops miss is 0 (CSS Color 4 §12.2). The bits are authoritative: the producer sets the hue bit of a stop whose hue is powerless (CSS Color 4 §4.4.1). Bit 3 applies in every space.
- A repeating CSS gradient whose last position is not more than its first position paints the color of the last stop.
A client reads at most 64 prepared stops: n + 8 × hints stops, twice that minus 2 when a stop has a missing component. A producer keeps the prepared count at 64 or less.
Stream 4: scrollbar rows
Stream 4 is an array of 40-byte rows. The length must be a multiple of 40.
scrollbar-row40 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 4 | u32 | group | The group of the scrollbar marker that paints the row; 0xFFFFFFFF for the viewport. |
| 4 | 4 | f32 | x | Left. CSS px in the viewport; the scroll offset is already applied. |
| 8 | 4 | f32 | y | Top. CSS px in the viewport. |
| 12 | 4 | f32 | width | CSS px. |
| 16 | 4 | f32 | height | CSS px. |
| 20 | 16 | f32[4] | color | The color of the part, see “Color encoding”. |
| 36 | 4 | f32 | radius | The corner radius of all four corners. CSS px. |
The client rounds the edges to device pixels: left floor(x × s + 0.5) − s × vx, right floor((x + width) × s + 0.5) − s × vx, and the same for y. A row with a width or a height of 0 or less after the rounding paints nothing. The radius is clamp(radius × s, 0, min(width, height) / 2). The rows of one marker paint in row order: the producer writes the track, the edge, the thumb and the corner, back to front.
Stream 5: resource requests
Stream 5 names the glyphs and the paths that the frame draws. The client prepares its glyph atlas and its path atlas from it. An empty stream has no rows. Otherwise it is a 4-byte header and count rows of 20 bytes; the length must be 4 + 20 × count.
request-header4 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 4 | u32 | count | The number of rows. |
A row is a glyph row (kind 0) or a path row (kind 1). The u16 at row offset 14 is the kind.
glyph-request20 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 2 | u16 | font | The font number of the text command. |
| 2 | 2 | u16 | weight | weight of the text command. |
| 4 | 4 | f32 | opticalSize | opticalSize of the text command, 0 or more, +0 for zero. |
| 8 | 4 | f32 | fontSize | fontSize of the text command as written, 0 or more, +0 for zero. |
| 12 | 2 | u16 | glyph | The glyph ID, not 65535. |
| 14 | 2 | u16 | kind | 0. |
| 16 | 2 | u16 | variationKey | variationKey of the text command. |
| 18 | 2 | u16 | reserved | 0. |
path-request20 bytes| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 4 | u32 | path | The path index in the space of pathKind (see “Identities” in the resources). |
| 4 | 8 | f64 | screenSize | The longest side of the drawn path on the target, device px at the device scale of the producer. 0 or more and finite, +0 for zero. |
| 12 | 2 | u16 | coverage | 0: a distance-field entry. 1: a coverage entry. |
| 14 | 2 | u16 | kind | 1. |
| 16 | 1 | u8 | pathKind | The path kind: 0 an SVG path, 1 a color glyph layer, 2 a text stroke. |
| 17 | 3 | u8[3] | reserved | 0. |
A path row whose pathKind is above 2, or whose path is outside the space of its kind, is error 21 (the offset is the byte offset of the field, the value is the field).
Order: the glyph rows come first, in strictly increasing order of (font, variation key, weight, optical size, font size, glyph). The path rows follow, in strictly increasing order of (path kind, path, coverage). The optical size and the font size compare as numbers. Every producer writes this order. So each glyph row is unique, each path row is unique by path kind, path index and coverage, and one set of rows has one stream 5.
The rows of a frame:
- one glyph row for each distinct (font, variation key, weight, optical size, font size, glyph ID) of the glyph entries of the text commands, without glyph ID 65535;
- one path row with coverage 0 for each path kind and path index of an SVG path command or a path-mask clip entry, with the screen size of its last draw:
max(width × s × √(a² + b²), height × s × √(c² + d²))for a command, and the same with the path box, its scale and its affine for a clip entry.
The client makes one atlas for each (font, variation key) and one glyph for each glyph row, at the instance of the font with wght = weight and opsz = opticalSize (see “Font” in the resources). It makes one path atlas entry for each path row from the definition of its Path message, at a resolution for screenSize. A text command whose glyph has no row, or an SVG path or a path mask whose path has no row, makes the frame invalid; the raster plan rejects it (failures 11 and 12).
Validation
A client checks a frame in three steps. A frame that fails a check is not drawn: the client reports the error and closes the connection.
- Before it reads the glyphs, the client checks the lengths of the streams and the rows of stream 5 (error 21 in the specification, “Errors”): a stream 1 of whole 14-byte entries; a stream 2 of whole 8-byte entries and at least 8 bytes; a stream 3 of whole 28-byte entries; a stream 4 of whole rows; a stream 5 that is empty or
4 + 20 × countbytes; a row kind of 0 or 1; a glyph row with the font number of a Font message of the connection, a variation key less than 256 and a font size and optical size that are 0 or more and finite; a path row with a path kind of 0 to 2, a path index in the space of its kind and a screen size that is 0 or more and finite. A stream 1 of more than 161,319 entries gives error 14. - The client checks each command of stream 0. Error 18: an opcode that is not a command, a command that the end of the stream cuts, a rect with
flags & 3= 0, a text glyph span outside stream 1, aglyphOffsetthat is not a multiple of 14, a textweightof 0 or above 1000, a variation key of 256 or more, a gradient stop span outside stream 3, an extend mode of 3 or reflect on a CSS kind, an image kind above 1, an image command with flag bit 7, a path kind above 2 in an SVG path command or a path-mask clip entry, an image index or a path index outside the space of its kind, and a Color glyph command whose slot no Color glyph message installed. Error 8: a font number without a Font message. - The client plans the frame. A command that breaks a rule gives a raster plan failure: a code, the byte offset of the command in stream 0 (the length of the stream for a rule of the whole stream), the value that broke the rule and the limit of the rule. The client reports the failure with the rule and the remedy.
Raster plan failures
| Code | Name | Rule that the frame breaks | Value | Limit |
|---|---|---|---|---|
| 1 | COMMAND | An opcode that is not a command, or a command that the end of stream 0 cuts. | The opcode | The bytes that remain |
| 2 | CLIP_ENTRIES | A push clip with more than 8 entries. | The entry count | 8 |
| 3 | ORDER | A command that breaks “Order of the commands”. | The opcode | The opening opcode that the command needs, or the command before it in a mask sequence; at the end of the stream, the innermost open opcode or 0 |
| 4 | GLYPH_SPAN | A text glyph span outside stream 1. | The glyph offset | The length of stream 1 |
| 5 | SCROLL_REFERENCE | A scroll reference (set scroll or clip entry) not less than the number of scroll entries. | The reference | The number of entries |
| 6 | STOP_SPAN | A gradient stop span outside stream 3. | The stop offset | The length of stream 3 |
| 7 | STOP_HINT | A hint at the first or the last stop, or after another hint. | The stop index | The stop count |
| 8 | FONT | A text font number of 512 or more. | The font number | 512 |
| 9 | VARIATION_KEY | A text variation key of 256 or more. | The key | 256 |
| 10 | UNITS_PER_EM | A text command with unitsPerEm 0. | 0 | 1 |
| 11 | GLYPH_ROW | A glyph of a text command without a glyph row in stream 5. | The glyph ID | The weight |
| 12 | PATH_ROW | An SVG path or a path-mask entry without a path row in stream 5. | The path index | 0 |
| 13 | CLIP_AFFINE | A clip entry with AFFINE whose affine has no inverse. | The entry index | 0 |
| 14 | IMAGE_INDEX | An Image command whose image index is outside the space of its image kind. | The image index | The size of the space |
| 15 | FILTER_KIND | A filter segment kind outside 1 to 3. | The kind | 3 |
| 16 | MASK_LAYER | A mask layer mode above 2 or a composite above 3. | The mode or the composite | 2 or 3 |
| 17 | INTERPOLATION | A gradient interpolation space above 14. | The space | 14 |
| 18 | PAYLOAD | A frame whose plan needs more bytes than a plan holds (2 GiB). | The KiB that the frame needs | The KiB that a plan holds |
| 19 | ALLOCATION | The client could not allocate the plan. | The byte count | 0 |
| 20 | COMPOSITE | A push group composite operator above 13. | The operator | 13 |
| 21 | SCROLLBAR_ROWS | Scrollbar rows that the client cannot address. | The row count | 0 |
Failures 18, 19 and 21 come from the limits of the client, not from a rule of this document. Step 2 finds a break of the rules of failures 1, 4, 6, 8, 9 and 14 first, as error 18 or error 8.
Rules that a client need not check
These rules bind the producer. A client need not check them; a frame that breaks one can draw wrong pixels.
| Rule | A frame that breaks it |
|---|---|
| The values are finite; a transform is invertible | Draws NaN or infinite geometry. |
| The rows of stream 5 are unique and in the order of “Stream 5: resource requests” | Can make the client prepare a glyph or a path twice. |
A text command has SYNTHETIC_OBLIQUE exactly when its style is 1 and its font is not italic | Draws the run upright, or slanted twice. |
A text command’s unitsPerEm is head.unitsPerEm of its font | Places the glyphs at a wrong scale. |
| The client holds the file bytes of each glyph that a frame draws (“Glyphs (13)” in the resources) | Draws nothing or a wrong outline for the glyph. |