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’sonfills
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
align | string | no | for example left, center, right |
antialias | "none" | "sharp" | "crisp" | "strong" | "smooth" | no | |
at | number[] | no | 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). |
autoLeading | number | no | percent |
backgroundColor | string | no | The background color the command uses, "#rrggbb", for this call only; the current background color by default. |
baselineShift | number | no | points |
box | number[] | no | paragraph text |
caps | "normal" | "small" | "all" | no | |
coalesce | string | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
color | string | no | |
direction | "auto" | "ltr" | "rtl" | no | |
discretionaryLigatures | boolean | no | |
endIndent | number | no | points |
fauxBold | boolean | no | |
fauxItalic | boolean | no | |
features | object | no | |
firstLineIndent | number | no | points |
font | string | no | |
fontStyle | string | no | |
foregroundColor | string | no | The foreground color the command uses, "#rrggbb", for this call only; the current foreground color by default. |
horizontalScale | number | no | percent |
hyphenate | boolean | no | |
italic | boolean | no | |
kerning | any | no | 1/1000em (manual, after each character)|"metrics"|"optical"|"off"; manual, after each character |
language | string | no | |
layer | integer | string | no | 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. |
leading | any | no | pt|"auto" |
ligatures | boolean | no | |
name | string | no | |
orientation | "horizontal" | "vertical" | no | |
size | number | no | points |
spaceAfter | number | no | points |
spaceBefore | number | no | points |
startIndent | number | no | points |
strikethrough | boolean | no | |
text | string | no | |
tracking | any | no | -1000..=10000 (1/1000 em); 1/1000 em; default 10000 |
underline | boolean | no | |
variations | object | no | |
verticalScale | number | no | percent |
weight | integer | no | 100 to 900 |
x | number | no | pixels |
y | number | no | pixels; baseline anchor of point text |
Call through photo_run
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
{
"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.