Development build 586e1bd4
Typst文档简体中文版v0.15.1 + dev 586e1bd4

polygon元素
Question mark
0.1.0起可用Go to source

A closed polygon.

The polygon is defined by its corner points and is closed automatically.

Example

#polygon( fill: blue.lighten(80%), stroke: blue, (20%, 0pt), (60%, 0pt), (80%, 2cm), (0%, 2cm), )

参数
Question mark

fill
none or color or gradient or tiling
可用set规则
Question mark
默认值:none

How to fill the polygon.

When setting a fill, the default stroke disappears. To create a rectangle with both fill and stroke, you have to configure both.

fill-rule
str
可用set规则
Question mark
默认值:"non-zero"

The drawing rule used to fill the polygon.

See the curve documentation for an example.

VariantDetails
"non-zero"Specifies that “inside” is computed by a non-zero sum of signed edge crossings.
"even-odd"Specifies that “inside” is computed by an odd number of edge crossings.

stroke
none or auto or length or color or gradient or stroke or tiling or dictionary
可用set规则
Question mark
默认值:auto

How to stroke the polygon.

Can be set to none to disable the stroke or to auto for a stroke of 1pt black if and only if no fill is given.

vertices
array
必需参数
Question mark
位置参数
Question mark
变长参数
Question mark

The vertices of the polygon. Each point is specified as an array of two relative lengths.

定义
Question mark

regular0.8.0起可用Go to source

A regular polygon, defined by its size and number of vertices.

Expand展开示例
#polygon.regular( fill: blue.lighten(80%), stroke: blue, size: 30pt, vertices: 3, )

fill

How to fill the polygon. See the general polygon’s documentation for more details.

stroke

How to stroke the polygon. See the general polygon’s documentation for more details.

size默认值:1em

The diameter of the circumcircle of the regular polygon.

vertices默认值:3

The number of vertices in the polygon.