Photo kit command

text.add

New Type Layer

Adds a type layer with `text` at `x`, `y` (point text), or paragraph text in `box` [x, y, width, height] (any other `box` is refused), with font, size, color, alignment and `hyphenate` (breaks long words at line ends with a hyphen); answers its id and its bounds [x, y, width, height], as file.inspect gives them.

Kit
Photo 0.1.0 (PSD, PSB, or .kphoto)
Changes the document
yes
Acts on
layer (one id), which a run step’s on fills

Parameters

Parameters of text.add
NameTypeRequiredDescription
alignstringnofor example left, center, right
antialias"none" | "sharp" | "crisp" | "strong" | "smooth"no
atnumber[]noInstead of `layer`: a point [x, y] in image pixels; the command acts on the topmost visible layer, not fully locked, with a pixel there (the Move tool's Auto-Select).
autoLeadingnumbernopercent
backgroundColorstringnoThe background color the command uses, "#rrggbb", for this call only; the current background color by default.
baselineShiftnumbernopoints
boxnumber[]noparagraph text
caps"normal" | "small" | "all"no
coalescestringnoMerges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.
colorstringno
direction"auto" | "ltr" | "rtl"no
discretionaryLigaturesbooleanno
endIndentnumbernopoints
fauxBoldbooleanno
fauxItalicbooleanno
featuresobjectno
firstLineIndentnumbernopoints
fontstringno
fontStylestringno
foregroundColorstringnoThe foreground color the command uses, "#rrggbb", for this call only; the current foreground color by default.
horizontalScalenumbernopercent
hyphenatebooleanno
italicbooleanno
kerninganyno1/1000em (manual, after each character)|"metrics"|"optical"|"off"; manual, after each character
languagestringno
layerinteger | stringnoThe layer: its id as inspect lists it, "#n" (the n-th layer of the image's top level as inspect lists it, counted from the top: "#1" is the top one), or its whole name when no other layer has it; the active layer by default.
leadinganynopt|"auto"
ligaturesbooleanno
namestringno
orientation"horizontal" | "vertical"no
sizenumbernopoints
spaceAfternumbernopoints
spaceBeforenumbernopoints
startIndentnumbernopoints
strikethroughbooleanno
textstringno
trackinganyno-1000..=10000 (1/1000 em); 1/1000 em; default 10000
underlinebooleanno
variationsobjectno
verticalScalenumbernopercent
weightintegerno100 to 900
xnumbernopixels
ynumbernopixels; baseline anchor of point text

Call through photo_run

text
photo_run {
  "path": "<file>.psd",
  "steps": [{ "command": "text.add" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: align, antialias, at, autoLeading, backgroundColor, baselineShift, box, caps, coalesce, color, direction, discretionaryLigatures, endIndent, fauxBold, fauxItalic, features, firstLineIndent, font, fontStyle, foregroundColor, horizontalScale, hyphenate, italic, kerning, language, layer, leading, ligatures, name, orientation, size, spaceAfter, spaceBefore, startIndent, strikethrough, text, tracking, underline, variations, verticalScale, weight, x, y. photo_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": {
    "align": {
      "description": "for example left, center, right",
      "type": "string"
    },
    "antialias": {
      "default": "smooth",
      "enum": [
        "none",
        "sharp",
        "crisp",
        "strong",
        "smooth"
      ],
      "type": "string"
    },
    "at": {
      "description": "Instead of `layer`: a point [x, y] in image pixels; the command acts on the topmost visible layer, not fully locked, with a pixel there (the Move tool's Auto-Select).",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "autoLeading": {
      "description": "percent",
      "type": "number"
    },
    "backgroundColor": {
      "description": "The background color the command uses, \"#rrggbb\", for this call only; the current background color by default.",
      "type": "string"
    },
    "baselineShift": {
      "description": "points",
      "type": "number"
    },
    "box": {
      "description": "paragraph text",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "caps": {
      "enum": [
        "normal",
        "small",
        "all"
      ],
      "type": "string"
    },
    "coalesce": {
      "description": "Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.",
      "type": "string"
    },
    "color": {
      "type": "string"
    },
    "direction": {
      "enum": [
        "auto",
        "ltr",
        "rtl"
      ],
      "type": "string"
    },
    "discretionaryLigatures": {
      "type": "boolean"
    },
    "endIndent": {
      "description": "points",
      "type": "number"
    },
    "fauxBold": {
      "type": "boolean"
    },
    "fauxItalic": {
      "type": "boolean"
    },
    "features": {
      "additionalProperties": true,
      "properties": {
        "ss01": {
          "default": 1,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "firstLineIndent": {
      "description": "points",
      "type": "number"
    },
    "font": {
      "type": "string"
    },
    "fontStyle": {
      "type": "string"
    },
    "foregroundColor": {
      "description": "The foreground color the command uses, \"#rrggbb\", for this call only; the current foreground color by default.",
      "type": "string"
    },
    "horizontalScale": {
      "description": "percent",
      "type": "number"
    },
    "hyphenate": {
      "type": "boolean"
    },
    "italic": {
      "type": "boolean"
    },
    "kerning": {
      "description": "1/1000em (manual, after each character)|\"metrics\"|\"optical\"|\"off\"; manual, after each character"
    },
    "language": {
      "type": "string"
    },
    "layer": {
      "description": "The layer: its id as inspect lists it, \"#n\" (the n-th layer of the image's top level as inspect lists it, counted from the top: \"#1\" is the top one), or its whole name when no other layer has it; the active layer by default.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-index": "#",
      "x-khp-index-order": "reversed",
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    },
    "leading": {
      "description": "pt|\"auto\""
    },
    "ligatures": {
      "type": "boolean"
    },
    "name": {
      "type": "string"
    },
    "orientation": {
      "default": "horizontal",
      "enum": [
        "horizontal",
        "vertical"
      ],
      "type": "string"
    },
    "size": {
      "default": 12,
      "description": "points",
      "type": "number"
    },
    "spaceAfter": {
      "description": "points",
      "type": "number"
    },
    "spaceBefore": {
      "description": "points",
      "type": "number"
    },
    "startIndent": {
      "description": "points",
      "type": "number"
    },
    "strikethrough": {
      "type": "boolean"
    },
    "text": {
      "type": "string"
    },
    "tracking": {
      "description": "-1000..=10000 (1/1000 em); 1/1000 em; default 10000"
    },
    "underline": {
      "type": "boolean"
    },
    "variations": {
      "additionalProperties": true,
      "properties": {
        "wght": {
          "default": 650,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "verticalScale": {
      "description": "percent",
      "type": "number"
    },
    "weight": {
      "description": "100 to 900",
      "type": "integer"
    },
    "x": {
      "description": "pixels",
      "type": "number"
    },
    "y": {
      "description": "pixels; baseline anchor of point text",
      "type": "number"
    }
  },
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (photo_commands through @kition/[email protected], built from KitionAI/kition-photo@abe3f30). As data: commands.jsonl.