summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-23 22:04:08 +0100
committerLaurenz <laurmaedje@gmail.com>2021-11-23 22:04:08 +0100
commit8a88f71cb11565c1a78bd57f02a8df17cb2bf7a0 (patch)
tree8802c1ff48e2be118e3872d25bd2f2c1f7a21b4a /tests/typ
parentc77c5a0f0ae6560a03a85e847006c29de9c7ae62 (diff)
Transformations
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/layout/move.typ11
-rw-r--r--tests/typ/layout/transform.typ49
-rw-r--r--tests/typ/text/links.typ6
3 files changed, 55 insertions, 11 deletions
diff --git a/tests/typ/layout/move.typ b/tests/typ/layout/move.typ
deleted file mode 100644
index c1f97e15..00000000
--- a/tests/typ/layout/move.typ
+++ /dev/null
@@ -1,11 +0,0 @@
-#let size = 11pt
-#let tex = [{
- [T]
- h(-0.14 * size)
- move(y: 0.22 * size)[E]
- h(-0.12 * size)
- [X]
-}]
-
-#font("Latin Modern Math", size)
-Not #tex!
diff --git a/tests/typ/layout/transform.typ b/tests/typ/layout/transform.typ
new file mode 100644
index 00000000..5b1fa2a1
--- /dev/null
+++ b/tests/typ/layout/transform.typ
@@ -0,0 +1,49 @@
+// Test transformations.
+
+---
+// Test creating the TeX and XeTeX logos.
+#let size = 11pt
+#let tex = [{
+ [T]
+ h(-0.14 * size)
+ move(y: 0.22 * size)[E]
+ h(-0.12 * size)
+ [X]
+}]
+
+#let xetex = {
+ [X]
+ h(-0.14 * size)
+ scale(x: -100%, move(y: 0.26 * size)[E])
+ h(-0.14 * size)
+ [T]
+ h(-0.14 * size)
+ move(y: 0.26 * size)[E]
+ h(-0.12 * size)
+ [X]
+}
+
+#font("Latin Modern Math", size)
+Neither #tex, \
+nor #xetex!
+
+---
+// Test combination of scaling and rotation.
+#page(height: 80pt)
+#align(center + horizon,
+ rotate(20deg, scale(70%, image("../../res/tiger.jpg")))
+)
+
+---
+// Test setting rotation origin.
+#rotate(10deg, origin: top + left,
+ image("../../res/tiger.jpg", width: 50%)
+)
+
+---
+// Test setting scaling origin.
+#let r = rect(width: 100pt, height: 10pt, fill: forest)
+#page(height: 65pt)
+#scale(r, x: 50%, y: 200%, origin: left + top)
+#scale(r, x: 50%, origin: center)
+#scale(r, x: 50%, y: 200%, origin: right + bottom)
diff --git a/tests/typ/text/links.typ b/tests/typ/text/links.typ
index bea5f93e..e5f7affc 100644
--- a/tests/typ/text/links.typ
+++ b/tests/typ/text/links.typ
@@ -14,3 +14,9 @@ Contact #link("mailto:hi@typst.app") or call #link("tel:123") for more informati
// Styled with underline and color.
#let link(url, body) = link(url, font(fill: rgb("283663"), underline(body)))
You could also make the #link("https://html5zombo.com/")[link look way more typical.]
+
+---
+// Transformed link.
+#page(height: 60pt)
+#let link = link("https://typst.app/")[LINK]
+My cool #move(x: 0.7cm, y: 0.7cm, rotate(10deg, scale(200%, link)))