Skip to main content
Glama
measure.md1.56 kB
# Measure ## `measure` Measures the layouted size of content. The `measure` function lets you determine the layouted size of content. By default an infinite space is assumed, so the measured dimensions may not necessarily match the final dimensions of the content. If you want to measure in the current layout dimensions, you can combine `measure` and [`layout`]. # Example The same content can have a different size depending on the [context] that it is placed into. In the example below, the `[#content]` is of course bigger when we increase the font size. ```example #let content = [Hello!] #content #set text(14pt) #content ``` For this reason, you can only measure when context is available. ```example #let thing(body) = context { let size = measure(body) [Width of "#body" is #size.width] } #thing[Hey] \ #thing[Welcome] ``` The measure function returns a dictionary with the entries `width` and `height`, both of type [`length`]. ## Parameters ### width The width available to layout the content. Setting this to `{auto}` indicates infinite available width. Note that using the `width` and `height` parameters of this function is different from measuring a sized [`block`] containing the content. In the following example, the former will get the dimensions of the inner content instead of the dimensions of the block. ### height The height available to layout the content. Setting this to `{auto}` indicates infinite available height. ### content *(required)* The content whose size to measure. ## Returns - dictionary

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/FujishigeTemma/typst-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server