measure_text
Calculates text width, height, and ink extents without rendering, so you can size panels or center labels in one pass.
Instructions
Measure text without drawing it.
Use this to size a panel or centre a label in one shot instead of guessing and re-rendering.
Args: text: The string to measure font: Font name from list_text_fonts, or a path to a .ttf/.otf or bitmap font directory size: Pixel size for TrueType fonts; integer scale factor for bitmap fonts (default 1) letter_spacing: Extra pixels between glyphs (default 0) bold: Faux-bold passes; each grows strokes by 1px (default 0) antialias: Keep greyscale edges instead of hard pixels (default False)
Returns: width, height, advance_width, and the ink extents above/below the baseline.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"text": "<text>",
"font": "<font>"
},
"name": "measure_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | ||
| font | Yes | ||
| size | No | ||
| text | Yes | ||
| antialias | No | ||
| letter_spacing | No |