Skip to content

Commit

Permalink
Font Library: simplify font collection schema (#58574)
Browse files Browse the repository at this point in the history
Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org>
Co-authored-by: creativecoder <grantmkin@git.wordpress.org>
  • Loading branch information
3 people authored Feb 1, 2024
1 parent 91450bd commit 6d75b0f
Showing 1 changed file with 109 additions and 26 deletions.
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

0 comments on commit 6d75b0f

Please sign in to comment.