diff options
Diffstat (limited to 'tests/typ/text')
| -rw-r--r-- | tests/typ/text/baseline.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/basic.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/bidi.typ | 42 | ||||
| -rw-r--r-- | tests/typ/text/chinese.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/decorations.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/features.typ | 71 | ||||
| -rw-r--r-- | tests/typ/text/font.typ | 70 | ||||
| -rw-r--r-- | tests/typ/text/links.typ | 4 | ||||
| -rw-r--r-- | tests/typ/text/par.typ | 24 | ||||
| -rw-r--r-- | tests/typ/text/shaping.typ | 10 | ||||
| -rw-r--r-- | tests/typ/text/tracking.typ | 6 | ||||
| -rw-r--r-- | tests/typ/text/whitespace.typ | 4 |
12 files changed, 120 insertions, 119 deletions
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. |
