diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-12-15 20:27:41 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-12-15 20:27:41 +0100 |
| commit | 2a3d0f4b390457174ed09347dd29e97ff9a783e4 (patch) | |
| tree | 0e0634bff6b7f64131267f4cbe05651c1c91d900 /tests/typ/layout | |
| parent | 244ad386ec271ff86a2101eb4cc38d37a55552b9 (diff) | |
Set Rules Episode VII: The Set Awakens
Diffstat (limited to 'tests/typ/layout')
| -rw-r--r-- | tests/typ/layout/align.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/aspect.typ | 10 | ||||
| -rw-r--r-- | tests/typ/layout/background.typ | 4 | ||||
| -rw-r--r-- | tests/typ/layout/containers.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/grid-1.typ | 4 | ||||
| -rw-r--r-- | tests/typ/layout/grid-2.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/grid-3.typ | 10 | ||||
| -rw-r--r-- | tests/typ/layout/grid-4.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/grid-5.typ | 4 | ||||
| -rw-r--r-- | tests/typ/layout/pad.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/page.typ | 28 | ||||
| -rw-r--r-- | tests/typ/layout/pagebreak.typ | 12 | ||||
| -rw-r--r-- | tests/typ/layout/placed.typ | 4 | ||||
| -rw-r--r-- | tests/typ/layout/spacing.typ | 4 | ||||
| -rw-r--r-- | tests/typ/layout/stack-1.typ | 12 | ||||
| -rw-r--r-- | tests/typ/layout/stack-2.typ | 6 | ||||
| -rw-r--r-- | tests/typ/layout/transform.typ | 6 |
17 files changed, 57 insertions, 57 deletions
diff --git a/tests/typ/layout/align.typ b/tests/typ/layout/align.typ index 13b88ac1..09c4dee5 100644 --- a/tests/typ/layout/align.typ +++ b/tests/typ/layout/align.typ @@ -1,7 +1,7 @@ // Test alignment. --- -#page(height: 100pt) +#set page(height: 100pt) #stack(dir: ltr, align(left, square(size: 15pt, fill: eastern)), align(center, square(size: 20pt, fill: eastern)), diff --git a/tests/typ/layout/aspect.typ b/tests/typ/layout/aspect.typ index c9b8ee41..2c3e9b0c 100644 --- a/tests/typ/layout/aspect.typ +++ b/tests/typ/layout/aspect.typ @@ -3,14 +3,14 @@ --- // Test relative width and height and size that is smaller // than default size. -#page(width: 120pt, height: 70pt) +#set page(width: 120pt, height: 70pt) #square(width: 50%, align(bottom)[A]) #square(height: 50%) #box(stack(square(size: 10pt), 5pt, square(size: 10pt, [B]))) --- // Test alignment in automatically sized square and circle. -#font(8pt) +#set text(8pt) #square(padding: 4pt)[ Hey there, #align(center + bottom, rotate(180deg, [you!])) ] @@ -23,19 +23,19 @@ --- // Test square that is limited by region size. -#page(width: 20pt, height: 10pt, margins: 0pt) +#set page(width: 20pt, height: 10pt, margins: 0pt) #stack(dir: ltr, square(fill: forest), square(fill: conifer)) --- // Test different ways of sizing. -#page(width: 120pt, height: 40pt) +#set page(width: 120pt, height: 40pt) #circle(radius: 5pt) #circle(width: 10%) #circle(height: 50%) --- // Test square that is overflowing due to its aspect ratio. -#page(width: 40pt, height: 20pt, margins: 5pt) +#set page(width: 40pt, height: 20pt, margins: 5pt) #square(width: 100%) #square(width: 100%)[Hello] diff --git a/tests/typ/layout/background.typ b/tests/typ/layout/background.typ index f55262b2..f64bf0ee 100644 --- a/tests/typ/layout/background.typ +++ b/tests/typ/layout/background.typ @@ -1,8 +1,8 @@ // Test placing a background image on a page. --- -#page(paper: "a10", flipped: true) -#font(fill: white) +#set page(paper: "a10", flipped: true) +#set text(fill: white) #place( dx: -10pt, dy: -10pt, diff --git a/tests/typ/layout/containers.typ b/tests/typ/layout/containers.typ index d4556a0f..14258c1e 100644 --- a/tests/typ/layout/containers.typ +++ b/tests/typ/layout/containers.typ @@ -12,7 +12,7 @@ Apart --- // Test block over multiple pages. -#page(height: 60pt) +#set page(height: 60pt) First! #block[ diff --git a/tests/typ/layout/grid-1.typ b/tests/typ/layout/grid-1.typ index 647e366f..a6596c98 100644 --- a/tests/typ/layout/grid-1.typ +++ b/tests/typ/layout/grid-1.typ @@ -3,7 +3,7 @@ --- #let cell(width, color) = rect(width: width, height: 2cm, fill: color) -#page(width: 100pt, height: 140pt) +#set page(width: 100pt, height: 140pt) #grid( columns: (auto, 1fr, 3fr, 0.25cm, 3%, 2mm + 10%), cell(0.5cm, rgb("2a631a")), @@ -31,7 +31,7 @@ ) --- -#page(height: 3cm, margins: 0pt) +#set page(height: 3cm, margins: 0pt) #grid( columns: (1fr,), rows: (1fr, auto, 2fr), diff --git a/tests/typ/layout/grid-2.typ b/tests/typ/layout/grid-2.typ index c522a402..7df64a56 100644 --- a/tests/typ/layout/grid-2.typ +++ b/tests/typ/layout/grid-2.typ @@ -1,7 +1,7 @@ // Test using the `grid` function to create a finance table. --- -#page(width: 12cm, height: 2.5cm) +#set page(width: 12cm, height: 2.5cm) #grid( columns: 5, column-gutter: (2fr, 1fr, 1fr), diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ index 6f7f6977..8d04722e 100644 --- a/tests/typ/layout/grid-3.typ +++ b/tests/typ/layout/grid-3.typ @@ -1,7 +1,7 @@ // Test grid cells that overflow to the next region. --- -#page(width: 5cm, height: 3cm) +#set page(width: 5cm, height: 3cm) #grid( columns: 2, row-gutter: 8pt, @@ -18,7 +18,7 @@ --- // Test a column that starts overflowing right after another row/column did // that. -#page(width: 5cm, height: 2cm) +#set page(width: 5cm, height: 2cm) #grid( columns: 4 * (1fr,), row-gutter: 10pt, @@ -32,7 +32,7 @@ --- // Test two columns in the same row overflowing by a different amount. -#page(width: 5cm, height: 2cm) +#set page(width: 5cm, height: 2cm) #grid( columns: 3 * (1fr,), row-gutter: 8pt, @@ -48,7 +48,7 @@ --- // Test grid within a grid, overflowing. -#page(width: 5cm, height: 2.25cm) +#set page(width: 5cm, height: 2.25cm) #grid( columns: 4 * (1fr,), row-gutter: 10pt, @@ -62,7 +62,7 @@ --- // Test partition of `fr` units before and after multi-region layout. -#page(width: 5cm, height: 4cm) +#set page(width: 5cm, height: 4cm) #grid( columns: 2 * (1fr,), rows: (1fr, 2fr, auto, 1fr, 1cm), diff --git a/tests/typ/layout/grid-4.typ b/tests/typ/layout/grid-4.typ index d6aa6358..e02d98c5 100644 --- a/tests/typ/layout/grid-4.typ +++ b/tests/typ/layout/grid-4.typ @@ -23,7 +23,7 @@ --- // Test that all three kinds of rows use the correct bases. -#page(height: 4cm, margins: 0cm) +#set page(height: 4cm, margins: 0cm) #grid( rows: (1cm, 1fr, 1fr, auto), rect(height: 50%, width: 100%, fill: conifer), diff --git a/tests/typ/layout/grid-5.typ b/tests/typ/layout/grid-5.typ index 585fc6ce..db7c525a 100644 --- a/tests/typ/layout/grid-5.typ +++ b/tests/typ/layout/grid-5.typ @@ -1,7 +1,7 @@ --- // Test that trailing linebreak doesn't overflow the region. -#page(height: 2cm) +#set page(height: 2cm) #grid[ Hello \ Hello \ @@ -12,7 +12,7 @@ --- // Test that broken cell expands vertically. -#page(height: 2.25cm) +#set page(height: 2.25cm) #grid( columns: 2, gutter: 10pt, diff --git a/tests/typ/layout/pad.typ b/tests/typ/layout/pad.typ index 1fa0f79d..502137ec 100644 --- a/tests/typ/layout/pad.typ +++ b/tests/typ/layout/pad.typ @@ -19,7 +19,7 @@ Hi #box(pad(left: 10pt)[A]) there --- // Test that the pad node doesn't consume the whole region. -#page(height: 6cm) +#set page(height: 6cm) #align(left)[Before] #pad(10pt, image("../../res/tiger.jpg")) #align(right)[After] diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ index 3dad26c8..35f338f4 100644 --- a/tests/typ/layout/page.typ +++ b/tests/typ/layout/page.typ @@ -2,33 +2,33 @@ --- // Set width and height. -#page(width: 80pt, height: 80pt) -[#page(width: 40pt) High] -[#page(height: 40pt) Wide] +#set page(width: 80pt, height: 80pt) +[#set page(width: 40pt);High] +[#set page(height: 40pt);Wide] // Set all margins at once. [ - #page(margins: 5pt) + #set page(margins: 5pt) #place(top + left)[TL] #place(bottom + right)[BR] ] // Set individual margins. -#page(height: 40pt) -[#page(left: 0pt) #align(left)[Left]] -[#page(right: 0pt) #align(right)[Right]] -[#page(top: 0pt) #align(top)[Top]] -[#page(bottom: 0pt) #align(bottom)[Bottom]] +#set page(height: 40pt) +[#set page(left: 0pt); #align(left)[Left]] +[#set page(right: 0pt); #align(right)[Right]] +[#set page(top: 0pt); #align(top)[Top]] +[#set page(bottom: 0pt); #align(bottom)[Bottom]] // Ensure that specific margins override general margins. -[#page(margins: 0pt, left: 20pt) Overriden] +[#set page(margins: 0pt, left: 20pt); Overriden] // Flipped predefined paper. -[#page(paper: "a11", flipped: true) Flipped A11] +[#set page(paper: "a11", flipped: true);Flipped A11] --- -#page(width: 80pt, height: 40pt, fill: eastern) -#font(15pt, "Roboto", fill: white, smallcaps: true)[Typst] +#set page(width: 80pt, height: 40pt, fill: eastern) +#text(15pt, "Roboto", fill: white, smallcaps: true)[Typst] -#page(width: 40pt, fill: none, margins: auto, top: 10pt) +#set page(width: 40pt, fill: none, margins: auto, top: 10pt) Hi diff --git a/tests/typ/layout/pagebreak.typ b/tests/typ/layout/pagebreak.typ index e0ffc92e..9a74d2bf 100644 --- a/tests/typ/layout/pagebreak.typ +++ b/tests/typ/layout/pagebreak.typ @@ -3,7 +3,7 @@ --- First of two #pagebreak() -#page(height: 40pt) +#set page(height: 40pt) Second of two --- @@ -12,7 +12,7 @@ A #box[ B #pagebreak() - #page("a4") + #set page("a4") ] C @@ -23,13 +23,13 @@ D --- // Test a combination of pages with bodies and normal content. -#page(width: 80pt, height: 30pt) +#set page(width: 80pt, height: 30pt) -Fi[#page(width: 80pt)rst] -[#page(width: 70pt) Second] +Fi[#set page(width: 80pt);rst] +[#set page(width: 70pt); Second] #pagebreak() #pagebreak() Fourth #page(height: 20pt)[] Sixth -[#page() Seventh] +[#set page(); Seventh] diff --git a/tests/typ/layout/placed.typ b/tests/typ/layout/placed.typ index 017cdc20..527e0559 100644 --- a/tests/typ/layout/placed.typ +++ b/tests/typ/layout/placed.typ @@ -1,7 +1,7 @@ // Test the `place` function. --- -#page("a8") +#set page("a8") #place(bottom + center)[© Typst] = Placement @@ -26,7 +26,7 @@ the line breaks still had to be inserted manually. --- // Test how the placed node interacts with paragraph spacing around it. -#page("a8", height: 60pt) +#set page("a8", height: 60pt) First diff --git a/tests/typ/layout/spacing.typ b/tests/typ/layout/spacing.typ index 78b778c5..98a6100c 100644 --- a/tests/typ/layout/spacing.typ +++ b/tests/typ/layout/spacing.typ @@ -20,8 +20,8 @@ Add #h(10pt) #h(10pt) up --- // Test that spacing has style properties. -A[#par(align: right)#h(1cm)]B -[#page(height: 20pt)#v(1cm)] +A[#set par(align: right);#h(1cm)]B +[#set page(height: 20pt);#v(1cm)] B --- diff --git a/tests/typ/layout/stack-1.typ b/tests/typ/layout/stack-1.typ index 02083d2b..a4a0d6b8 100644 --- a/tests/typ/layout/stack-1.typ +++ b/tests/typ/layout/stack-1.typ @@ -15,13 +15,13 @@ #let items = for w in widths { (align(right, shaded(w)),) } -#page(width: 50pt, margins: 0pt) +#set page(width: 50pt, margins: 0pt) #stack(dir: btt, ..items) --- // Test RTL alignment. -#page(width: 50pt, margins: 5pt) -#font(8pt) +#set page(width: 50pt, margins: 5pt) +#set text(8pt) #stack(dir: rtl, align(center, [A]), align(left, [B]), @@ -30,8 +30,8 @@ --- // Test spacing. -#page(width: 50pt, margins: 0pt) -#par(spacing: 5pt) +#set page(width: 50pt, margins: 0pt) +#set par(spacing: 5pt) #let x = square(size: 10pt, fill: eastern) #stack(dir: rtl, spacing: 5pt, x, x, x) @@ -40,7 +40,7 @@ --- // Test overflow. -#page(width: 50pt, height: 30pt, margins: 0pt) +#set page(width: 50pt, height: 30pt, margins: 0pt) #box(stack( rect(width: 40pt, height: 20pt, fill: conifer), rect(width: 30pt, height: 13pt, fill: forest), diff --git a/tests/typ/layout/stack-2.typ b/tests/typ/layout/stack-2.typ index 2167f48f..f88f7a58 100644 --- a/tests/typ/layout/stack-2.typ +++ b/tests/typ/layout/stack-2.typ @@ -1,7 +1,7 @@ // Test fr units in stacks. --- -#page(height: 3.5cm) +#set page(height: 3.5cm) #stack( dir: ltr, spacing: 1fr, @@ -15,8 +15,8 @@ from #h(1fr) the #h(1fr) wonderful World! 🌍 --- -#page(height: 2cm) -#font(white) +#set page(height: 2cm) +#set text(white) #rect(fill: forest)[ #v(1fr) #h(1fr) Hi you! #h(5pt) diff --git a/tests/typ/layout/transform.typ b/tests/typ/layout/transform.typ index 5b1fa2a1..82ee1390 100644 --- a/tests/typ/layout/transform.typ +++ b/tests/typ/layout/transform.typ @@ -23,13 +23,13 @@ [X] } -#font("Latin Modern Math", size) +#set text("Latin Modern Math", size) Neither #tex, \ nor #xetex! --- // Test combination of scaling and rotation. -#page(height: 80pt) +#set page(height: 80pt) #align(center + horizon, rotate(20deg, scale(70%, image("../../res/tiger.jpg"))) ) @@ -43,7 +43,7 @@ nor #xetex! --- // Test setting scaling origin. #let r = rect(width: 100pt, height: 10pt, fill: forest) -#page(height: 65pt) +#set 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) |
