---
title: "layer.setText: Edit Text — Motion kit command — Kition"
description: "Edits a text layer: replaces `text` (whole or a character `range`) and sets character and paragraph formatting (`font`, `size`, `fill`, `stroke`, `tracking`, `leading`, `justify`, OpenType features, `box`). Keys the source text when animated."
canonical: "https://developer.kition.ai/docs/kits/motion/commands/layer.setText"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/motion/commands/layer.setText](https://developer.kition.ai/docs/kits/motion/commands/layer.setText)

# layer.setText

**Edit Text.** Edits a text layer: replaces `text` (whole or a character `range`) and sets character and paragraph formatting (`font`, `size`, `fill`, `stroke`, `tracking`, `leading`, `justify`, OpenType features, `box`). Keys the source text when animated.

- Kit: Motion 0.1.0 (.kmotion); reference: [Motion kit commands](https://developer.kition.ai/docs/kits/motion.md)
- Changes the document: yes
- Acts on: `layer` (one id), which a run step’s `on` fills

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `allCaps` | `boolean` | no |  |
| `allSmallCaps` | `boolean` | no |  |
| `applyFill` | `boolean` | no |  |
| `applyStroke` | `boolean` | no |  |
| `baseline` | `"normal" \| "superscript" \| "subscript"` | no |  |
| `baselineShift` | `number` | no | pixels |
| `box` | `any[]` | no | [x,y,w,h]\|null (layer space); layer space |
| `comp` | `integer \| string` | no | read by the command beside its listed parameters |
| `composer` | `"everyLine" \| "singleLine"` | no |  |
| `contextualAlternates` | `boolean` | no |  |
| `direction` | `"ltr" \| "rtl"` | no |  |
| `discretionaryLigatures` | `boolean` | no | OpenType |
| `fauxBold` | `boolean` | no |  |
| `fauxItalic` | `boolean` | no |  |
| `figureStyle` | `"default" \| "lining" \| "oldStyle"` | no |  |
| `figureWidth` | `"default" \| "proportional" \| "tabular"` | no |  |
| `figures` | `any` | no |  |
| `fill` | `string \| number[]` | no | a colour, "#rrggbb" or [r, g, b] (0 to 1) |
| `font` | `string` | no |  |
| `fractions` | `boolean` | no |  |
| `hScale` | `number` | no | percent |
| `hangingPunctuation` | `boolean` | no |  |
| `indentFirst` | `number` | no |  |
| `indentLeft` | `number` | no |  |
| `indentRight` | `number` | no |  |
| `justify` | `"left" \| "center" \| "right" \| "justifyLeft" \| "justifyCenter" \| "justifyRight" \| "justifyAll"` | no |  |
| `kerning` | `"metrics" \| "optical" \| number` | no | metrics\|optical\|number |
| `layer` | `integer \| string` | no |  |
| `leading` | `number` | no | px\|"auto" |
| `ligatures` | `boolean` | no |  |
| `merge` | `string` | no | read by the command beside its listed parameters |
| `ordinals` | `boolean` | no |  |
| `range` | `number[]` | no | [start, end]; characters; default all |
| `size` | `number` | no |  |
| `smallCaps` | `boolean` | no |  |
| `spaceAfter` | `number` | no |  |
| `spaceBefore` | `number` | no |  |
| `ss01` | `boolean` | no | OpenType stylistic set 1 |
| `ss02` | `boolean` | no | OpenType stylistic set 2 |
| `ss03` | `boolean` | no | OpenType stylistic set 3 |
| `ss04` | `boolean` | no | OpenType stylistic set 4 |
| `ss05` | `boolean` | no | OpenType stylistic set 5 |
| `ss06` | `boolean` | no | OpenType stylistic set 6 |
| `ss07` | `boolean` | no | OpenType stylistic set 7 |
| `ss08` | `boolean` | no | OpenType stylistic set 8 |
| `ss09` | `boolean` | no | OpenType stylistic set 9 |
| `ss10` | `boolean` | no | OpenType stylistic set 10 |
| `ss11` | `boolean` | no | OpenType stylistic set 11 |
| `ss12` | `boolean` | no | OpenType stylistic set 12 |
| `ss13` | `boolean` | no | OpenType stylistic set 13 |
| `ss14` | `boolean` | no | OpenType stylistic set 14 |
| `ss15` | `boolean` | no | OpenType stylistic set 15 |
| `ss16` | `boolean` | no | OpenType stylistic set 16 |
| `ss17` | `boolean` | no | OpenType stylistic set 17 |
| `ss18` | `boolean` | no | OpenType stylistic set 18 |
| `ss19` | `boolean` | no | OpenType stylistic set 19 |
| `ss20` | `boolean` | no | OpenType stylistic set 20 |
| `stroke` | `string \| number[]` | no | a colour, "#rrggbb" or [r, g, b] (0 to 1) |
| `strokeOverFill` | `boolean` | no |  |
| `strokeWidth` | `number` | no |  |
| `style` | `string` | no |  |
| `stylisticAlternates` | `boolean` | no |  |
| `stylisticSets` | `any[]` | no | [1–20] |
| `subscript` | `boolean` | no |  |
| `superscript` | `boolean` | no |  |
| `swash` | `boolean` | no |  |
| `text` | `string` | no |  |
| `titling` | `boolean` | no |  |
| `tracking` | `number` | no |  |
| `tsume` | `number` | no | percent |
| `vScale` | `number` | no | percent |
| `variations` | `object` | no | variable font axes; null resets |
| `vertical` | `boolean` | no |  |

## Call through motion_run

```text
motion_run {
  "path": "<file>.kmotion",
  "steps": [{ "command": "layer.setText" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `allCaps`, `allSmallCaps`, `applyFill`, `applyStroke`, `baseline`, `baselineShift`, `box`, `comp`, `composer`, `contextualAlternates`, `direction`, `discretionaryLigatures`, `fauxBold`, `fauxItalic`, `figureStyle`, `figureWidth`, `figures`, `fill`, `font`, `fractions`, `hScale`, `hangingPunctuation`, `indentFirst`, `indentLeft`, `indentRight`, `justify`, `kerning`, `layer`, `leading`, `ligatures`, `merge`, `ordinals`, `range`, `size`, `smallCaps`, `spaceAfter`, `spaceBefore`, `ss01`, `ss02`, `ss03`, `ss04`, `ss05`, `ss06`, `ss07`, `ss08`, `ss09`, `ss10`, `ss11`, `ss12`, `ss13`, `ss14`, `ss15`, `ss16`, `ss17`, `ss18`, `ss19`, `ss20`, `stroke`, `strokeOverFill`, `strokeWidth`, `style`, `stylisticAlternates`, `stylisticSets`, `subscript`, `superscript`, `swash`, `text`, `titling`, `tracking`, `tsume`, `vScale`, `variations`, `vertical`. motion_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "allCaps": {
      "type": "boolean"
    },
    "allSmallCaps": {
      "type": "boolean"
    },
    "applyFill": {
      "type": "boolean"
    },
    "applyStroke": {
      "type": "boolean"
    },
    "baseline": {
      "enum": [
        "normal",
        "superscript",
        "subscript"
      ],
      "type": "string"
    },
    "baselineShift": {
      "description": "pixels",
      "type": "number"
    },
    "box": {
      "description": "[x,y,w,h]|null (layer space); layer space",
      "items": {},
      "type": "array"
    },
    "comp": {
      "description": "read by the command beside its listed parameters",
      "oneOf": [
        {
          "description": "comp's item id as motion_inspect lists it",
          "type": "integer"
        },
        {
          "description": "the item id as receipts print it (\"1\"), or the comp's name",
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Item"
      ]
    },
    "composer": {
      "enum": [
        "everyLine",
        "singleLine"
      ],
      "type": "string"
    },
    "contextualAlternates": {
      "type": "boolean"
    },
    "direction": {
      "enum": [
        "ltr",
        "rtl"
      ],
      "type": "string"
    },
    "discretionaryLigatures": {
      "description": "OpenType",
      "type": "boolean"
    },
    "fauxBold": {
      "type": "boolean"
    },
    "fauxItalic": {
      "type": "boolean"
    },
    "figureStyle": {
      "enum": [
        "default",
        "lining",
        "oldStyle"
      ],
      "type": "string"
    },
    "figureWidth": {
      "enum": [
        "default",
        "proportional",
        "tabular"
      ],
      "type": "string"
    },
    "figures": {},
    "fill": {
      "description": "a colour, \"#rrggbb\" or [r, g, b] (0 to 1)",
      "oneOf": [
        {
          "description": "#rrggbb",
          "type": "string"
        },
        {
          "description": "[r, g, b], 0 to 1",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      ]
    },
    "font": {
      "type": "string"
    },
    "fractions": {
      "type": "boolean"
    },
    "hScale": {
      "description": "percent",
      "type": "number"
    },
    "hangingPunctuation": {
      "type": "boolean"
    },
    "indentFirst": {
      "type": "number"
    },
    "indentLeft": {
      "type": "number"
    },
    "indentRight": {
      "type": "number"
    },
    "justify": {
      "enum": [
        "left",
        "center",
        "right",
        "justifyLeft",
        "justifyCenter",
        "justifyRight",
        "justifyAll"
      ],
      "type": "string"
    },
    "kerning": {
      "description": "metrics|optical|number",
      "oneOf": [
        {
          "enum": [
            "metrics",
            "optical"
          ],
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "layer": {
      "oneOf": [
        {
          "description": "layer id as motion_inspect lists it (when no layer has that id, its 1-based stack position)",
          "type": "integer"
        },
        {
          "description": "layer id as receipts print it (\"51\"), a layer name, or #n for the n-th from the top",
          "type": "string"
        }
      ],
      "x-khp-index": "#",
      "x-khp-index-numbers": true,
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    },
    "leading": {
      "description": "px|\"auto\"",
      "type": "number"
    },
    "ligatures": {
      "type": "boolean"
    },
    "merge": {
      "description": "read by the command beside its listed parameters",
      "type": "string"
    },
    "ordinals": {
      "type": "boolean"
    },
    "range": {
      "description": "[start, end]; characters; default all",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "size": {
      "type": "number"
    },
    "smallCaps": {
      "type": "boolean"
    },
    "spaceAfter": {
      "type": "number"
    },
    "spaceBefore": {
      "type": "number"
    },
    "ss01": {
      "description": "OpenType stylistic set 1",
      "type": "boolean"
    },
    "ss02": {
      "description": "OpenType stylistic set 2",
      "type": "boolean"
    },
    "ss03": {
      "description": "OpenType stylistic set 3",
      "type": "boolean"
    },
    "ss04": {
      "description": "OpenType stylistic set 4",
      "type": "boolean"
    },
    "ss05": {
      "description": "OpenType stylistic set 5",
      "type": "boolean"
    },
    "ss06": {
      "description": "OpenType stylistic set 6",
      "type": "boolean"
    },
    "ss07": {
      "description": "OpenType stylistic set 7",
      "type": "boolean"
    },
    "ss08": {
      "description": "OpenType stylistic set 8",
      "type": "boolean"
    },
    "ss09": {
      "description": "OpenType stylistic set 9",
      "type": "boolean"
    },
    "ss10": {
      "description": "OpenType stylistic set 10",
      "type": "boolean"
    },
    "ss11": {
      "description": "OpenType stylistic set 11",
      "type": "boolean"
    },
    "ss12": {
      "description": "OpenType stylistic set 12",
      "type": "boolean"
    },
    "ss13": {
      "description": "OpenType stylistic set 13",
      "type": "boolean"
    },
    "ss14": {
      "description": "OpenType stylistic set 14",
      "type": "boolean"
    },
    "ss15": {
      "description": "OpenType stylistic set 15",
      "type": "boolean"
    },
    "ss16": {
      "description": "OpenType stylistic set 16",
      "type": "boolean"
    },
    "ss17": {
      "description": "OpenType stylistic set 17",
      "type": "boolean"
    },
    "ss18": {
      "description": "OpenType stylistic set 18",
      "type": "boolean"
    },
    "ss19": {
      "description": "OpenType stylistic set 19",
      "type": "boolean"
    },
    "ss20": {
      "description": "OpenType stylistic set 20",
      "type": "boolean"
    },
    "stroke": {
      "description": "a colour, \"#rrggbb\" or [r, g, b] (0 to 1)",
      "oneOf": [
        {
          "description": "#rrggbb",
          "type": "string"
        },
        {
          "description": "[r, g, b], 0 to 1",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      ]
    },
    "strokeOverFill": {
      "type": "boolean"
    },
    "strokeWidth": {
      "type": "number"
    },
    "style": {
      "type": "string"
    },
    "stylisticAlternates": {
      "type": "boolean"
    },
    "stylisticSets": {
      "description": "[1–20]",
      "items": {},
      "type": "array"
    },
    "subscript": {
      "type": "boolean"
    },
    "superscript": {
      "type": "boolean"
    },
    "swash": {
      "type": "boolean"
    },
    "text": {
      "type": "string"
    },
    "titling": {
      "type": "boolean"
    },
    "tracking": {
      "type": "number"
    },
    "tsume": {
      "description": "percent",
      "type": "number"
    },
    "vScale": {
      "description": "percent",
      "type": "number"
    },
    "variations": {
      "additionalProperties": true,
      "description": "variable font axes; null resets",
      "properties": {
        "tag": {}
      },
      "type": "object"
    },
    "vertical": {
      "type": "boolean"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/motion-darwin-arm64@0.1.0 and the kit itself (motion_commands through @kition/cli@0.1.1, built from KitionAI/kition-motion@4719aa7).
