Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Library: simplify font collection schema #58574

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 105 additions & 22 deletions schemas/json/font-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,99 @@
"title": "JSON schema for WordPress Font Collections",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"definitions": {
"fontFace": {
"description": "Font face settings. The same as theme.json but with the preview key",
"type": "object",
"properties": {
"preview": {
"description": "URL to a preview image of the font",
matiasbenedetto marked this conversation as resolved.
Show resolved Hide resolved
"type": "string"
},
"fontFamily": {
"description": "CSS font-family value.",
"type": "string",
"default": ""
},
"fontStyle": {
"description": "CSS font-style value.",
"type": "string",
"default": "normal"
},
"fontWeight": {
"description": "List of available font weights, separated by a space.",
"default": "400",
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"fontDisplay": {
"description": "CSS font-display value.",
"type": "string",
"default": "fallback",
"enum": [ "auto", "block", "fallback", "swap", "optional" ]
},
"src": {
"description": "Paths or URLs to the font files.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"default": []
},
"fontStretch": {
"description": "CSS font-stretch value.",
"type": "string"
},
"ascentOverride": {
"description": "CSS ascent-override value.",
"type": "string"
},
"descentOverride": {
"description": "CSS descent-override value.",
"type": "string"
},
"fontVariant": {
"description": "CSS font-variant value.",
"type": "string"
},
"fontFeatureSettings": {
"description": "CSS font-feature-settings value.",
"type": "string"
},
"fontVariationSettings": {
"description": "CSS font-variation-settings value.",
"type": "string"
},
"lineGapOverride": {
"description": "CSS line-gap-override value.",
"type": "string"
},
"sizeAdjust": {
"description": "CSS size-adjust value.",
"type": "string"
},
"unicodeRange": {
"description": "CSS unicode-range value.",
"type": "string"
}
},
"required": [ "fontFamily", "src" ],
"additionalProperties": false
}
},
"properties": {
"$schema": {
"description": "JSON schema URI for font-collection.json.",
Expand Down Expand Up @@ -40,41 +133,31 @@
"fontFamily": {
"description": "CSS font-family value.",
"type": "string"
}
},
"additionalProperties": false
},
"font_faces": {
"description": "Array of font-face declarations.",
"type": "array",
"items": {
"type": "object",
"properties": {
"preview": {
"type": "string",
"description": "URL to a preview image of the font face"
},
"font_face_settings": {
"description": "Font face settings as in theme.json",
},
"preview": {
"type": "string",
"description": "URL to a preview image of the font family"
matiasbenedetto marked this conversation as resolved.
Show resolved Hide resolved
},
"fontFace": {
"description": "Array of font-face declarations.",
"type": "array",
"items": {
"allOf": [
{
"$ref": "./theme.json#/definitions/fontFace"
"$ref": "#/definitions/fontFace"
}
]
}
}
}
},
"additionalProperties": false
},
"categories": {
"type": "array",
"description": "Array of category slugs",
"items": {
"type": "string"
}
},
"preview": {
"type": "string",
"description": "URL to a preview image of the font family"
}
},
"required": [ "font_family_settings" ],
Expand Down
Loading