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 | |
| parent | 244ad386ec271ff86a2101eb4cc38d37a55552b9 (diff) | |
Set Rules Episode VII: The Set Awakens
Diffstat (limited to 'tests')
38 files changed, 200 insertions, 198 deletions
diff --git a/tests/typ/code/call.typ b/tests/typ/code/call.typ index 2c16af1c..5736c63b 100644 --- a/tests/typ/code/call.typ +++ b/tests/typ/code/call.typ @@ -5,7 +5,8 @@ // Ref: true // Ommitted space. -[#font(weight:"bold")Bold] +#let f() = {} +[#f()*Bold*] // Call return value of function with body. #let f(x, body) = (y) => [#x] + body + [#y] @@ -44,25 +45,25 @@ } --- -// Error: 2-6 expected function or collection, found boolean +// Error: 2-6 expected callable or collection, found boolean {true()} --- #let x = "x" -// Error: 1-3 expected function or collection, found string +// Error: 1-3 expected callable or collection, found string #x() --- #let f(x) = x -// Error: 1-6 expected function or collection, found integer +// Error: 1-6 expected callable or collection, found integer #f(1)(2) --- #let f(x) = x -// Error: 1-6 expected function or collection, found template +// Error: 1-6 expected callable or collection, found template #f[1](2) --- diff --git a/tests/typ/code/include.typ b/tests/typ/code/include.typ index 83e00384..1e5d5827 100644 --- a/tests/typ/code/include.typ +++ b/tests/typ/code/include.typ @@ -1,7 +1,7 @@ // Test include statements. --- -#page(width: 200pt) +#set page(width: 200pt) = Document diff --git a/tests/typ/code/spread.typ b/tests/typ/code/spread.typ index 41e790a4..5f7d2061 100644 --- a/tests/typ/code/spread.typ +++ b/tests/typ/code/spread.typ @@ -4,14 +4,14 @@ --- // Test standard argument overriding. { - let font(style: "normal", weight: "regular") = { + let f(style: "normal", weight: "regular") = { "(style: " + style + ", weight: " + weight + ")" } - let myfont(..args) = font(weight: "bold", ..args) - test(myfont(), "(style: normal, weight: bold)") - test(myfont(weight: "black"), "(style: normal, weight: black)") - test(myfont(style: "italic"), "(style: italic, weight: bold)") + let myf(..args) = f(weight: "bold", ..args) + test(myf(), "(style: normal, weight: bold)") + test(myf(weight: "black"), "(style: normal, weight: black)") + test(myf(style: "italic"), "(style: italic, weight: bold)") } --- diff --git a/tests/typ/coma.typ b/tests/typ/coma.typ index 77baec45..ef9e9f86 100644 --- a/tests/typ/coma.typ +++ b/tests/typ/coma.typ @@ -1,4 +1,4 @@ -#page(width: 450pt, margins: 1cm) +#set page(width: 450pt, margins: 1cm) *Technische Universität Berlin* #h(1fr) *WiSe 2019/2020* \ *Fakultät II, Institut for Mathematik* #h(1fr) Woche 3 \ diff --git a/tests/typ/elements/circle.typ b/tests/typ/elements/circle.typ index ad9d3a4e..8b795830 100644 --- a/tests/typ/elements/circle.typ +++ b/tests/typ/elements/circle.typ @@ -23,7 +23,7 @@ Center-aligned rect in auto-sized circle. Rect in auto-sized circle. \ #circle(fill: forest, rect(fill: conifer, stroke: white, padding: 4pt)[ - #font(8pt) + #set text(8pt) But, soft! what light through yonder window breaks? ] ) @@ -38,7 +38,7 @@ Expanded by height. --- // Test relative sizing. #let centered(body) = align(center + horizon, body) -#font(fill: white) +#set text(fill: white) #rect(width: 100pt, height: 50pt, fill: rgb("aaa"), centered[ #circle(radius: 10pt, fill: eastern, centered[A]) // D=20pt #circle(height: 60%, fill: eastern, centered[B]) // D=30pt diff --git a/tests/typ/elements/ellipse.typ b/tests/typ/elements/ellipse.typ index 39c73a6f..154144c4 100644 --- a/tests/typ/elements/ellipse.typ +++ b/tests/typ/elements/ellipse.typ @@ -18,6 +18,6 @@ Rect in ellipse in fixed rect. \ Auto-sized ellipse. \ #ellipse(fill: conifer, stroke: forest, thickness: 3pt, padding: 3pt)[ - #font(8pt) + #set text(8pt) But, soft! what light through yonder window breaks? ] diff --git a/tests/typ/elements/image.typ b/tests/typ/elements/image.typ index 7fddb12d..8817713f 100644 --- a/tests/typ/elements/image.typ +++ b/tests/typ/elements/image.typ @@ -7,7 +7,7 @@ #image("../../res/rhino.png") // Load an RGB JPEG image. -#page(height: 60pt) +#set page(height: 60pt) #image("../../res/tiger.jpg") --- @@ -25,7 +25,7 @@ --- // Test all three fit modes. -#page(height: 50pt, margins: 0pt) +#set page(height: 50pt, margins: 0pt) #grid( columns: (1fr, 1fr, 1fr), rows: 100%, @@ -37,7 +37,7 @@ --- // Does not fit to remaining height of page. -#page(height: 60pt) +#set page(height: 60pt) Stuff \ Stuff #image("../../res/rhino.png") diff --git a/tests/typ/elements/rect.typ b/tests/typ/elements/rect.typ index b3d4d286..add39b80 100644 --- a/tests/typ/elements/rect.typ +++ b/tests/typ/elements/rect.typ @@ -5,7 +5,7 @@ #rect() --- -#page(width: 150pt) +#set page(width: 150pt) // Fit to text. #rect(fill: conifer, padding: 3pt)[Textbox] diff --git a/tests/typ/elements/square.typ b/tests/typ/elements/square.typ index f09fc3e0..c4ece778 100644 --- a/tests/typ/elements/square.typ +++ b/tests/typ/elements/square.typ @@ -8,7 +8,7 @@ --- // Test auto-sized square. #square(fill: eastern, padding: 5pt)[ - #font(fill: white, weight: "bold") + #set text(fill: white, weight: "bold") Typst ] @@ -21,14 +21,14 @@ --- // Test text overflowing height. -#page(width: 75pt, height: 100pt) +#set page(width: 75pt, height: 100pt) #square(fill: conifer)[ But, soft! what light through yonder window breaks? ] --- // Test that square does not overflow page. -#page(width: 100pt, height: 75pt) +#set page(width: 100pt, height: 75pt) #square(fill: conifer)[ But, soft! what light through yonder window breaks? ] 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) diff --git a/tests/typ/text/baseline.typ b/tests/typ/text/baseline.typ index f22fce08..7100ab52 100644 --- a/tests/typ/text/baseline.typ +++ b/tests/typ/text/baseline.typ @@ -1,4 +1,4 @@ // Test text baseline. --- -Hi #font(150%)[You], #font(75%)[how are you?] +Hi #text(150%)[You], #text(75%)[how are you?] diff --git a/tests/typ/text/basic.typ b/tests/typ/text/basic.typ index 0c6c8896..a074a046 100644 --- a/tests/typ/text/basic.typ +++ b/tests/typ/text/basic.typ @@ -1,7 +1,7 @@ // Test simple text. --- -#page(width: 250pt, height: 120pt) +#set page(width: 250pt, height: 120pt) But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. Arise, fair sun, and kill the envious moon, Who is already sick and diff --git a/tests/typ/text/bidi.typ b/tests/typ/text/bidi.typ index 7d33aeea..658c7fa6 100644 --- a/tests/typ/text/bidi.typ +++ b/tests/typ/text/bidi.typ @@ -2,55 +2,55 @@ --- // Test reordering with different top-level paragraph directions. -#let text = [Text טֶקסט] -#font(serif, "Noto Serif Hebrew") -#par(lang: "he") {text} -#par(lang: "de") {text} +#let content = [Text טֶקסט] +#set text(serif, "Noto Serif Hebrew") +#par(lang: "he", content) +#par(lang: "de", content) --- // Test that consecutive, embedded LTR runs stay LTR. // Here, we have two runs: "A" and italic "B". -#let text = [أنت A_B_مطرC] -#font(serif, "Noto Sans Arabic") -#par(lang: "ar") {text} -#par(lang: "de") {text} +#let content = [أنت A_B_مطرC] +#set text(serif, "Noto Sans Arabic") +#par(lang: "ar", content) +#par(lang: "de", content) --- // Test that consecutive, embedded RTL runs stay RTL. // Here, we have three runs: "גֶ", bold "שֶׁ", and "ם". -#let text = [Aגֶ*שֶׁ*םB] -#font(serif, "Noto Serif Hebrew") -#par(lang: "he") {text} -#par(lang: "de") {text} +#let content = [Aגֶ*שֶׁ*םB] +#set text(serif, "Noto Serif Hebrew") +#par(lang: "he", content) +#par(lang: "de", content) --- // Test embedding up to level 4 with isolates. -#font(serif, "Noto Serif Hebrew", "Twitter Color Emoji") -#par(dir: rtl) +#set text(serif, "Noto Serif Hebrew", "Twitter Color Emoji") +#set par(dir: rtl) א\u{2066}A\u{2067}Bב\u{2069}? --- // Test hard line break (leads to two paragraphs in unicode-bidi). -#font("Noto Sans Arabic", serif) -#par(lang: "ar") +#set text("Noto Sans Arabic", serif) +#set par(lang: "ar") Life المطر هو الحياة \ الحياة تمطر is rain. --- // Test spacing. -#font(serif, "Noto Serif Hebrew") +#set text(serif, "Noto Serif Hebrew") L #h(1cm) ריווחR \ Lריווח #h(1cm) R --- // Test inline object. -#font("Noto Serif Hebrew", serif) -#par(lang: "he") +#set text("Noto Serif Hebrew", serif) +#set par(lang: "he") קרנפיםRh#image("../../res/rhino.png", height: 11pt)inoחיים --- // Test setting a vertical direction. // Ref: false -// Error: 11-14 must be horizontal -#par(dir: ttb) +// Error: 15-18 must be horizontal +#set par(dir: ttb) diff --git a/tests/typ/text/chinese.typ b/tests/typ/text/chinese.typ index 0800a220..04fa7027 100644 --- a/tests/typ/text/chinese.typ +++ b/tests/typ/text/chinese.typ @@ -1,7 +1,7 @@ // Test chinese text from Wikipedia. --- -#font("Noto Serif CJK SC") +#set text("Noto Serif CJK SC") 是美国广播公司电视剧《迷失》第3季的第22和23集,也是全剧的第71集和72集 由执行制作人戴蒙·林道夫和卡尔顿·库斯编剧,导演则是另一名执行制作人杰克·本德 diff --git a/tests/typ/text/decorations.typ b/tests/typ/text/decorations.typ index 9cd7b096..14dfe821 100644 --- a/tests/typ/text/decorations.typ +++ b/tests/typ/text/decorations.typ @@ -13,7 +13,7 @@ #underline(red)[Critical information is conveyed here.] // Inherits font color. -#font(fill: red, underline[Change with the wind.]) +#text(fill: red, underline[Change with the wind.]) // Both over- and underline. #overline(underline[Running amongst the wolves.]) diff --git a/tests/typ/text/features.typ b/tests/typ/text/features.typ index d60583d8..3f61873e 100644 --- a/tests/typ/text/features.typ +++ b/tests/typ/text/features.typ @@ -2,72 +2,73 @@ --- // Test turning kerning off. -#font(kerning: true)[Tq] \ -#font(kerning: false)[Tq] +#text(kerning: true)[Tq] \ +#text(kerning: false)[Tq] --- // Test smallcaps. -#font("Roboto") -#font(smallcaps: true)[Smallcaps] +#set text("Roboto") +#text(smallcaps: true)[Smallcaps] --- // Test alternates and stylistic sets. -#font("IBM Plex Serif") -a vs #font(alternates: true)[a] \ -ß vs #font(stylistic-set: 5)[ß] +#set text("IBM Plex Serif") +a vs #text(alternates: true)[a] \ +ß vs #text(stylistic-set: 5)[ß] --- // Test ligatures. -fi vs. #font(ligatures: false)[No fi] \ +fi vs. #text(ligatures: false)[No fi] \ --- // Test number type. -#font("Roboto") -#font(number-type: "old-style") 0123456789 \ -#font(number-type: auto)[0123456789] +#set text("Roboto") +#set text(number-type: "old-style") +0123456789 \ +#text(number-type: auto)[0123456789] --- // Test number width. -#font("Roboto") -#font(number-width: "proportional")[0123456789] \ -#font(number-width: "tabular")[3456789123] \ -#font(number-width: "tabular")[0123456789] +#set text("Roboto") +#text(number-width: "proportional")[0123456789] \ +#text(number-width: "tabular")[3456789123] \ +#text(number-width: "tabular")[0123456789] --- // Test number position. -#font("IBM Plex Sans") -#font(number-position: "normal")[C2H4] \ -#font(number-position: "subscript")[C2H4] \ -#font(number-position: "superscript")[C2H4] +#set text("IBM Plex Sans") +#text(number-position: "normal")[C2H4] \ +#text(number-position: "subscript")[C2H4] \ +#text(number-position: "superscript")[C2H4] --- // Test extra number stuff. -#font("IBM Plex Sans") -0 vs. #font(slashed-zero: true)[0] \ -1/2 vs. #font(fractions: true)[1/2] +#set text("IBM Plex Sans") +0 vs. #text(slashed-zero: true)[0] \ +1/2 vs. #text(fractions: true)[1/2] --- // Test raw features. -#font("Roboto") -#font(features: ("smcp",))[Smcp] \ -fi vs. #font(features: (liga: 0))[No fi] +#set text("Roboto") +#text(features: ("smcp",))[Smcp] \ +fi vs. #text(features: (liga: 0))[No fi] --- -// Error: 22-27 expected integer or none, found boolean -#font(stylistic-set: false) +// Error: 26-31 expected integer or none, found boolean +#set text(stylistic-set: false) --- -// Error: 22-24 must be between 1 and 20 -#font(stylistic-set: 25) +// Error: 26-28 must be between 1 and 20 +#set text(stylistic-set: 25) --- -// Error: 20-21 expected string or auto, found integer -#font(number-type: 2) +// Error: 24-25 expected string or auto, found integer +#set text(number-type: 2) --- -// Error: 20-31 expected "lining" or "old-style" -#font(number-type: "different") +// Error: 24-35 expected "lining" or "old-style" +#set text(number-type: "different") --- -// Error: 17-22 expected array of strings or dictionary mapping tags to integers, found boolean -#font(features: false) +// Error: 21-26 expected array of strings or dictionary mapping tags to integers, found boolean +#set text(features: false) diff --git a/tests/typ/text/font.typ b/tests/typ/text/font.typ index 5c97d367..71ac8d3d 100644 --- a/tests/typ/text/font.typ +++ b/tests/typ/text/font.typ @@ -2,57 +2,57 @@ --- // Set same font size in three different ways. -#font(20pt)[A] -#font(200%)[A] -#font(size: 15pt + 50%)[A] +#text(20pt)[A] +#text(200%)[A] +#text(size: 15pt + 50%)[A] // Do nothing. -#font()[Normal] +#text()[Normal] // Set style (is available). -#font(style: "italic")[Italic] +#text(style: "italic")[Italic] // Set weight (is available). -#font(weight: "bold")[Bold] +#text(weight: "bold")[Bold] // Set stretch (not available, matching closest). -#font(stretch: 50%)[Condensed] +#text(stretch: 50%)[Condensed] // Set family. -#font(family: serif)[Serif] +#text(family: serif)[Serif] // Emoji. Emoji: 🐪, 🌋, 🏞 // Math. -#font("Latin Modern Math")[∫ 𝛼 + 3𝛽 d𝑡] +#text("Latin Modern Math")[∫ 𝛼 + 3𝛽 d𝑡] // Colors. [ - #font(fill: eastern) - This is #font(rgb("FA644B"))[way more] colorful. + #set text(fill: eastern) + This is #text(rgb("FA644B"))[way more] colorful. ] // Disable font fallback beyond the user-specified list. // Without disabling, Latin Modern Math would come to the rescue. -#font("PT Sans", "Twitter Color Emoji", fallback: false) +#set text("PT Sans", "Twitter Color Emoji", fallback: false) 2π = 𝛼 + 𝛽. ✅ --- // Test class definitions. -#font(sans-serif: "PT Sans") -#font(family: sans-serif)[Sans-serif.] \ -#font(monospace)[Monospace.] \ -#font(monospace, monospace: ("Nope", "Latin Modern Math"))[Math.] +#set text(sans-serif: "PT Sans") +#text(family: sans-serif)[Sans-serif.] \ +#text(monospace)[Monospace.] \ +#text(monospace, monospace: ("Nope", "Latin Modern Math"))[Math.] --- // Test top and bottom edge. -#page(width: 150pt) -#font(size: 8pt) +#set page(width: 150pt) +#set text(size: 8pt) #let try(top, bottom) = rect(fill: conifer)[ - #font(monospace, top-edge: top, bottom-edge: bottom) + #set text(monospace, top-edge: top, bottom-edge: bottom) From #top to #bottom ] @@ -64,33 +64,33 @@ Emoji: 🐪, 🌋, 🏞 #try(1pt + 27%, -18%) --- -// Error: 7-12 unexpected argument -#font(false) +// Error: 11-16 unexpected argument +#set text(false) --- -// Error: 14-20 expected "normal", "italic" or "oblique" -#font(style: "bold", weight: "thin") +// Error: 18-24 expected "normal", "italic" or "oblique" +#set text(style: "bold", weight: "thin") --- -// Error: 17-19 expected linear or string, found array -#font(top-edge: ()) +// Error: 21-23 expected linear or string, found array +#set text(top-edge: ()) --- -// Error: 17-19 unknown font metric -#font(top-edge: "") +// Error: 21-23 unknown font metric +#set text(top-edge: "") --- -// Error: 14-15 expected string or array of strings, found integer -#font(serif: 0) +// Error: 18-19 expected string or array of strings, found integer +#set text(serif: 0) --- -// Error: 19-23 unexpected argument -#font(size: 10pt, 12pt) +// Error: 23-27 unexpected argument +#set text(size: 10pt, 12pt) --- -// Error: 28-35 unexpected argument -#font(family: "Helvetica", "Arial") +// Error: 32-39 unexpected argument +#set text(family: "Helvetica", "Arial") --- -// Error: 7-27 unexpected argument -#font(something: "invalid") +// Error: 11-31 unexpected argument +#set text(something: "invalid") diff --git a/tests/typ/text/links.typ b/tests/typ/text/links.typ index 1a77e34b..f2da8b9c 100644 --- a/tests/typ/text/links.typ +++ b/tests/typ/text/links.typ @@ -12,12 +12,12 @@ 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))) +#let link(url, body) = link(url, text(fill: rgb("283663"), underline(body))) You could also make the #link("https://html5zombo.com/")[link look way more typical.] --- // Transformed link. -#page(height: 60pt) +#set page(height: 60pt) #let link = link("https://typst.app/")[LINK] My cool #move(x: 0.7cm, y: 0.7cm, rotate(10deg, scale(200%, link))) diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ index 9c14279c..771a6218 100644 --- a/tests/typ/text/par.typ +++ b/tests/typ/text/par.typ @@ -2,37 +2,37 @@ --- // Test ragged-left. -#par(align: right) +#set par(align: right) To the right! Where the sunlight peeks behind the mountain. --- // Test that explicit paragraph break respects active styles. -#par(spacing: 7pt) -[#par(spacing: 100pt) First] +#set par(spacing: 7pt) +[#set par(spacing: 100pt);First] -[#par(spacing: 100pt) Second] -#par(spacing: 20pt) +[#set par(spacing: 100pt);Second] +#set par(spacing: 20pt) Third --- // Test that paragraph break due to incompatibility respects // spacing defined by the two adjacent paragraphs. -#let a = [#par(spacing: 40pt) Hello] -#let b = [#par(spacing: 60pt) World] +#let a = [#set par(spacing: 40pt);Hello] +#let b = [#set par(spacing: 60pt);World] {a}{b} --- // Test weird metrics. -#par(spacing: 100%, leading: 0pt) +#set par(spacing: 100%, leading: 0pt) But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. --- -// Error: 13-16 must be horizontal -#par(align: top) +// Error: 17-20 must be horizontal +#set par(align: top) --- -// Error: 13-29 expected alignment, found 2d alignment -#par(align: horizon + center) +// Error: 17-33 expected alignment, found 2d alignment +#set par(align: horizon + center) diff --git a/tests/typ/text/shaping.typ b/tests/typ/text/shaping.typ index 1a8a7933..bb8f4ce9 100644 --- a/tests/typ/text/shaping.typ +++ b/tests/typ/text/shaping.typ @@ -7,11 +7,11 @@ Le fira // This should just shape nicely. -#font("Noto Sans Arabic") +#set text("Noto Sans Arabic") دع النص يمطر عليك // This should form a three-member family. -#font("Twitter Color Emoji") +#set text("Twitter Color Emoji") 👩👩👦 🤚🏿 // These two shouldn't be affected by a zero-width joiner. @@ -20,7 +20,7 @@ Le fira --- // Test font fallback. -#font(sans-serif, "Noto Sans Arabic", "Twitter Color Emoji") +#set text(sans-serif, "Noto Sans Arabic", "Twitter Color Emoji") // Font fallback for emoji. A😀B @@ -40,6 +40,6 @@ A🐈中文B --- // Test reshaping. -#font("Noto Serif Hebrew") -#par(lang: "he") +#set text("Noto Serif Hebrew") +#set par(lang: "he") ס \ טֶ diff --git a/tests/typ/text/tracking.typ b/tests/typ/text/tracking.typ index 695e6734..e3ff70ff 100644 --- a/tests/typ/text/tracking.typ +++ b/tests/typ/text/tracking.typ @@ -1,12 +1,12 @@ // Test tracking characters apart or together. --- -#font(tracking: -0.01) +#set text(tracking: -0.01) I saw Zoe yӛsterday, on the tram. --- -I'm in#font(tracking: 0.3)[ spaace]! +I'm in#text(tracking: 0.3)[ spaace]! --- -#font("Noto Serif Hebrew", tracking: 0.3) +#set text("Noto Serif Hebrew", tracking: 0.3) טֶקסט diff --git a/tests/typ/text/whitespace.typ b/tests/typ/text/whitespace.typ index e01b047c..4c3d4db5 100644 --- a/tests/typ/text/whitespace.typ +++ b/tests/typ/text/whitespace.typ @@ -30,11 +30,11 @@ A #for _ in (none,) {"B"}C --- // Test that a run consisting only of whitespace isn't trimmed. -A[#font(serif) ]B +A[#set text(serif); ]B --- // Test font change after space. -Left [#font(serif)Right]. +Left [#set text(serif);Right]. --- // Test that space at start of line is not trimmed. |
