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 all commits
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
135 changes: 109 additions & 26 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 theme.json settings, with added preview property.",
"type": "object",
"properties": {
"preview": {
"description": "URL to a preview image of the font.",
"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 All @@ -21,12 +114,12 @@
},
"font_families": {
"type": "array",
"description": "Array of font families ready to be installed",
"description": "Array of font families ready to be installed.",
"items": {
"type": "object",
"properties": {
"font_family_settings": {
"description": "Font family settings similar to theme.json but without fontFace key.",
"description": "Font family theme.json settings, with added preview property.",
"type": "object",
"properties": {
"name": {
Expand All @@ -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."
},
"fontFace": {
"description": "Array of font-face definitions.",
"type": "array",
"items": {
"allOf": [
{
"$ref": "./theme.json#/definitions/fontFace"
"$ref": "#/definitions/fontFace"
}
]
}
}
}
},
"additionalProperties": false
},
"categories": {
"type": "array",
"description": "Array of category slugs",
"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 All @@ -83,7 +166,7 @@
},
"categories": {
"type": "array",
"description": "Array of category objects",
"description": "Array of category objects.",
"items": {
"type": "object",
"properties": {
Expand Down
Loading