Measure Text Dimensions
text-measureCalculate text dimensions for PDF layout planning. Measure width and height based on font, size, and content to ensure proper text fitting and multi-line formatting.
Instructions
Measure text width and height before rendering.
Returns exact dimensions based on font, font size, and text content. Use this to:
Calculate text width to set proper container sizes
Determine if text will fit in a given space
Plan multi-line layouts by specifying width constraint
Width is measured as single-line natural width. Height accounts for text wrapping when width is specified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Array of text items to measure | |
| font | No | Font specification (default: auto). Built-ins: Helvetica, Times-Roman, Courier. Use a path or URL for custom fonts. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| font | Yes | Font used for measurements | |
| measurements | Yes |