diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-17 22:04:18 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-17 22:20:37 +0200 |
| commit | 594809e35b9e768f1a50926cf5e7a9df41ba7d16 (patch) | |
| tree | 488f201599a67329d7916b9b3ecb73dd27ad24d7 /tests/typ/text | |
| parent | c53d98a22f367a9eecfb45d1b22f1be5c6cf908d (diff) | |
Library functions behave more imperatively
- Templates scope state changes
- State-modifying function operate in place instead of returning a template
- Internal template representation contains actual owned nodes instead of a pointer to a syntax tree + an expression map
- No more wide calls
Diffstat (limited to 'tests/typ/text')
| -rw-r--r-- | tests/typ/text/basic.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/bidi.typ | 36 | ||||
| -rw-r--r-- | tests/typ/text/chinese.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/decorations.typ | 10 | ||||
| -rw-r--r-- | tests/typ/text/font.typ | 49 | ||||
| -rw-r--r-- | tests/typ/text/par.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/shaping.typ | 10 | ||||
| -rw-r--r-- | tests/typ/text/whitespace.typ | 4 |
8 files changed, 58 insertions, 57 deletions
diff --git a/tests/typ/text/basic.typ b/tests/typ/text/basic.typ index 6e36a210..d5f0de05 100644 --- a/tests/typ/text/basic.typ +++ b/tests/typ/text/basic.typ @@ -1,7 +1,7 @@ // Test simple text. --- -#page!(width: 250pt, height: 110pt) +#page(width: 250pt, height: 110pt) 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 0aab9079..078cb1f9 100644 --- a/tests/typ/text/bidi.typ +++ b/tests/typ/text/bidi.typ @@ -3,54 +3,54 @@ --- // Test reordering with different top-level paragraph directions. #let text = [Text טֶקסט] -#font!("EB Garamond", "Noto Serif Hebrew") -#lang!("he") {text} -#lang!("de") {text} +#font("EB Garamond", "Noto Serif Hebrew") +#lang("he") {text} +#lang("de") {text} --- // Test that consecutive, embedded LTR runs stay LTR. // Here, we have two runs: "A" and italic "B". #let text = [أنت A_B_مطرC] -#font!("EB Garamond", "Noto Sans Arabic") -#lang!("ar") {text} -#lang!("de") {text} +#font("EB Garamond", "Noto Sans Arabic") +#lang("ar") {text} +#lang("de") {text} --- // Test that consecutive, embedded RTL runs stay RTL. // Here, we have three runs: "גֶ", bold "שֶׁ", and "ם". #let text = [Aגֶ*שֶׁ*םB] -#font!("EB Garamond", "Noto Serif Hebrew") -#lang!("he") {text} -#lang!("de") {text} +#font("EB Garamond", "Noto Serif Hebrew") +#lang("he") {text} +#lang("de") {text} --- // Test embedding up to level 4 with isolates. -#font!("EB Garamond", "Noto Serif Hebrew", "Twitter Color Emoji") -#lang!(dir: rtl) +#font("EB Garamond", "Noto Serif Hebrew", "Twitter Color Emoji") +#lang(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", "EB Garamond") -#lang!("ar") +#font("Noto Sans Arabic", "EB Garamond") +#lang("ar") Life المطر هو الحياة \ الحياة تمطر is rain. --- // Test spacing. -#font!("EB Garamond", "Noto Serif Hebrew") +#font("EB Garamond", "Noto Serif Hebrew") L #h(1cm) ריווחR \ Lריווח #h(1cm) R --- // Test inline object. -#font!("Noto Serif Hebrew", "EB Garamond") -#lang!("he") +#font("Noto Serif Hebrew", "EB Garamond") +#lang("he") קרנפיםRh#image("../../res/rhino.png", height: 11pt)inoחיים --- // Test the `lang` function. // Ref: false -// Error: 13-16 must be horizontal -#lang!(dir: ttb) +// Error: 12-15 must be horizontal +#lang(dir: ttb) diff --git a/tests/typ/text/chinese.typ b/tests/typ/text/chinese.typ index b6c3b3f9..0800a220 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") +#font("Noto Serif CJK SC") 是美国广播公司电视剧《迷失》第3季的第22和23集,也是全剧的第71集和72集 由执行制作人戴蒙·林道夫和卡尔顿·库斯编剧,导演则是另一名执行制作人杰克·本德 diff --git a/tests/typ/text/decorations.typ b/tests/typ/text/decorations.typ index 83b04650..bbda3de6 100644 --- a/tests/typ/text/decorations.typ +++ b/tests/typ/text/decorations.typ @@ -1,19 +1,19 @@ // Test text decorations. --- +#let red = rgb("fc0030") + // Basic strikethrough. -#strike[ - Statements dreamt up by the utterly deranged. -] +#strike[Statements dreamt up by the utterly deranged.] // Move underline down. #underline(offset: 5pt)[Further below.] // Different color. -#underline(rgb("fc0030"))[Critical information is conveyed here.] +#underline(red)[Critical information is conveyed here.] // Inherits font color. -#font(fill: rgb("fc0030"), underline[Change with the wind.]) +[#font(fill: red) #underline[Change with the wind.]] // Both over- and underline. #overline(underline[Running amongst the wolves.]) diff --git a/tests/typ/text/font.typ b/tests/typ/text/font.typ index 1d28c331..fbb999f8 100644 --- a/tests/typ/text/font.typ +++ b/tests/typ/text/font.typ @@ -2,42 +2,43 @@ --- // Set same font size in three different ways. -#font(22pt)[A] -#font(200%)[A] -#font(size: 16.5pt + 50%)[A] +[#font(22pt) A] +[#font(200%) A] +[#font(size: 16.5pt + 50%) A] // Do nothing. -#font[Normal] +[#font() Normal] // Set style (is available). -#font(style: italic)[Italic] +[#font(style: italic) Italic] // Set weight (is available). -#font(weight: bold)[Bold] +[#font(weight: bold) Bold] // Set stretch (not available, matching closest). -#font(stretch: 50%)[Condensed] +[#font(stretch: 50%) Condensed] // Set family. -#font(family: "PT Sans")[Sans serif] +[#font(family: "PT Sans") Sans serif] // Emoji. Emoji: 🐪, 🌋, 🏞 // Math. -#font("Latin Modern Math")[ - ∫ 𝛼 + 3𝛽 d𝑡 -] +[#font("Latin Modern Math") ∫ 𝛼 + 3𝛽 d𝑡] // Colors. -#font(fill: eastern)[This is #font(fill: rgb("FA644B"))[way more] colorful.] +[ + #font(fill: eastern) + This is [#font(fill: rgb("FA644B")) way more] colorful. +] --- // Test top and bottom edge. -#page!(width: 170pt) +#page(width: 170pt) #let try(top, bottom) = rect(fill: conifer)[ - #font!(top-edge: top, bottom-edge: bottom) + #font(top-edge: top, bottom-edge: bottom) `From `#top` to `#bottom ] @@ -48,31 +49,31 @@ Emoji: 🐪, 🌋, 🏞 --- // 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.] +#font(sans-serif: "PT Sans") +[#font(family: sans-serif) Sans-serif.] \ +[#font(monospace) Monospace.] \ +[#font(monospace, monospace: ("Nope", "Latin Modern Math")) Math.] --- // Error: 7-12 unexpected argument -#font(false)[] +#font(false) --- // Error: 14-18 expected font style, found font weight -#font(style: bold, weight: "thin")[] +#font(style: bold, weight: "thin") --- // Error: 14-15 expected string or array of strings, found integer -#font(serif: 0)[] +#font(serif: 0) --- // Error: 19-23 unexpected argument -#font(size: 10pt, 12pt)[] +#font(size: 10pt, 12pt) --- // Error: 28-35 unexpected argument -#font(family: "Helvetica", "Arial")[] +#font(family: "Helvetica", "Arial") --- // Error: 7-27 unexpected argument -#font(something: "invalid")[] +#font(something: "invalid") diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ index 0c776c70..8f8d3946 100644 --- a/tests/typ/text/par.typ +++ b/tests/typ/text/par.typ @@ -1,7 +1,7 @@ // Test configuring paragraph properties. --- -#par!(spacing: 10pt, leading: 25%) +#par(spacing: 10pt, leading: 25%) But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. diff --git a/tests/typ/text/shaping.typ b/tests/typ/text/shaping.typ index 23156aa4..ba543e71 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") +#font("Noto Sans Arabic") دع النص يمطر عليك // This should form a three-member family. -#font!("Twitter Color Emoji") +#font("Twitter Color Emoji") 👩👩👦 🤚🏿 // These two shouldn't be affected by a zero-width joiner. @@ -20,7 +20,7 @@ Le fira --- // Test font fallback. -#font!("EB Garamond", "Noto Sans Arabic", "Twitter Color Emoji") +#font("EB Garamond", "Noto Sans Arabic", "Twitter Color Emoji") // Font fallback for emoji. A😀B @@ -40,6 +40,6 @@ A🐈中文B --- // Test reshaping. -#font!("Noto Serif Hebrew") -#lang!("he") +#font("Noto Serif Hebrew") +#lang("he") ס \ טֶ diff --git a/tests/typ/text/whitespace.typ b/tests/typ/text/whitespace.typ index c81513fa..7d5b1a68 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("PT Sans")[ ]B +A[#font("PT Sans") ]B --- // Test font change after space. -Left #font("PT Sans")[Right]. +Left [#font("PT Sans")Right]. --- // Test that space at start of line is not trimmed. |
