set_layer_text
Edit an existing text layer (text.). Patches its text content, font, size, colour, and full type styling — pass only the fields you want to change. Does NOT create layers and does NOT touch image layers; use add_text_layer to make a new one. font_family is a Google Fonts family name (e.g. "Anton", "Bebas Neue"). text_size is the font size in px (omit to keep the current size). text_color is #rrggbb. Styling: font_weight (100-900, e.g. 800 for a black/heavy logo look), font_style (italic), text_transform (uppercase/lowercase), letter_spacing (px, may be negative for tight tracking), line_height (multiplier), text_align, text_autofit ("wrap" default = fixed size + word-wrap, the size you set is what renders; "fit"=auto-size to fill the box, grows and shrinks; "shrink"=legacy shrink-only), text_valign (top/middle/bottom block alignment), an outline via stroke_width + stroke_color, and a text_shadow. To make text MASK another layer (video/image-filled letterforms) use set_matte_source with this layer's id as the matte source. Only elementId is required.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | The text to render. Newlines are honoured as hard line breaks. | |
| curve | No | Curve the text onto an arc, in degrees of total sweep. 0 = straight (default). POSITIVE = a SMILE (⌣, ends rise); NEGATIVE = an ARCH (⌒, rainbow). Clamped ±135. A tasteful smile is ~+60. Applies to a SINGLE line — multi-line text is joined to one line while curved (the stored text is untouched, so curve:0 restores it). | |
| elementId | Yes | Text layer id, text.<id>. | |
| projectId | Yes | Opaque project id (a v4 UUID, from list_projects/create_project). Selects which existing project this call mutates. | |
| text_size | No | Font size in px. | |
| font_style | No | Italic toggle. Default normal. | |
| text_align | No | Horizontal alignment of each line. Default center. | |
| text_color | No | Text fill colour as #rrggbb. | |
| decorations | No | Per-character underline / strikethrough. { underline?: [{start,end}], strikethrough?: [{start,end}] } — each a list of half-open character ranges [start,end) (UTF-16 offsets) into `text`. E.g. underline the first word of "Big news": underline:[{start:0,end:3}]. Ranges are normalized (sorted + merged). null clears all decorations; editing `text` in the SAME call re-indexes existing ranges against the new text. Not rendered on curved text. | |
| font_family | No | Google Fonts family name, e.g. "Anton". | |
| font_weight | No | Font weight 100..900 (400 regular, 700 bold, 800 black). Default 400; the canvas synthesizes weights a static font doesn't ship. | |
| line_height | No | Line height as a multiple of font size (1.2 = 120%). | |
| text_shadow | No | Drop shadow { offsetX, offsetY, blur, color }; color is any CSS colour (rgba allowed). null clears it. | |
| text_valign | No | Vertical alignment of the text block within its box. "middle" (default) centres it; "bottom" pins it to the box floor so extra wrapped lines grow upward from a fixed baseline (captions use this so a wrapped line doesn't shift the others); "top" pins the ceiling. | |
| stroke_color | No | Outline colour as #rrggbb. Defaults to white when a width is set. | |
| stroke_width | No | Outline width in px (0 = no outline). | |
| text_autofit | No | How text fits its box. "hug" (default for new layers): hold text_size FIXED and DERIVE the box from the measured text plus padding, honouring the literal newlines you pass — the box shrink-wraps the exact content and grows/shrinks live as the text changes, so it can never re-wrap differently between the editor preview and the export (bake your own "\n" breaks; pair with set_text_background for a rounded caption box). "wrap": hold text_size FIXED in a fixed-size box and only word-wrap (hard-breaking a single over-wide word), never resize. "fit": ignore text_size and auto-size the font BOTH ways (grow and shrink) to the largest size whose wrapped block fills the box — resizing the box resizes the text. "shrink" (legacy): word-wrap then auto-shrink the font from text_size until the block fits; never grows. | |
| letter_spacing | No | Tracking between glyphs in px; may be negative. Default 0. | |
| text_transform | No | Case transform applied before layout. Default none. |