Operazioni sui font
5 operazioni di nome font.*. Ognuna si esegue in un batch con apply_ops, dry_run_ops, la CLI o l’admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| font.list | List the site's font library: each face with its id, family name, weight, style, display, unicode range, source (upload, google or blueprint), licence note and file URL. | site.read | none |
| font.recordUpload | Record a WOFF2 face the admin staged through its upload endpoint (id, storageKey, and the face's family name, weight, style, display and fallback stack) after checking its bytes again. | 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 | Delete one face of the library by fontId. | 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
List the site's font library: each face with its id, family name, weight, style, display, unicode range, source (upload, google or blueprint), licence note and file URL. A font.family.* token names a family by its name. Undo restores the library; its files are kept.
Esempio di input
{}Input
L’input è un record: vedi lo schema qui sotto.
{
"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 |
Provala
yarn splash font.list '{}' --dry-runfont.recordUpload
Record a WOFF2 face the admin staged through its upload endpoint (id, storageKey, and the face's family name, weight, style, display and fallback stack) after checking its bytes again. With the bytes in hand, upload with font.upload instead. Undo restores the library; its files are kept.
Esempio di 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 |
Provala
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. Undo restores the library; its files are kept.
Esempio di 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 |
Provala
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
Delete one face of the library by fontId. The last face of a family is refused while a font.family.* token of any theme names that family (409 font_family_in_use, with the tokens): point them at another family first. Undo restores the library; its files are kept.
Esempio di input
{
"fontId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| fontId | string (uuid) | yes |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| success | true | yes |
Vuole confirmed: ["destructive"] sul batch, che la forma della CLI per una sola operazione non imposta: mettila in un file di batch ed esegui 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. Undo restores the library; its files are kept.
Esempio di 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 |
Provala
yarn splash font.importGoogle '{"family":"DM Sans","weights":[400,700],"styles":["normal"],"display":"swap"}' --dry-runGenerato dal registro delle operazioni e dal catalogo degli strumenti MCP (sorgente 9fc016b5e395bb00).
Qualcosa non va in questa pagina? Scrivi a docs@librettocms.com.