Skip to content

$measureText

Measures text.

Usage

$measureText[canvas;text;font;property?]

Parameters

FieldTypeDescriptionRequired
canvasStringThe name of the canvas to measure text in.True
textStringThe text to measure.True
fontStringThe text font.True
property”actualBoundingBoxAscent” | “actualBoundingBoxDescent” | “actualBoundingBoxLeft” | “actualBoundingBoxRight” | “fontBoundingBoxAscent” | “fontBoundingBoxDescent” | “alphabeticBaseline” | “emHeightAscent” | “emHeightDescent” | “width” | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9The result’s property to return.False

Example(s)

No examples for this function.

meow

Raw Info

{
"name": "$measureText",
"description": "Measures text.",
"params": [
{
"name": "canvas",
"description": "The name of the canvas to measure text in.",
"type": "String",
"required": true
},
{
"name": "text",
"description": "The text to measure.",
"type": "String",
"required": true
},
{
"name": "font",
"description": "The text font.",
"type": "String",
"required": true
},
{
"name": "property",
"description": "The result's property to return.",
"type": "\"actualBoundingBoxAscent\" | \"actualBoundingBoxDescent\" | \"actualBoundingBoxLeft\" | \"actualBoundingBoxRight\" | \"fontBoundingBoxAscent\" | \"fontBoundingBoxDescent\" | \"alphabeticBaseline\" | \"emHeightAscent\" | \"emHeightDescent\" | \"width\" | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9",
"required": false,
"enum": {
"0": "actualBoundingBoxAscent",
"1": "actualBoundingBoxDescent",
"2": "actualBoundingBoxLeft",
"3": "actualBoundingBoxRight",
"4": "fontBoundingBoxAscent",
"5": "fontBoundingBoxDescent",
"6": "alphabeticBaseline",
"7": "emHeightAscent",
"8": "emHeightDescent",
"9": "width",
"actualBoundingBoxAscent": 0,
"actualBoundingBoxDescent": 1,
"actualBoundingBoxLeft": 2,
"actualBoundingBoxRight": 3,
"fontBoundingBoxAscent": 4,
"fontBoundingBoxDescent": 5,
"alphabeticBaseline": 6,
"emHeightAscent": 7,
"emHeightDescent": 8,
"width": 9
}
}
],
"usage": "$measureText[canvas;text;font;property?]",
"category": "canvas",
"src": "https://github.com/devlordduck/aoi.canvas/tree/v2/src/functions/canvas/measureText.ts",
"docs": "https://aoicanvas.vercel.app/functions/measuretext"
}