VTX 1 · core · beta draft d03
VTX 1 Wire Specification: core
§10Resources: glyphs and fonts
A resource is an immutable byte string named by its SHA-256 hash. Because the name is the content, a client fetches each glyph or font once and reuses it from cache in every later session with that server.
Resource frames (channel 3)
| Type | Name | Direction | Payload |
|---|---|---|---|
| 0x10 | OFFER | S→C | { res, kind, size, ? meta } |
| 0x11 | WANT | C→S | { res, ? offset }; offset resumes a partial transfer |
| 0x12 | HAVE | C→S | { res } |
| 0x13 | DATA | S→C | { res, offset, bytes } |
| 0x14 | DROP | Both | { res }: cancels a transfer, or the client refuses it |
Transfer
- The server sends OFFER for each resource the scene will use.
- The client answers HAVE if the resource is cached, or WANT if not.
- The server sends DATA chunks, each within
max_frame. - The client checks the hash once all
sizebytes have arrived. On a mismatch it discards the bytes and sends WANT once more; after a second mismatch it treats the resource as unavailable.
Ops may refer to a resource before it arrives; the client renders the fallback until it does. A client over its cache_bytes budget answers DROP.
After READY. After every READY, new session or resumed, the server offers again each resource the scene refers to, since the client's cache may have dropped it. A client may send WANT for any hash the server has offered in this session.
Kinds
| Kind | Content | Drawing |
|---|---|---|
glyph/bitmap1 |
CBOR { w, h, bits }, w and h 1–256: h × ceil(w/8) bytes, rows top-down, most significant bit first |
Set bits in the run's foreground colour |
glyph/bitmap8 |
CBOR { w, h, alpha }, w and h 1–256: w × h coverage bytes |
Foreground blended by coverage |
glyph/path |
CBOR { cmds }: ["M",x,y], ["L",x,y], ["Q",x1,y1,x,y], ["C",x1,y1,x2,y2,x,y], ["Z"] |
Coordinates 0–4096 across the glyph's cell box, origin top-left, non-zero fill |
font/woff2, font/otf, font/ttf |
The font file | Used by font props |
Bitmap glyphs are scaled to the cell box; clients SHOULD use whole-number scaling where they can. A glyph whose data length does not match w and h is unavailable. The hash of a glyph resource covers its CBOR bytes exactly as sent.
Caching and privacy. Clients SHOULD keep the cache across sessions. They MUST partition it by server identity, as browsers do, so that one server cannot probe for resources another server sent and use that to track the user.
Fonts. The application developer is responsible for the right to distribute the fonts it sends, exactly as with web fonts. Clients cache font resources the way browsers cache web fonts. Font parsers are a common attack surface, so clients MUST sanitise font files before use, as browsers do with OpenType Sanitizer, and MAY ignore TrueType hinting instructions.