photoshop_set_text_ranges
Apply mixed fonts, sizes, and colors to defined character spans within a single text layer. Use when one layer needs multiple styles instead of separate layers.
Instructions
Apply mixed fonts, sizes, and colors inside a single text layer (Action Manager textStyleRange).
Users often say: mixed type, two fonts in one line, multicolor text, 混排, 同一文字层.
Use when: one layer must contain more than one font or color. from is inclusive, to is exclusive (JavaScript slice / ExtendScript string indexes). Do NOT use when: the whole layer shares one style — use photoshop_set_text_style. Do NOT split into extra layers for mixed type unless this tool errors.
Returns: JSON { ok, summary, details: { style, ranges } }. Preconditions: active text layer. Unspecified gaps keep the layer default style. Side effects: rewrites character styles; restores tracking/leading/box afterward.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ranges | Yes | Non-overlapping character spans (from inclusive, to exclusive) | |
| document_id | No | Optional Photoshop document id from photoshop_get_state / photoshop_list_documents. When set, the tool activates that document before running so a UI tab switch cannot retarget the edit. |