Measure text
measure_textMeasure text as the renderer lays it out: each line and its width, the height, and whether the last line is a widow; or, with width and fit_height, the largest font size that fits that box. With page_id and layer_id it measures that text layer as styled. texts measures many at once, and pack lays them out as chips in rows and returns each chip's box. Read-only; it changes nothing. Use it before placing or sizing text instead of guessing; for text already overflowing in a design use check_layout.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pack | No | With `texts`: lay them out as pills or chips packed in rows with no overlaps, and return each one's box (x, y, width, height) ready for create_layers. | |
| runs | No | Text in differently styled runs, as create_layers takes them (mixed families or weights), in place of `text`. | |
| text | No | The text to measure (or give `texts`). | |
| wrap | No | Line breaks as create_layers `wrap` sets them: "normal", "balance" or "pretty" (a stored layer keeps its own unless given). | |
| texts | No | Measure many texts in one call (same font, size and width); the result lists each one's width, height and lines. | |
| width | No | Wrap within this width (px); one line when omitted. | |
| intent | No | Optional: a few words on why. | |
| page_id | No | The page to work on, as returned by create_design. | |
| layer_id | No | ||
| max_size | No | ||
| min_size | No | ||
| font_size | No | Measure at this size (px). | |
| fit_height | No | Instead of measuring, find the largest size in [min_size, max_size] whose text fits `width` x `fit_height`. | |
| font_style | No | "Regular", "Bold"... | |
| font_family | No | ||
| line_height | No | line_height like create_layers ("120%", "auto", or px). | |
| letter_spacing | No | letter_spacing like create_layers: px number or a percentage of the font size like "-3%". | |
| min_last_line_words | No | Fewest words a wrapped paragraph may end on, as create_layers takes it. |