diff options
| author | Birk Tjelmeland <git@birktj.no> | 2023-04-13 16:05:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-13 16:05:56 +0200 |
| commit | d1cd814ef8149cbac6e59c81e074aa59c930eed3 (patch) | |
| tree | 02b9a8afed4d121b34d89669452f91cda19df8e2 /tests/typ/visualize/stroke.typ | |
| parent | 46ce9c94e3f615751989d3cba5aa1599e0ba5913 (diff) | |
Add support for more complex strokes (#505)
Diffstat (limited to 'tests/typ/visualize/stroke.typ')
| -rw-r--r-- | tests/typ/visualize/stroke.typ | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/typ/visualize/stroke.typ b/tests/typ/visualize/stroke.typ new file mode 100644 index 00000000..2443d27a --- /dev/null +++ b/tests/typ/visualize/stroke.typ @@ -0,0 +1,71 @@ +// Test lines. + +--- +// Some simple test lines + +#line(length: 60pt, stroke: red) +#v(3pt) +#line(length: 60pt, stroke: 2pt) +#v(3pt) +#line(length: 60pt, stroke: blue + 1.5pt) +#v(3pt) +#line(length: 60pt, stroke: (color: red, thickness: 1pt, dash: "dashed")) +#v(3pt) +#line(length: 60pt, stroke: (color: red, thickness: 4pt, cap: "round")) + +--- +// Set rules with stroke + +#set line(stroke: (color: red, thickness: 1pt, cap: "butt", dash: "dashdotted")) + +#line(length: 60pt) +#v(3pt) +#line(length: 60pt, stroke: blue) +#v(3pt) +#line(length: 60pt, stroke: (dash: none)) + +--- +// Rectangle strokes + +#rect(width: 20pt, height: 20pt, stroke: red) +#v(3pt) +#rect(width: 20pt, height: 20pt, stroke: (rest: red, top: (color: blue, dash: "dashed"))) +#v(3pt) +#rect(width: 20pt, height: 20pt, stroke: (thickness: 5pt, join: "round")) + +--- +// Dashing +#line(length: 60pt, stroke: (color: red, thickness: 1pt, dash: ("dot", 1pt))) +#v(3pt) +#line(length: 60pt, stroke: (color: red, thickness: 1pt, dash: ("dot", 1pt, 4pt, 2pt))) +#v(3pt) +#line(length: 60pt, stroke: (color: red, thickness: 1pt, dash: (array: ("dot", 1pt, 4pt, 2pt), phase: 5pt))) +#v(3pt) +#line(length: 60pt, stroke: (color: red, thickness: 1pt, dash: ())) +#v(3pt) +#line(length: 60pt, stroke: (color: red, thickness: 1pt, dash: (1pt, 3pt, 9pt))) + +--- +// Line joins +#stack(dir: ltr, + polygon(stroke: (thickness: 4pt, color: blue, join: "round"), + (0pt, 20pt), (15pt, 0pt), (0pt, 40pt), (15pt, 45pt)), + h(1em), + polygon(stroke: (thickness: 4pt, color: blue, join: "bevel"), + (0pt, 20pt), (15pt, 0pt), (0pt, 40pt), (15pt, 45pt)), + h(1em), + polygon(stroke: (thickness: 4pt, color: blue, join: "miter"), + (0pt, 20pt), (15pt, 0pt), (0pt, 40pt), (15pt, 45pt)), + h(1em), + polygon(stroke: (thickness: 4pt, color: blue, join: "miter", miter-limit: 20.0), + (0pt, 20pt), (15pt, 0pt), (0pt, 40pt), (15pt, 45pt)), +) +--- + +// Error: 29-56 unexpected key "thicknes", valid keys are "color", "thickness", "cap", "join", "dash", and "miter-limit" +#line(length: 60pt, stroke: (color: red, thicknes: 1pt)) + +--- + +// Error: 29-55 expected "solid", "dotted", "densely-dotted", "loosely-dotted", "dashed", "densely-dashed", "loosely-dashed", "dashdotted", "densely-dashdotted", "loosely-dashdotted", array, dictionary, dash pattern, or none +#line(length: 60pt, stroke: (color: red, dash: "dash")) |
