Font operations
5 operations named font.*. Every one runs in a batch through apply_ops, dry_run_ops, the CLI or the admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| font.list | font.list with verified bytes and retained undo assets. | site.read | none |
| font.recordUpload | font.recordUpload with verified bytes and retained undo assets. | site.edit | none |
| font.upload | Upload a font face from its base64 bytes: a WOFF2 file (the bytes decide, by their signature), checked like the admin upload (file size, the site's font quota, the family name) and stored with its family name, weight, style, display, fallback stack and licence note. | site.edit | none |
| font.delete | font.delete with verified bytes and retained undo assets. | site.edit | destructive |
| font.importGoogle | Self-host a Google Fonts family: fetch its latin and latin-ext woff2 faces for the weights and styles asked, check the answers, and store one face per weight, style and subset with its unicode-range and the family's Google Fonts licence page as the licence note. | site.edit | none |
font.list
font.list with verified bytes and retained undo assets.
Example input
{}Input
The input is a record; see the schema below.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| fonts | array of object | yes | |
| fonts[].id | string (uuid) | yes | |
| fonts[].fileName | string | yes | At least 1 character. At most 255 characters. |
| fonts[].mimeType | "font/woff2" | yes | |
| fonts[].name | string | yes | At least 1 character. At most 100 characters. |
| fonts[].weight | integer | yes | At least 1. At most 1000. |
| fonts[].style | string | yes | One of "normal", "italic". |
| fonts[].display | string | yes | One of "swap", "block", "fallback", "optional". |
| fonts[].fallbackStack | string | null | yes | |
| fonts[].siteId | string | yes | |
| fonts[].familyKey | string | yes | |
| fonts[].fileSize | integer | yes | At least 0. |
| fonts[].url | string | yes | |
| fonts[].source | string | yes | One of "upload", "google", "blueprint". |
| fonts[].licence | string | null | yes | |
| fonts[].unicodeRange | string | null | yes | |
| fonts[].isVariableFont | boolean | yes | |
| fonts[].axesJson | record of array of value | null | no | |
| fonts[].refCount | integer | yes | At least 0. |
| fonts[].createdAt | string | yes | |
| fonts[].updatedAt | string | yes | |
| fonts[].createdBy | string | null | no |
Try it
yarn splash font.list '{}' --dry-runfont.recordUpload
font.recordUpload with verified bytes and retained undo assets.
Example input
{
"id": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
"storageKey": "fonts/dm-sans-400.woff2",
"fileName": "dm-sans-400.woff2",
"mimeType": "font/woff2",
"name": "DM Sans",
"weight": 400,
"style": "normal",
"display": "swap",
"fallbackStack": "system-ui, sans-serif"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string (uuid) | yes | |
| storageKey | string | yes | At least 1 character. At most 500 characters. |
| fileName | string | yes | At least 1 character. At most 255 characters. |
| mimeType | "font/woff2" | yes | |
| name | string | yes | At least 1 character. At most 100 characters. |
| weight | integer | yes | At least 1. At most 1000. |
| style | string | yes | One of "normal", "italic". |
| display | string | yes | One of "swap", "block", "fallback", "optional". |
| fallbackStack | string | null | yes | |
| replace | boolean | no |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string (uuid) | yes | |
| fileName | string | yes | At least 1 character. At most 255 characters. |
| mimeType | "font/woff2" | yes | |
| name | string | yes | At least 1 character. At most 100 characters. |
| weight | integer | yes | At least 1. At most 1000. |
| style | string | yes | One of "normal", "italic". |
| display | string | yes | One of "swap", "block", "fallback", "optional". |
| fallbackStack | string | null | yes | |
| siteId | string | yes | |
| familyKey | string | yes | |
| fileSize | integer | yes | At least 0. |
| url | string | yes | |
| source | string | yes | One of "upload", "google", "blueprint". |
| licence | string | null | yes | |
| unicodeRange | string | null | yes | |
| isVariableFont | boolean | yes | |
| axesJson | record of array of value | null | no | |
| refCount | integer | yes | At least 0. |
| createdAt | string | yes | |
| updatedAt | string | yes | |
| createdBy | string | null | no |
Try it
yarn splash font.recordUpload '{"id":"7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d","storageKey":"fonts/dm-sans-400.woff2","fileName":"dm-sans-400.woff2","mimeType":"font/woff2","name":"DM Sans","weight":400,"style":"normal","display":"swap","fallbackStack":"system-ui, sans-serif"}' --dry-runfont.upload
Upload a font face from its base64 bytes: a WOFF2 file (the bytes decide, by their signature), checked like the admin upload (file size, the site's font quota, the family name) and stored with its family name, weight, style, display, fallback stack and licence note. Record the licence the face is used under in licence (for example the foundry's terms or the licence file's name); the library shows it with the face. A face the library already holds is refused (409 font_face_exists) unless replace is set. The face is in the draft at once; the public site draws it after the next publish.
Example input
{
"fileName": "inter-400.woff2",
"name": "Inter",
"weight": 400,
"style": "normal",
"display": "swap",
"fallbackStack": "system-ui, sans-serif",
"licence": "SIL Open Font License 1.1",
"data": "d09GMgABAAAAAAQ4AA0AAAAACKgAAAPhAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| fileName | string | yes | At least 1 character. At most 255 characters. |
| name | string | yes | At least 1 character. At most 100 characters. |
| weight | integer | yes | At least 1. At most 1000. |
| style | string | yes | One of "normal", "italic". |
| display | string | no | One of "swap", "block", "fallback", "optional". Default "swap". |
| fallbackStack | string | null | no | |
| licence | string | null | no | |
| replace | boolean | no | |
| data | string | yes | At least 1 character. At most 16777216 characters. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string (uuid) | yes | |
| fileName | string | yes | At least 1 character. At most 255 characters. |
| mimeType | "font/woff2" | yes | |
| name | string | yes | At least 1 character. At most 100 characters. |
| weight | integer | yes | At least 1. At most 1000. |
| style | string | yes | One of "normal", "italic". |
| display | string | yes | One of "swap", "block", "fallback", "optional". |
| fallbackStack | string | null | yes | |
| siteId | string | yes | |
| familyKey | string | yes | |
| fileSize | integer | yes | At least 0. |
| url | string | yes | |
| source | string | yes | One of "upload", "google", "blueprint". |
| licence | string | null | yes | |
| unicodeRange | string | null | yes | |
| isVariableFont | boolean | yes | |
| axesJson | record of array of value | null | no | |
| refCount | integer | yes | At least 0. |
| createdAt | string | yes | |
| updatedAt | string | yes | |
| createdBy | string | null | no |
Try it
yarn splash font.upload '{"fileName":"inter-400.woff2","name":"Inter","weight":400,"style":"normal","display":"swap","fallbackStack":"system-ui, sans-serif","licence":"SIL Open Font License 1.1","data":"d09GMgABAAAAAAQ4AA0AAAAACKgAAAPhAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}' --dry-runfont.delete
font.delete with verified bytes and retained undo assets.
Example input
{
"fontId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| fontId | string (uuid) | yes |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| success | true | yes |
Needs confirmed: ["destructive"] on the batch, which the single-operation CLI form does not set: put it in a batch file and run yarn splash apply <file> --dry-run.
font.importGoogle
Self-host a Google Fonts family: fetch its latin and latin-ext woff2 faces for the weights and styles asked, check the answers, and store one face per weight, style and subset with its unicode-range and the family's Google Fonts licence page as the licence note. A face the library already holds is refused (409 font_face_exists) unless replace is set: that face then leaves the library, the live site keeping it until the next publish, and the new one takes its place. A failure stores nothing.
Example input
{
"family": "DM Sans",
"weights": [
400,
700
],
"styles": [
"normal"
],
"display": "swap"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| family | string | yes | At least 1 character. At most 100 characters. |
| weights | array of integer | yes | At least 1 item. At most 9 items. |
| styles | array of string | yes | At least 1 item. At most 2 items. |
| display | string | yes | One of "swap", "block", "fallback", "optional". |
| replace | boolean | no |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| fonts | array of object | yes | |
| fonts[].id | string (uuid) | yes | |
| fonts[].fileName | string | yes | At least 1 character. At most 255 characters. |
| fonts[].mimeType | "font/woff2" | yes | |
| fonts[].name | string | yes | At least 1 character. At most 100 characters. |
| fonts[].weight | integer | yes | At least 1. At most 1000. |
| fonts[].style | string | yes | One of "normal", "italic". |
| fonts[].display | string | yes | One of "swap", "block", "fallback", "optional". |
| fonts[].fallbackStack | string | null | yes | |
| fonts[].siteId | string | yes | |
| fonts[].familyKey | string | yes | |
| fonts[].fileSize | integer | yes | At least 0. |
| fonts[].url | string | yes | |
| fonts[].source | string | yes | One of "upload", "google", "blueprint". |
| fonts[].licence | string | null | yes | |
| fonts[].unicodeRange | string | null | yes | |
| fonts[].isVariableFont | boolean | yes | |
| fonts[].axesJson | record of array of value | null | no | |
| fonts[].refCount | integer | yes | At least 0. |
| fonts[].createdAt | string | yes | |
| fonts[].updatedAt | string | yes | |
| fonts[].createdBy | string | null | no |
Try it
yarn splash font.importGoogle '{"family":"DM Sans","weights":[400,700],"styles":["normal"],"display":"swap"}' --dry-runGenerated from the operation registry and the MCP tool catalogue (source 5b5854f17eed4d15).
Something wrong on this page? Write to docs@librettocms.com.