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: Update font collection json schema #58413

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
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
60 changes: 55 additions & 5 deletions schemas/json/font-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,74 @@
"description": "JSON schema URI for font-collection.json.",
"type": "string"
},
"slug": {
"type": "string",
"description": "Slug of the font collection. Must be unique and URL friendly."
},
"name": {
"type": "string",
"description": "Name of the font collection."
},
"description": {
"type": "string",
"description": "Description of the font collection."
},
"font_families": {
"type": "array",
"description": "Array of font families ready to be installed",
"items": {
"type": "object",
"properties": {
"font_family_settings": {
"description": "Font family settings as in theme.json",
"allOf": [
{ "$ref": "./theme.json#/definitions/fontFamily" }
]
"description": "Font family settings similar to theme.json but without fontFace key.",
"type": "object",
"properties": {
"name": {
"description": "Name of the font family preset, translatable.",
"type": "string"
},
"slug": {
"description": "Kebab-case unique identifier for the font family preset.",
"type": "string"
},
"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",
"allOf": [
{
"$ref": "./theme.json#/definitions/fontFace"
}
]
}
}
}
},
"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 All @@ -50,5 +100,5 @@
}
},
"additionalProperties": false,
"required": [ "$schema", "font_families" ]
"required": [ "$schema", "slug", "name", "font_families" ]
}
202 changes: 98 additions & 104 deletions schemas/json/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -619,127 +619,121 @@
"description": "Font family presets for the font family selector.\nGenerates a single custom property (`--wp--preset--font-family--{slug}`) per preset value.",
"type": "array",
"items": {
"$ref": "#/definitions/fontFamily"
"type": "object",
"description": "Font family preset",
"properties": {
"name": {
"description": "Name of the font family preset, translatable.",
"type": "string"
},
"slug": {
"description": "Kebab-case unique identifier for the font family preset.",
"type": "string"
},
"fontFamily": {
"description": "CSS font-family value.",
"type": "string"
},
"fontFace": {
"description": "Array of font-face declarations.",
"type": "array",
"items": {
"$ref": "#/definitions/fontFace"
}
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
}
},
"fontFamily": {
"fontFace": {
"type": "object",
"description": "Font family preset",
"properties": {
"name": {
"description": "Name of the font family preset, translatable.",
"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"
},
"slug": {
"description": "Kebab-case unique identifier for the font family preset.",
"ascentOverride": {
"description": "CSS ascent-override value.",
"type": "string"
},
"fontFamily": {
"description": "CSS font-family value.",
"descentOverride": {
"description": "CSS descent-override value.",
"type": "string"
},
"fontFace": {
"description": "Array of font-face declarations.",
"type": "array",
"items": {
"type": "object",
"properties": {
"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
}
"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
},
"settingsPropertiesCustom": {
Expand Down
Loading