canvas
canvas(length: length,baseline: nonenumbercoordinate,debug: bool,background: nonecolor,stroke: nonestroke,padding: nonenumberarraydictionary,body: nonearrayelement,) -> content
Sets up a canvas for drawing on.
Used to specify what 1 coordinate unit is. Note that ratios are no longer supported! You can wrap the canvas into a layout(ly => canvas(length: ly.width * <ratio>, ...))
.
baseline:
none
Specifies the coordinate to use as the baseline. Setting this the canvas behaves like a box
element instead of a block
.
A code block in which functions from the draw
module have been called.
Stroke style to apply to the canvas top-level element (box or block)
padding:
none
How much padding to add to the canvas. none
applies no padding. A number applies padding to all sides equally. A dictionary applies padding following Typst's pad
function: https://typst.app/docs/reference/layout/pad/. An array follows CSS like padding: (y, x)
, (top, x, bottom)
or (top, right, bottom, left)
.