{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://juzhen.dev/schemas/juzhen-rules.schema.json", "title": "Juzhen shared typography rules", "type": "object", "additionalProperties": false, "required": [ "schemaVersion", "rulesetVersion", "unicodeProfile", "characterClasses", "atoms", "locales", "punctuationStyles", "spacing", "lineBreaking", "applicabilityLevels", "semanticProcessing", "adapterBoundary" ], "properties": { "$schema": { "type": "string" }, "schemaVersion": { "const": 1 }, "rulesetVersion": { "type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$" }, "unicodeProfile": { "type": "object", "additionalProperties": false, "required": [ "version", "coverage" ], "properties": { "version": { "const": "17.0.0" }, "coverage": { "type": "string", "minLength": 1 } } }, "characterClasses": { "type": "object", "additionalProperties": false, "required": [ "representation", "cjk", "ansAfterCjk", "ansBeforeCjk", "variationSelectors", "biaodian", "overrideSemantics" ], "properties": { "representation": { "const": "unicode-code-point-ranges" }, "cjk": { "$ref": "#/$defs/codePointSet" }, "ansAfterCjk": { "$ref": "#/$defs/codePointSet" }, "ansBeforeCjk": { "$ref": "#/$defs/codePointSet" }, "variationSelectors": { "$ref": "#/$defs/codePointSet" }, "biaodian": { "type": "object", "additionalProperties": false, "required": [ "classificationOrder", "classes" ], "properties": { "classificationOrder": { "type": "array", "prefixItems": [ { "const": "stop" }, { "const": "pause" }, { "const": "open" }, { "const": "close" }, { "const": "middle" }, { "const": "liga" } ], "items": false, "minItems": 6, "maxItems": 6 }, "classes": { "type": "object", "additionalProperties": false, "required": [ "stop", "pause", "open", "close", "middle", "liga" ], "properties": { "stop": { "$ref": "#/$defs/codePointSet" }, "pause": { "$ref": "#/$defs/codePointSet" }, "open": { "$ref": "#/$defs/codePointSet" }, "close": { "$ref": "#/$defs/codePointSet" }, "middle": { "$ref": "#/$defs/codePointSet" }, "liga": { "$ref": "#/$defs/codePointSet" } } } } }, "overrideSemantics": { "type": "object", "additionalProperties": false, "required": [ "mode", "westernTargets", "removalAllowed", "reclassificationAllowed" ], "properties": { "mode": { "const": "append" }, "westernTargets": { "type": "array", "prefixItems": [ { "const": "ansAfterCjk" }, { "const": "ansBeforeCjk" } ], "items": false, "minItems": 2, "maxItems": 2 }, "removalAllowed": { "const": false }, "reclassificationAllowed": { "const": false } } } } }, "atoms": { "type": "object", "additionalProperties": false, "required": [ "unit", "maxVariationSelectors", "variationSelectorMustFollowBase", "isolatedVariationSelector" ], "properties": { "unit": { "const": "base-code-point-plus-optional-variation-selector" }, "maxVariationSelectors": { "const": 1 }, "variationSelectorMustFollowBase": { "const": true }, "isolatedVariationSelector": { "const": "independent-atom" } } }, "locales": { "$ref": "#/$defs/locales" }, "punctuationStyles": { "$ref": "#/$defs/punctuationStyles" }, "spacing": { "$ref": "#/$defs/spacing" }, "lineBreaking": { "$ref": "#/$defs/lineBreaking" }, "applicabilityLevels": { "type": "object", "additionalProperties": false, "required": [ "text", "paragraph" ], "properties": { "text": { "$ref": "#/$defs/stringArray" }, "paragraph": { "$ref": "#/$defs/stringArray" } } }, "semanticProcessing": { "type": "object", "additionalProperties": false, "required": [ "dependencies", "conditionalLineEdgeOutcomes" ], "properties": { "dependencies": { "type": "array", "minItems": 1, "items": { "type": "object", "additionalProperties": false, "required": [ "before", "after" ], "properties": { "before": { "$ref": "#/$defs/semanticStage" }, "after": { "$ref": "#/$defs/semanticStage" } } } }, "conditionalLineEdgeOutcomes": { "type": "array", "prefixItems": [ { "const": "punctuation-half-width-at-line-edge" }, { "const": "remove-managed-gap-at-line-end" } ], "items": false, "minItems": 2, "maxItems": 2 } } }, "adapterBoundary": { "type": "object", "additionalProperties": false, "required": [ "platformNeutral", "excludedAdapterMechanisms" ], "properties": { "platformNeutral": { "$ref": "#/$defs/stringArray" }, "excludedAdapterMechanisms": { "$ref": "#/$defs/stringArray" } } } }, "$defs": { "hexCodePoint": { "type": "string", "pattern": "^(?:[0-9A-F]{4}|[0-9A-F]{5}|10[0-9A-F]{4})$" }, "codePointEntry": { "oneOf": [ { "type": "object", "additionalProperties": false, "required": [ "codePoint" ], "properties": { "codePoint": { "$ref": "#/$defs/hexCodePoint" } } }, { "type": "object", "additionalProperties": false, "required": [ "start", "end" ], "properties": { "start": { "$ref": "#/$defs/hexCodePoint" }, "end": { "$ref": "#/$defs/hexCodePoint" } } } ] }, "codePointSet": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/codePointEntry" } }, "stringArray": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true }, "style": { "enum": [ "quanjiao", "kaiming", "banjiao" ] }, "semanticStage": { "enum": [ "atomize", "classify", "derive-spacing", "derive-punctuation-width", "derive-break-constraints", "derive-orphan-constraint" ] }, "locales": { "type": "object", "additionalProperties": false, "required": [ "classes", "primaryLanguageBoundary", "classificationOrder", "zh", "ja", "defaultPolicies", "resolutionPriority" ], "properties": { "classes": { "type": "array", "prefixItems": [ { "const": "zh-Hans" }, { "const": "zh-Hant" }, { "const": "ja" }, { "const": "other" } ], "items": false, "minItems": 4, "maxItems": 4 }, "primaryLanguageBoundary": { "const": "exact-or-hyphen-subtag" }, "classificationOrder": { "$ref": "#/$defs/stringArray" }, "zh": { "type": "object", "additionalProperties": false, "required": [ "explicitTraditionalSubtag", "explicitSimplifiedSubtag", "traditionalRegions", "bare", "remaining" ], "properties": { "explicitTraditionalSubtag": { "const": "hant" }, "explicitSimplifiedSubtag": { "const": "hans" }, "traditionalRegions": { "type": "array", "prefixItems": [ { "const": "tw" }, { "const": "hk" }, { "const": "mo" } ], "items": false, "minItems": 3, "maxItems": 3 }, "bare": { "const": "zh-Hant" }, "remaining": { "const": "zh-Hans" } } }, "ja": { "const": "ja" }, "defaultPolicies": { "type": "object", "additionalProperties": false, "required": [ "zh-Hans", "zh-Hant", "ja", "other" ], "properties": { "zh-Hans": { "$ref": "#/$defs/style" }, "zh-Hant": { "$ref": "#/$defs/style" }, "ja": { "$ref": "#/$defs/style" }, "other": { "$ref": "#/$defs/style" } } }, "resolutionPriority": { "type": "array", "prefixItems": [ { "const": "element-attribute-or-style-policy-nearest-ancestor" }, { "const": "locale-class-policy" }, { "const": "global-style" }, { "const": "default-policy" } ], "items": false, "minItems": 4, "maxItems": 4 } } }, "punctuationStyles": { "type": "object", "additionalProperties": false, "required": [ "baselineHalfWidthClasses", "adjacency" ], "properties": { "baselineHalfWidthClasses": { "type": "object", "additionalProperties": false, "required": [ "quanjiao", "kaiming", "banjiao" ], "properties": { "quanjiao": { "$ref": "#/$defs/stringArray" }, "kaiming": { "$ref": "#/$defs/stringArray" }, "banjiao": { "$ref": "#/$defs/stringArray" } } }, "adjacency": { "type": "object", "additionalProperties": false, "required": [ "rule", "sentenceBoundaryException" ], "properties": { "rule": { "const": "squeeze-each-facing-blank-side-independently" }, "sentenceBoundaryException": { "type": "object", "additionalProperties": false, "required": [ "left", "right", "preserve" ], "properties": { "left": { "const": "stop" }, "right": { "const": "open" }, "preserve": { "const": "left-right-blank" } } } } } } }, "spacing": { "type": "object", "additionalProperties": false, "required": [ "gapEm", "directions", "authorSpaceDisposition" ], "properties": { "gapEm": { "const": 0.25 }, "directions": { "type": "object", "additionalProperties": false, "required": [ "cjkToAns", "ansToCjk", "asymmetry" ], "properties": { "cjkToAns": { "const": "ansAfterCjk" }, "ansToCjk": { "const": "ansBeforeCjk" }, "asymmetry": { "const": "at-sign-only-after-cjk" } } }, "authorSpaceDisposition": { "type": "object", "additionalProperties": false, "required": [ "cjkAns", "ansCjk", "cjkCjk", "revertRestoresRemovedSpace" ], "properties": { "cjkAns": { "const": "remove-and-use-managed-gap" }, "ansCjk": { "const": "remove-and-use-managed-gap" }, "cjkCjk": { "const": "remove-without-gap" }, "revertRestoresRemovedSpace": { "const": false } } } } }, "lineBreaking": { "type": "object", "additionalProperties": false, "required": [ "prohibitedBreaks", "orphan" ], "properties": { "prohibitedBreaks": { "type": "object", "additionalProperties": false, "required": [ "before", "after" ], "properties": { "before": { "$ref": "#/$defs/stringArray" }, "after": { "$ref": "#/$defs/stringArray" } } }, "orphan": { "type": "object", "additionalProperties": false, "required": [ "defaultMeaningfulCjkChars", "counts", "excludes" ], "properties": { "defaultMeaningfulCjkChars": { "const": 2 }, "counts": { "const": "cjk-atoms-not-classified-as-biaodian" }, "excludes": { "$ref": "#/$defs/stringArray" } } } } } } }