Schemas / Layout

rig.layout.paragraph_style

v1.0.0 · stable maturity: stable 26 fields 0 required

Fields

FieldTypeMeaning
storyStyle entity optional Optional. Story paragraph style this map applies to
basedOn entity optional Optional. Parent layout paragraph style; absent / null = none
font entity optional Optional. rig.media.asset_ref kind font
fontSize float optional Optional. Size in document units (or points when the host documents that)
leading float optional Optional. Line spacing; absent = host default from fontSize
alignment enumleft · center · right · justify optional Optional. left / center / right / justify. Absent = left
lastLineAlignment enumleft · center · right · justify optional Optional. Alignment of a paragraph's last line (a one-line paragraph is its own last line). Same values as alignment. Absent = left
spaceBefore float optional Optional. Space before the paragraph
spaceAfter float optional Optional. Space after the paragraph
firstLineIndent float optional Optional. First-line indent
leftIndent float optional Optional. Indent off the frame's left content edge; absent = 0
rightIndent float optional Optional. Indent off the frame's right content edge; absent = 0
tracking float optional Optional. Uniform letterspace in thousandths of an em; absent = 0
wordSpacingMin float optional Optional. Justification word-space floor as % of the font's space; absent = host default
wordSpacingDesired float optional Optional. Justification word-space target as % of the font's space; absent = host default
wordSpacingMax float optional Optional. Justification word-space ceiling as % of the font's space; absent = host default
letterSpacingMin float optional Optional. Justification letterspace floor in thousandths of an em; absent = 0
letterSpacingMax float optional Optional. Justification letterspace ceiling in thousandths of an em; absent = 0
keepFirstLines int optional Optional. Min lines left before a frame / page break (orphans). 0 = off; absent = host default
keepLastLines int optional Optional. Min lines carried past a frame / page break (widows). 0 = off; absent = host default
keepLastWords int optional Optional. Min words on the paragraph's last line (runts). 0 / 1 = off; absent = host default
hyphenate bool optional Optional. Dictionary hyphenation at line breaks. Absent = true; authored soft hyphens (U+00AD) always stay break opportunities
alignToBaselineGrid bool optional Optional. Snap lines to the document rig.layout.grid baseline increment. Absent = false
baselineGridFirstLineOnly bool optional Optional. With alignToBaselineGrid, snap only the paragraph's first line; the rest follow leading. Absent = false
paint entity optional Optional. Paint entity (rig.paint.fill / solid) for the run colour
grepStyles array<object> optional Optional. GREP style rules, applied in order (see below)

Visual map for a rig.story.paragraph_style. Format when present.

Story styles stay identity-only (name + basedOn + listKind). Font, size, leading, alignment, and colour live here so any host can open the same book. Key with storyStyle; resolve basedOn chains on this schema separately from the story chain.

Based-on chains stay acyclic. A cycle is a document error. Do not put these fields on rig.story.*.

GREP styles

Each grepStyles entry is { "pattern": <ECMAScript regex>, "characterStyle": <entity> }: text the pattern matches takes the named rig.layout.character_style. Rules apply in order; an authored run character style - and any earlier rule's match - always wins over a later rule. A match cannot straddle a style boundary, and a style that defines any rules replaces its parent's set rather than merging with it. Patterns that do not compile are ignored.

JSON Schema

Resolves at https://rig.works/schemas/rig.layout.paragraph_style.schema.json — raw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.layout.paragraph_style.schema.json",
  "title": "rig.layout.paragraph_style",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "storyStyle": {
      "$ref": "./_defs.schema.json#/$defs/entity"
    },
    "basedOn": {
      "$ref": "./_defs.schema.json#/$defs/entity"
    },
    "font": {
      "$ref": "./_defs.schema.json#/$defs/entity"
    },
    "fontSize": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "leading": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "alignment": {
      "type": "string",
      "enum": [
        "left",
        "center",
        "right",
        "justify"
      ]
    },
    "lastLineAlignment": {
      "type": "string",
      "enum": [
        "left",
        "center",
        "right",
        "justify"
      ]
    },
    "spaceBefore": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "spaceAfter": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "firstLineIndent": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "leftIndent": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "rightIndent": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "tracking": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "wordSpacingMin": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "wordSpacingDesired": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "wordSpacingMax": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "letterSpacingMin": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "letterSpacingMax": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "keepFirstLines": {
      "$ref": "./_defs.schema.json#/$defs/int"
    },
    "keepLastLines": {
      "$ref": "./_defs.schema.json#/$defs/int"
    },
    "keepLastWords": {
      "$ref": "./_defs.schema.json#/$defs/int"
    },
    "hyphenate": {
      "$ref": "./_defs.schema.json#/$defs/bool"
    },
    "alignToBaselineGrid": {
      "$ref": "./_defs.schema.json#/$defs/bool"
    },
    "baselineGridFirstLineOnly": {
      "$ref": "./_defs.schema.json#/$defs/bool"
    },
    "paint": {
      "$ref": "./_defs.schema.json#/$defs/entity"
    },
    "grepStyles": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "pattern"
        ],
        "properties": {
          "pattern": {
            "type": "string"
          },
          "characterStyle": {
            "$ref": "./_defs.schema.json#/$defs/entity"
          }
        }
      }
    }
  },
  "x-rig-maturity": "stable"
}

Seen in

story-frames.json