diff options
Diffstat (limited to 'test/svg')
| -rw-r--r-- | test/svg/dashes.svg | 6 | ||||
| -rw-r--r-- | test/svg/fill-rules.svg | 6 | ||||
| -rw-r--r-- | test/svg/gradients.svg | 16 | ||||
| -rw-r--r-- | test/svg/opacity.svg | 7 | ||||
| -rw-r--r-- | test/svg/paths.svg | 8 | ||||
| -rw-r--r-- | test/svg/shapes.svg | 8 | ||||
| -rw-r--r-- | test/svg/strokes.svg | 11 | ||||
| -rw-r--r-- | test/svg/transforms.svg | 13 | ||||
| -rw-r--r-- | test/svg/typst-equation.typ | 3 | ||||
| -rw-r--r-- | test/svg/typst-shapes.typ | 8 | ||||
| -rw-r--r-- | test/svg/typst-text.typ | 5 | ||||
| -rw-r--r-- | test/svg/use.svg | 11 |
12 files changed, 102 insertions, 0 deletions
diff --git a/test/svg/dashes.svg b/test/svg/dashes.svg new file mode 100644 index 0000000..ebd9ce6 --- /dev/null +++ b/test/svg/dashes.svg @@ -0,0 +1,6 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 120" width="200" height="120"> + <line x1="10" y1="20" x2="190" y2="20" stroke="#58c4dd" stroke-width="6" stroke-dasharray="20 10"/> + <line x1="10" y1="45" x2="190" y2="45" stroke="#83c167" stroke-width="6" stroke-dasharray="5" stroke-dashoffset="3"/> + <circle cx="60" cy="85" r="28" fill="none" stroke="#fc6255" stroke-width="5" stroke-dasharray="12 6 2 6"/> + <rect x="120" y="60" width="60" height="50" fill="none" stroke="#f7d96f" stroke-width="4" stroke-dasharray="15 5" stroke-linecap="round"/> +</svg> diff --git a/test/svg/fill-rules.svg b/test/svg/fill-rules.svg new file mode 100644 index 0000000..af0e3b8 --- /dev/null +++ b/test/svg/fill-rules.svg @@ -0,0 +1,6 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 220 110" width="220" height="110"> + <!-- The same self-intersecting star and nested squares under both rules. --> + <path d="M55 5 L85 95 L10 40 L100 40 L25 95 Z" fill="#fc6255" fill-rule="nonzero"/> + <path d="M165 5 L195 95 L120 40 L210 40 L135 95 Z" fill="#fc6255" fill-rule="evenodd"/> + <path d="M5 100 h40 v8 h-40z M15 102 h20 v4 h-20z" fill="#58c4dd" fill-rule="evenodd"/> +</svg> diff --git a/test/svg/gradients.svg b/test/svg/gradients.svg new file mode 100644 index 0000000..a5f2c81 --- /dev/null +++ b/test/svg/gradients.svg @@ -0,0 +1,16 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 240 160" width="240" height="160"> + <defs> + <linearGradient id="lin"><stop offset="0" stop-color="#58c4dd"/><stop offset="1" stop-color="#fc6255"/></linearGradient> + <linearGradient id="diag" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#f7d96f"/><stop offset="50%" stop-color="#83c167"/><stop offset="100%" stop-color="#1c1c1f"/></linearGradient> + <linearGradient id="user" gradientUnits="userSpaceOnUse" x1="10" y1="0" x2="60" y2="0" spreadMethod="reflect"><stop offset="0" stop-color="#ece6e2"/><stop offset="1" stop-color="#9a72ac"/></linearGradient> + <linearGradient id="derived" xlink:href="#lin" gradientTransform="rotate(90 0.5 0.5)"/> + <radialGradient id="rad"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#58c4dd" stop-opacity="0.2"/></radialGradient> + <radialGradient id="focus" cx="0.5" cy="0.5" r="0.5" fx="0.3" fy="0.3"><stop offset="0" stop-color="#f7d96f"/><stop offset="1" stop-color="#c55f73"/></radialGradient> + </defs> + <rect x="10" y="10" width="100" height="40" fill="url(#lin)"/> + <rect x="130" y="10" width="100" height="60" fill="url(#diag)"/> + <rect x="10" y="60" width="110" height="30" fill="url(#user)"/> + <rect x="10" y="100" width="50" height="50" fill="url(#derived)"/> + <circle cx="110" cy="125" r="30" fill="url(#rad)"/> + <ellipse cx="190" cy="115" rx="40" ry="35" fill="url(#focus)" stroke="url(#lin)" stroke-width="4"/> +</svg> diff --git a/test/svg/opacity.svg b/test/svg/opacity.svg new file mode 100644 index 0000000..c0d0b8a --- /dev/null +++ b/test/svg/opacity.svg @@ -0,0 +1,7 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 120" width="200" height="120"> + <rect x="10" y="10" width="80" height="80" fill="#58c4dd"/> + <circle cx="90" cy="60" r="40" fill="#fc6255" fill-opacity="0.5"/> + <circle cx="150" cy="60" r="40" fill="#83c167" opacity="0.4" stroke="#ece6e2" stroke-width="8" stroke-opacity="0.8"/> + <g opacity="0.6"><rect x="20" y="95" width="160" height="15" fill="#f7d96f"/></g> + <rect x="120" y="20" width="60" height="20" style="fill: rgb(154, 114, 172); fill-opacity: 70%"/> +</svg> diff --git a/test/svg/paths.svg b/test/svg/paths.svg new file mode 100644 index 0000000..173ec9e --- /dev/null +++ b/test/svg/paths.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 120" width="200" height="120"> + <!-- Every path command, absolute and relative, with implicit repeats. --> + <path d="M10 10 L60 10 l20 20 H120 v30 h-40 Z" fill="#58c4dd"/> + <path d="M140 10 C160 0 190 30 180 50 S150 80 140 60 Q130 40 150 30 T170 20" fill="none" stroke="#fc6255" stroke-width="3"/> + <path d="M20 80 a30 20 0 1 0 60 0 a30 20 0 1 0 -60 0z" fill="#83c167"/> + <path d="M100 110A40 40 0 0 1 180 110" fill="none" stroke="#f7d96f" stroke-width="4"/> + <path d="M100,70 l10-10 10,10-10,10z" fill="#9a72ac"/> +</svg> diff --git a/test/svg/shapes.svg b/test/svg/shapes.svg new file mode 100644 index 0000000..07aa01a --- /dev/null +++ b/test/svg/shapes.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 140" width="240" height="140"> + <rect x="10" y="10" width="60" height="40" fill="#58c4dd"/> + <rect x="80" y="10" width="60" height="40" rx="12" fill="#83c167" stroke="#ece6e2" stroke-width="3"/> + <rect x="150" y="10" width="80" height="40" rx="30" ry="10" fill="#9a72ac"/> + <circle cx="40" cy="95" r="30" fill="#fc6255"/> + <ellipse cx="120" cy="95" rx="40" ry="20" fill="#f7d96f"/> + <polygon points="180,70 230,90 210,130 170,120" fill="#5cd0b3" stroke="#1c1c1f" stroke-width="2"/> +</svg> diff --git a/test/svg/strokes.svg b/test/svg/strokes.svg new file mode 100644 index 0000000..6a25a16 --- /dev/null +++ b/test/svg/strokes.svg @@ -0,0 +1,11 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 160" width="240" height="160"> + <!-- Joins, caps, miter limits and thin lines. --> + <polyline points="10,50 40,10 70,50" fill="none" stroke="#58c4dd" stroke-width="10" stroke-linejoin="miter"/> + <polyline points="90,50 120,10 150,50" fill="none" stroke="#83c167" stroke-width="10" stroke-linejoin="round"/> + <polyline points="170,50 200,10 230,50" fill="none" stroke="#f7d96f" stroke-width="10" stroke-linejoin="bevel"/> + <line x1="20" y1="80" x2="220" y2="80" stroke="#fc6255" stroke-width="12" stroke-linecap="butt"/> + <line x1="20" y1="105" x2="220" y2="105" stroke="#fc6255" stroke-width="12" stroke-linecap="round"/> + <line x1="20" y1="130" x2="220" y2="130" stroke="#fc6255" stroke-width="12" stroke-linecap="square"/> + <polyline points="10,150 120,145 230,150" fill="none" stroke="#ece6e2" stroke-width="6" stroke-miterlimit="1"/> + <line x1="10" y1="157" x2="230" y2="157" stroke="#ece6e2" stroke-width="0.5"/> +</svg> diff --git a/test/svg/transforms.svg b/test/svg/transforms.svg new file mode 100644 index 0000000..0eb7756 --- /dev/null +++ b/test/svg/transforms.svg @@ -0,0 +1,13 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 150" width="200" height="150"> + <g transform="translate(50 50)"> + <rect x="-20" y="-20" width="40" height="40" fill="#58c4dd" transform="rotate(30)"/> + </g> + <g transform="translate(140 50) scale(1.5 0.7)"> + <circle r="25" fill="#83c167" stroke="#ece6e2" stroke-width="4"/> + </g> + <rect x="20" y="100" width="40" height="30" fill="#fc6255" transform="skewX(30)"/> + <g transform="matrix(0.8 0.3 -0.3 0.8 130 95)"> + <path d="M0 0 h40 v30 h-40z" fill="#f7d96f"/> + </g> + <rect x="150" y="100" width="30" height="30" fill="#9a72ac" transform="rotate(45 165 115)"/> +</svg> diff --git a/test/svg/typst-equation.typ b/test/svg/typst-equation.typ new file mode 100644 index 0000000..da0c34c --- /dev/null +++ b/test/svg/typst-equation.typ @@ -0,0 +1,3 @@ +#set page(width: auto, height: auto, margin: 6pt, fill: none) +#set text(fill: rgb("#ece6e2"), size: 28pt) +$ integral_0^infinity e^(-x^2) dif x = sqrt(pi) / 2 $ diff --git a/test/svg/typst-shapes.typ b/test/svg/typst-shapes.typ new file mode 100644 index 0000000..b9bcdff --- /dev/null +++ b/test/svg/typst-shapes.typ @@ -0,0 +1,8 @@ +#set page(width: auto, height: auto, margin: 6pt, fill: none) +#stack(dir: ltr, spacing: 8pt, + rect(width: 60pt, height: 30pt, stroke: 2pt + red, fill: blue, radius: 5pt), + circle(radius: 16pt, fill: gradient.linear(red, blue)), + circle(radius: 16pt, fill: gradient.radial(yellow, purple)), + line(length: 60pt, stroke: (paint: green, thickness: 3pt, dash: "dashed")), + polygon(fill: teal, stroke: 1pt + white, (0pt, 20pt), (20pt, 0pt), (40pt, 20pt)), +) diff --git a/test/svg/typst-text.typ b/test/svg/typst-text.typ new file mode 100644 index 0000000..ce6281d --- /dev/null +++ b/test/svg/typst-text.typ @@ -0,0 +1,5 @@ +#set page(width: 300pt, height: auto, margin: 6pt, fill: none) +#set text(fill: rgb("#ece6e2"), size: 12pt) += Vector sketches +The quick brown fox jumps over the lazy dog. *Bold*, _italic_, `mono`, and +Unicode: é ß ñ — “quotes” — 1 ≤ 2 → ∞. diff --git a/test/svg/use.svg b/test/svg/use.svg new file mode 100644 index 0000000..5336f01 --- /dev/null +++ b/test/svg/use.svg @@ -0,0 +1,11 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 100" width="200" height="100"> + <!-- Symbols and uses, with style inherited from the use element. --> + <defs> + <symbol id="leaf"><path d="M0 0 C20 -20 40 -20 50 0 C40 20 20 20 0 0Z"/></symbol> + <circle id="dot" r="8"/> + </defs> + <use xlink:href="#leaf" x="10" y="30" fill="#83c167"/> + <use href="#leaf" x="70" y="30" fill="#5cd0b3" transform="rotate(20 95 30)"/> + <g fill="#fc6255"><use href="#dot" x="150" y="30"/><use href="#dot" x="175" y="30" fill="#f7d96f"/></g> + <g color="#58c4dd"><rect x="20" y="60" width="160" height="25" fill="currentColor"/></g> +</svg> |
