summaryrefslogtreecommitdiff
path: root/test/svg
diff options
context:
space:
mode:
Diffstat (limited to 'test/svg')
-rw-r--r--test/svg/image.svg9
-rw-r--r--test/svg/typst-image.typ6
2 files changed, 15 insertions, 0 deletions
diff --git a/test/svg/image.svg b/test/svg/image.svg
new file mode 100644
index 0000000..f5a5d8e
--- /dev/null
+++ b/test/svg/image.svg
@@ -0,0 +1,9 @@
+<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">
+ <!-- SVG documents as data-URI images (how Typst places an SVG or a PDF
+ page): placed, stretched or fitted into their boxes, with their own ids
+ and gradients, and an id the outer document also uses. -->
+ <defs><radialGradient id="g"><stop offset="0" stop-color="#58c4dd"/><stop offset="1" stop-color="#9a72ac"/></radialGradient></defs>
+ <rect x="150" y="10" width="40" height="80" fill="url(#g)"/>
+ <image x="10" y="10" width="40" height="80" xlink:href="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHdpZHRoPSI0MHB0IiBoZWlnaHQ9IjQwcHQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgo8ZGVmcz48cmFkaWFsR3JhZGllbnQgaWQ9ImciPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2Y3ZDk2ZiIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2ZjNjI1NSIvPjwvcmFkaWFsR3JhZGllbnQ+CjxzeW1ib2wgaWQ9ImxlYWYiIG92ZXJmbG93PSJ2aXNpYmxlIj48cGF0aCBkPSJNMCAwIEM4IC04IDE2IC04IDIwIDAgQzE2IDggOCA4IDAgMFoiLz48L3N5bWJvbD48L2RlZnM+CjxjaXJjbGUgY3g9IjIwIiBjeT0iMjAiIHI9IjE4IiBmaWxsPSJ1cmwoI2cpIi8+Cjx1c2UgeGxpbms6aHJlZj0iI2xlYWYiIHg9IjEwIiB5PSIyMCIgZmlsbD0iIzgzYzE2NyIvPgo8L3N2Zz4="/>
+ <image x="55" y="20" width="90" height="60" preserveAspectRatio="none" href="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHdpZHRoPSI0MHB0IiBoZWlnaHQ9IjQwcHQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgo8ZGVmcz48cmFkaWFsR3JhZGllbnQgaWQ9ImciPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2Y3ZDk2ZiIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2ZjNjI1NSIvPjwvcmFkaWFsR3JhZGllbnQ+CjxzeW1ib2wgaWQ9ImxlYWYiIG92ZXJmbG93PSJ2aXNpYmxlIj48cGF0aCBkPSJNMCAwIEM4IC04IDE2IC04IDIwIDAgQzE2IDggOCA4IDAgMFoiLz48L3N5bWJvbD48L2RlZnM+CjxjaXJjbGUgY3g9IjIwIiBjeT0iMjAiIHI9IjE4IiBmaWxsPSJ1cmwoI2cpIi8+Cjx1c2UgeGxpbms6aHJlZj0iI2xlYWYiIHg9IjEwIiB5PSIyMCIgZmlsbD0iIzgzYzE2NyIvPgo8L3N2Zz4=" transform="rotate(10 100 50)"/>
+</svg>
diff --git a/test/svg/typst-image.typ b/test/svg/typst-image.typ
new file mode 100644
index 0000000..2c88207
--- /dev/null
+++ b/test/svg/typst-image.typ
@@ -0,0 +1,6 @@
+// An SVG placed by Typst: an <image> with the document as a data URI.
+#set page(width: auto, height: auto, margin: 6pt, fill: none)
+#stack(dir: ltr, spacing: 8pt,
+ image("use.svg", width: 120pt),
+ image("gradients.svg", width: 80pt, height: 60pt, fit: "stretch"),
+)