diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-08 10:43:03 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-08 10:44:24 +0100 |
| commit | 1b2b53ecb91a9bd7fb3493e471ae03cd142a7c03 (patch) | |
| tree | 682124c2343db9491c84bddbdca026c676f220c6 /tests/typ | |
| parent | 25b5bd117529cd04bb789e1988eb3a3db8025a0e (diff) | |
Require font to be a named argument
Diffstat (limited to 'tests/typ')
30 files changed, 43 insertions, 47 deletions
diff --git a/tests/typ/compiler/break-continue.typ b/tests/typ/compiler/break-continue.typ index d4bd01e3..f6245007 100644 --- a/tests/typ/compiler/break-continue.typ +++ b/tests/typ/compiler/break-continue.typ @@ -115,7 +115,7 @@ // Should output `Some` in red, `Some` in blue and `Last` in green. // Everything should be in smallcaps. #for color in (red, blue, green, yellow) [ - #set text("Roboto") + #set text(font: "Roboto") #show: it => text(fill: color, it) #smallcaps(if color != green [ Some diff --git a/tests/typ/compiler/call.typ b/tests/typ/compiler/call.typ index 86db55e0..32a54cd4 100644 --- a/tests/typ/compiler/call.typ +++ b/tests/typ/compiler/call.typ @@ -44,8 +44,8 @@ } --- -// Error: 28-34 duplicate argument -#set text(family: "Arial", family: "Helvetica") +// Error: 26-30 duplicate argument +#set text(font: "Arial", font: "Helvetica") --- // Error: 2-6 expected function, found boolean diff --git a/tests/typ/compiler/shorthand.typ b/tests/typ/compiler/shorthand.typ index 6df5e340..c8a10851 100644 --- a/tests/typ/compiler/shorthand.typ +++ b/tests/typ/compiler/shorthand.typ @@ -7,7 +7,7 @@ The non-breaking~space does work. // Make sure non-breaking and normal space always // have the same width. Even if the font decided // differently. -#set text("New Computer Modern") +#set text(font: "New Computer Modern") a b \ a~b @@ -16,5 +16,5 @@ a~b - Em dash: --- --- -#set text("Roboto") +#set text(font: "Roboto") A... vs #"A..." diff --git a/tests/typ/compiler/show-text.typ b/tests/typ/compiler/show-text.typ index b175c17d..0f978563 100644 --- a/tests/typ/compiler/show-text.typ +++ b/tests/typ/compiler/show-text.typ @@ -2,14 +2,14 @@ --- // Test classic example. -#set text("Roboto") +#set text(font: "Roboto") #show "Der Spiegel": smallcaps Die Zeitung Der Spiegel existiert. --- // Another classic example. #show "TeX": [T#h(-0.145em)#box(move(dy: 0.233em)[E])#h(-0.135em)X] -#show regex("(Lua)?(La)?TeX"): name => box(text("New Computer Modern")[#name]) +#show regex("(Lua)?(La)?TeX"): name => box(text(font: "New Computer Modern")[#name]) TeX, LaTeX, LuaTeX and LuaLaTeX! diff --git a/tests/typ/compute/foundations.typ b/tests/typ/compute/foundations.typ index d6c0f82b..c74a4cd6 100644 --- a/tests/typ/compute/foundations.typ +++ b/tests/typ/compute/foundations.typ @@ -54,7 +54,7 @@ #eval("let") --- -#show raw: it => text("PT Sans", eval("[" + it.text + "]")) +#show raw: it => text(font: "PT Sans", eval("[" + it.text + "]")) Interacting ``` diff --git a/tests/typ/layout/columns.typ b/tests/typ/layout/columns.typ index eafb0518..5f853d73 100644 --- a/tests/typ/layout/columns.typ +++ b/tests/typ/layout/columns.typ @@ -3,7 +3,7 @@ --- // Test normal operation and RTL directions. #set page(height: 3.25cm, width: 7.05cm, columns: 2) -#set text(lang: "ar", "Noto Sans Arabic", "Linux Libertine") +#set text(lang: "ar", font: ("Noto Sans Arabic", "Linux Libertine")) #set columns(gutter: 30pt) #box(fill: conifer, height: 8pt, width: 6pt) وتحفيز diff --git a/tests/typ/layout/enum-numbering.typ b/tests/typ/layout/enum-numbering.typ index ee4b25b9..3eaf352e 100644 --- a/tests/typ/layout/enum-numbering.typ +++ b/tests/typ/layout/enum-numbering.typ @@ -37,7 +37,7 @@ --- // Test numbering with closure and nested lists. -#set text("New Computer Modern") +#set text(font: "New Computer Modern") #set enum(numbering: (..args) => math.mat(args.pos()), full: true) + A + B diff --git a/tests/typ/layout/page-style.typ b/tests/typ/layout/page-style.typ index b4a509ef..0d097554 100644 --- a/tests/typ/layout/page-style.typ +++ b/tests/typ/layout/page-style.typ @@ -24,5 +24,5 @@ #set page("a4") #set page("a5") #set page("a11", flipped: true, fill: eastern) -#set text("Roboto", white) +#set text(font: "Roboto", white) #smallcaps[Typst] diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ index 2815e230..ff050e55 100644 --- a/tests/typ/layout/page.typ +++ b/tests/typ/layout/page.typ @@ -23,7 +23,7 @@ --- // Test page fill. #set page(width: 80pt, height: 40pt, fill: eastern) -#text(15pt, "Roboto", fill: white, smallcaps[Typst]) +#text(15pt, font: "Roboto", fill: white, smallcaps[Typst]) #page(width: 40pt, fill: none, margin: (top: 10pt, rest: auto))[Hi] --- diff --git a/tests/typ/layout/par-bidi.typ b/tests/typ/layout/par-bidi.typ index aa881a7b..d8c05d23 100644 --- a/tests/typ/layout/par-bidi.typ +++ b/tests/typ/layout/par-bidi.typ @@ -10,7 +10,7 @@ // Test that consecutive, embedded LTR runs stay LTR. // Here, we have two runs: "A" and italic "B". #let content = par[أنت A#emph[B]مطرC] -#set text("PT Sans", "Noto Sans Arabic") +#set text(font: ("PT Sans", "Noto Sans Arabic")) #text(lang: "ar", content) #text(lang: "de", content) @@ -18,7 +18,7 @@ // Test that consecutive, embedded RTL runs stay RTL. // Here, we have three runs: "גֶ", bold "שֶׁ", and "ם". #let content = par[Aגֶ#strong[שֶׁ]םB] -#set text("Linux Libertine", "Noto Serif Hebrew") +#set text(font: ("Linux Libertine", "Noto Serif Hebrew")) #text(lang: "he", content) #text(lang: "de", content) @@ -29,7 +29,7 @@ --- // Test hard line break (leads to two paragraphs in unicode-bidi). -#set text(lang: "ar", "Noto Sans Arabic", "PT Sans") +#set text(lang: "ar", font: ("Noto Sans Arabic", "PT Sans")) Life المطر هو الحياة \ الحياة تمطر is rain. diff --git a/tests/typ/layout/par-indent.typ b/tests/typ/layout/par-indent.typ index 8efda42f..0cb937bf 100644 --- a/tests/typ/layout/par-indent.typ +++ b/tests/typ/layout/par-indent.typ @@ -20,7 +20,7 @@ starts a paragraph without indent. Except if you have another paragraph in them. -#set text(8pt, lang: "ar", "Noto Sans Arabic", "Linux Libertine") +#set text(8pt, lang: "ar", font: ("Noto Sans Arabic", "Linux Libertine")) #set par(leading: 8pt) = Arabic diff --git a/tests/typ/layout/par-knuth.typ b/tests/typ/layout/par-knuth.typ index 0467c9a1..50f9280a 100644 --- a/tests/typ/layout/par-knuth.typ +++ b/tests/typ/layout/par-knuth.typ @@ -1,6 +1,6 @@ #set page(width: auto, height: auto) #set par(leading: 4pt, justify: true) -#set text(family: "New Computer Modern") +#set text(font: "New Computer Modern") #let story = [ In olden times when wishing still helped one, there lived a king whose diff --git a/tests/typ/layout/transform.typ b/tests/typ/layout/transform.typ index de193f72..22a94532 100644 --- a/tests/typ/layout/transform.typ +++ b/tests/typ/layout/transform.typ @@ -23,7 +23,7 @@ [X] } -#set text("New Computer Modern", size) +#set text(font: "New Computer Modern", size) Neither #tex, \ nor #xetex! diff --git a/tests/typ/math/content.typ b/tests/typ/math/content.typ index dc0ec85c..2e680671 100644 --- a/tests/typ/math/content.typ +++ b/tests/typ/math/content.typ @@ -15,5 +15,5 @@ $ x := #table(columns: 2)[x][y]/mat(1, 2, 3) --- // Test font switch. -#let here = text.with("Noto Sans") +#let here = text.with(font: "Noto Sans") $#here[f] := #here[Hi there]$. diff --git a/tests/typ/math/op.typ b/tests/typ/math/op.typ index 882a7c4a..2a1c2044 100644 --- a/tests/typ/math/op.typ +++ b/tests/typ/math/op.typ @@ -11,7 +11,7 @@ $ &sin x + log_2 x \ --- // Test scripts vs limits. -#set text("New Computer Modern") +#set text(font: "New Computer Modern") Discuss $lim_(n->oo) 1/n$ now. $ lim_(n->infinity) 1/n = 0 $ diff --git a/tests/typ/math/style.typ b/tests/typ/math/style.typ index 22851900..017c62f2 100644 --- a/tests/typ/math/style.typ +++ b/tests/typ/math/style.typ @@ -26,5 +26,5 @@ $text(#red, "time"^2) + sqrt("place")$ --- // Test different font. -#show math.formula: set text(family: "Fira Math") +#show math.formula: set text(font: "Fira Math") $ v := vec(1 + 2, 2 - 4, sqrt(3), arrow(x)) + 1 $ diff --git a/tests/typ/meta/heading.typ b/tests/typ/meta/heading.typ index 8e87db3f..992c0bb4 100644 --- a/tests/typ/meta/heading.typ +++ b/tests/typ/meta/heading.typ @@ -38,7 +38,7 @@ multiline. --- // Test styling. #show heading.where(level: 5): it => block( - text(family: "Roboto", fill: eastern, it.title + [!]) + text(font: "Roboto", fill: eastern, it.title + [!]) ) = Heading diff --git a/tests/typ/text/chinese.typ b/tests/typ/text/chinese.typ index 04fa7027..258d72fd 100644 --- a/tests/typ/text/chinese.typ +++ b/tests/typ/text/chinese.typ @@ -1,7 +1,7 @@ // Test chinese text from Wikipedia. --- -#set text("Noto Serif CJK SC") +#set text(font: "Noto Serif CJK SC") 是美国广播公司电视剧《迷失》第3季的第22和23集,也是全剧的第71集和72集 由执行制作人戴蒙·林道夫和卡尔顿·库斯编剧,导演则是另一名执行制作人杰克·本德 diff --git a/tests/typ/text/deco.typ b/tests/typ/text/deco.typ index 5e9de5b3..f3be17e7 100644 --- a/tests/typ/text/deco.typ +++ b/tests/typ/text/deco.typ @@ -10,7 +10,7 @@ #underline(offset: 5pt)[Further below.] // Different color. -#underline(red, evade: false)[Critical information is conveyed here.] +#underline(stroke: red, evade: false)[Critical information is conveyed here.] // Inherits font color. #text(fill: red, underline[Change with the wind.]) @@ -19,7 +19,7 @@ #overline(underline[Running amongst the wolves.]) --- -#let redact = strike.with(10pt, extent: 0.05em) +#let redact = strike.with(stroke: 10pt, extent: 0.05em) #let highlight = strike.with(stroke: 10pt + rgb("abcdef88"), extent: 0.05em) // Abuse thickness and transparency for redacting and highlighting stuff. diff --git a/tests/typ/text/edge.typ b/tests/typ/text/edge.typ index 8c4c4a57..85aff68a 100644 --- a/tests/typ/text/edge.typ +++ b/tests/typ/text/edge.typ @@ -5,7 +5,7 @@ #set text(size: 8pt) #let try(top, bottom) = rect(inset: 0pt, fill: conifer)[ - #set text("IBM Plex Mono", top-edge: top, bottom-edge: bottom) + #set text(font: "IBM Plex Mono", top-edge: top, bottom-edge: bottom) From #top to #bottom ] diff --git a/tests/typ/text/features.typ b/tests/typ/text/features.typ index c706afed..360e8a11 100644 --- a/tests/typ/text/features.typ +++ b/tests/typ/text/features.typ @@ -11,7 +11,7 @@ --- // Test alternates and stylistic sets. -#set text("IBM Plex Serif") +#set text(font: "IBM Plex Serif") a vs #text(alternates: true)[a] \ ß vs #text(stylistic-set: 5)[ß] @@ -33,7 +33,7 @@ fi vs. #text(ligatures: false)[No fi] --- // Test extra number stuff. -#set text("IBM Plex Serif") +#set text(font: "IBM Plex Serif") 0 vs. #text(slashed-zero: true)[0] \ 1/2 vs. #text(fractions: true)[1/2] diff --git a/tests/typ/text/font.typ b/tests/typ/text/font.typ index e832ab1d..9844d066 100644 --- a/tests/typ/text/font.typ +++ b/tests/typ/text/font.typ @@ -18,8 +18,8 @@ // Set stretch (not available, matching closest). #text(stretch: 50%)[Condensed] -// Set family. -#text(family: "IBM Plex Serif")[Serif] +// Set font family. +#text(font: "IBM Plex Serif")[Serif] // Emoji. Emoji: 🐪, 🌋, 🏞 @@ -32,16 +32,16 @@ Emoji: 🐪, 🌋, 🏞 // Disable font fallback beyond the user-specified list. // Without disabling, New Computer Modern Math would come to the rescue. -#set text("PT Sans", "Twitter Color Emoji", fallback: false) +#set text(font: ("PT Sans", "Twitter Color Emoji"), fallback: false) 2π = 𝛼 + 𝛽. ✅ --- // Test string body. #text("Text") \ #text(red, "Text") \ -#text("Ubuntu", blue, "Text") \ -#text([Text], teal, "IBM Plex Serif") \ -#text(forest, "New Computer Modern", [Text]) \ +#text(font: "Ubuntu", blue, "Text") \ +#text([Text], teal, font: "IBM Plex Serif") \ +#text(forest, font: "New Computer Modern", [Text]) \ --- // Error: 11-16 unexpected argument @@ -56,9 +56,5 @@ Emoji: 🐪, 🌋, 🏞 #set text(size: 10pt, 12pt) --- -// Error: 32-39 unexpected argument -#set text(family: "Helvetica", "Arial") - ---- // Error: 11-31 unexpected argument #set text(something: "invalid") diff --git a/tests/typ/text/lang.typ b/tests/typ/text/lang.typ index 7d22fdc6..a70b4d63 100644 --- a/tests/typ/text/lang.typ +++ b/tests/typ/text/lang.typ @@ -12,7 +12,7 @@ --- // Test that the language passed to the shaper has an effect. -#set text("Ubuntu") +#set text(font: "Ubuntu") // Some lowercase letters are different in Serbian Cyrillic compared to other // Cyrillic languages. Since there is only one set of Unicode codepoints for diff --git a/tests/typ/text/microtype.typ b/tests/typ/text/microtype.typ index 252d163d..4c2b4d0b 100644 --- a/tests/typ/text/microtype.typ +++ b/tests/typ/text/microtype.typ @@ -12,7 +12,7 @@ ] // Test hanging punctuation with RTL. -#set text(lang: "he", "PT Sans", "Noto Serif Hebrew") +#set text(lang: "he", font: ("PT Sans", "Noto Serif Hebrew")) בנייה נכונה של משפטים ארוכים דורשת ידע בשפה. אז בואו נדבר על מזג האוויר. --- diff --git a/tests/typ/text/raw.typ b/tests/typ/text/raw.typ index f8731cca..ecc81154 100644 --- a/tests/typ/text/raw.typ +++ b/tests/typ/text/raw.typ @@ -46,7 +46,7 @@ The keyword ```rust let```. --- // Text show rule -#show raw: set text("Roboto") +#show raw: set text(font: "Roboto") `Roboto` --- diff --git a/tests/typ/text/shaping.typ b/tests/typ/text/shaping.typ index 51199090..3a99815b 100644 --- a/tests/typ/text/shaping.typ +++ b/tests/typ/text/shaping.typ @@ -14,5 +14,5 @@ ABCअपार्टमेंट --- // Test that RTL safe-to-break doesn't panic even though newline // doesn't exist in shaping output. -#set text(dir: rtl, "Noto Serif Hebrew") +#set text(dir: rtl, font: "Noto Serif Hebrew") \ ט diff --git a/tests/typ/text/space.typ b/tests/typ/text/space.typ index b95da872..a3fd6c0a 100644 --- a/tests/typ/text/space.typ +++ b/tests/typ/text/space.typ @@ -23,11 +23,11 @@ A /**/B/**/ C --- // Test that a run consisting only of whitespace isn't trimmed. -A#text("IBM Plex Serif")[ ]B +A#text(font: "IBM Plex Serif")[ ]B --- // Test font change after space. -Left #text("IBM Plex Serif")[Right]. +Left #text(font: "IBM Plex Serif")[Right]. --- // Test that linebreak consumed surrounding spaces. diff --git a/tests/typ/text/symbol.typ b/tests/typ/text/symbol.typ index 3b7028e9..949f82d2 100644 --- a/tests/typ/text/symbol.typ +++ b/tests/typ/text/symbol.typ @@ -5,7 +5,7 @@ #emoji.woman.old #emoji.turtle -#set text("New Computer Modern Math") +#set text(font: "New Computer Modern Math") #sym.arrow #sym.arrow.l #sym.arrow.r.squiggly diff --git a/tests/typ/text/tracking-spacing.typ b/tests/typ/text/tracking-spacing.typ index 413194ba..a89b991f 100644 --- a/tests/typ/text/tracking-spacing.typ +++ b/tests/typ/text/tracking-spacing.typ @@ -11,7 +11,7 @@ I'm in#text(tracking: 0.15em + 1.5pt)[ spaace]! --- // Test that tracking doesn't disrupt mark placement. -#set text("PT Sans", "Noto Serif Hebrew") +#set text(font: ("PT Sans", "Noto Serif Hebrew")) #set text(tracking: 0.3em) טֶקסט diff --git a/tests/typ/visualize/shape-fill-stroke.typ b/tests/typ/visualize/shape-fill-stroke.typ index 24168769..24ace85b 100644 --- a/tests/typ/visualize/shape-fill-stroke.typ +++ b/tests/typ/visualize/shape-fill-stroke.typ @@ -42,7 +42,7 @@ --- // Test stroke composition. #set square(stroke: 4pt) -#set text("Roboto") +#set text(font: "Roboto") #square( stroke: (left: red, top: yellow, right: green, bottom: blue), radius: 100%, align(center+horizon)[*G*], |
