measure_text
Calculate the pixel dimensions text will occupy before drawing. Use font, size, outline, and shadow options to match the size draw_text produces with antialiasing disabled.
Instructions
Size in pixels that draw_text would paint for this text, without a sprite.
outline_width 0 means no outline, shadow offsets 0, 0 no shadow. Antialiasing can change the size by a pixel, so this matches draw_text with antialias=false.
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>"
},
"name": "measure_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | Thicken the glyphs by 1 px to the right | |
| font | No | Font name from list_fonts (family, 'Family Style' or file name, any case) or an absolute path to a .ttf/.otf/.ttc file; empty = the built-in font | |
| size | No | Font size in pixels (FreeType pixel size) | |
| text | Yes | Text, at most 2000 characters; '\n' starts a new line | |
| shadow_dx | No | Shadow offset to the right | |
| shadow_dy | No | Shadow offset downwards | |
| line_spacing | No | Extra px between lines | |
| outline_width | No | Outline thickness; 0 for none | |
| letter_spacing | No | Extra px between characters |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||