diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/coma.png | bin | 86953 -> 84510 bytes | |||
| -rw-r--r-- | tests/ref/text/hyphenate.png | bin | 4979 -> 6196 bytes | |||
| -rw-r--r-- | tests/ref/text/justify.png | bin | 11709 -> 11714 bytes | |||
| -rw-r--r-- | tests/ref/text/knuth.png | bin | 0 -> 65836 bytes | |||
| -rw-r--r-- | tests/ref/text/microtype.png | bin | 0 -> 14346 bytes | |||
| -rw-r--r-- | tests/ref/text/par.png | bin | 11934 -> 11738 bytes | |||
| -rw-r--r-- | tests/typ/code/closure.typ | 1 | ||||
| -rw-r--r-- | tests/typ/text/hyphenate.typ | 20 | ||||
| -rw-r--r-- | tests/typ/text/knuth.typ | 29 | ||||
| -rw-r--r-- | tests/typ/text/microtype.typ | 35 |
10 files changed, 83 insertions, 2 deletions
diff --git a/tests/ref/coma.png b/tests/ref/coma.png Binary files differindex c3ea7ace..f9d30890 100644 --- a/tests/ref/coma.png +++ b/tests/ref/coma.png diff --git a/tests/ref/text/hyphenate.png b/tests/ref/text/hyphenate.png Binary files differindex 050cab12..24c52de5 100644 --- a/tests/ref/text/hyphenate.png +++ b/tests/ref/text/hyphenate.png diff --git a/tests/ref/text/justify.png b/tests/ref/text/justify.png Binary files differindex 38141bdc..90f84bb6 100644 --- a/tests/ref/text/justify.png +++ b/tests/ref/text/justify.png diff --git a/tests/ref/text/knuth.png b/tests/ref/text/knuth.png Binary files differnew file mode 100644 index 00000000..38e4b38f --- /dev/null +++ b/tests/ref/text/knuth.png diff --git a/tests/ref/text/microtype.png b/tests/ref/text/microtype.png Binary files differnew file mode 100644 index 00000000..a76ef293 --- /dev/null +++ b/tests/ref/text/microtype.png diff --git a/tests/ref/text/par.png b/tests/ref/text/par.png Binary files differindex c0b3d73f..19f28b81 100644 --- a/tests/ref/text/par.png +++ b/tests/ref/text/par.png diff --git a/tests/typ/code/closure.typ b/tests/typ/code/closure.typ index 6ef3cb28..a6006035 100644 --- a/tests/typ/code/closure.typ +++ b/tests/typ/code/closure.typ @@ -8,6 +8,7 @@ #let x = "\"hi\"" // Should output `"hi" => "bye"`. +#set text(overhang: false) #x => "bye" --- diff --git a/tests/typ/text/hyphenate.typ b/tests/typ/text/hyphenate.typ index d6f44477..67711ac3 100644 --- a/tests/typ/text/hyphenate.typ +++ b/tests/typ/text/hyphenate.typ @@ -1,14 +1,30 @@ // Test hyphenation. --- +// Hyphenate english. #set page(width: 70pt) #set par(lang: "en", hyphenate: true) Warm welcomes to Typst. -#h(6pt) networks, the rest. - --- +// Hyphenate greek. #set page(width: 60pt) #set par(lang: "el", hyphenate: true) διαμερίσματα. \ λατρευτός + +--- +// Hyphenate between shape runs. +#set par(lang: "en", hyphenate: true) +#set page(width: 80pt) + +It's a #emph[Tree]beard. + +--- +// This sequence would confuse hypher if we passed trailing / leading +// punctuation instead of just the words. So this tests that we don't +// do that. The test passes if there's just one hyphenation between +// "net" and "works". +#set page(width: 70pt) +#set par(lang: "en", hyphenate: true) +#h(6pt) networks, the rest. diff --git a/tests/typ/text/knuth.typ b/tests/typ/text/knuth.typ new file mode 100644 index 00000000..63b7c50d --- /dev/null +++ b/tests/typ/text/knuth.typ @@ -0,0 +1,29 @@ +#set page(width: auto, height: auto) +#set par(lang: "en", leading: 3pt, justify: true) +#set text(family: "CMU Serif") + +#let story = [ + In olden times when wishing still helped one, there lived a king whose + daughters were all beautiful; and the youngest was so beautiful that the sun + itself, which has seen so much, was astonished whenever it shone in her face. + Close by the king’s castle lay a great dark forest, and under an old lime-tree + in the forest was a well, and when the day was very warm, the king’s child + went out into the forest and sat down by the side of the cool fountain; and + when she was bored she took a golden ball, and threw it up on high and caught + it; and this ball was her favorite plaything. +] + +#let column(title, linebreaks, hyphenate) = { + rect(width: 132pt, fill: rgb("eee"))[ + #strong(title) + #par(linebreaks: linebreaks, hyphenate: hyphenate, story) + ] +} + +#grid( + columns: 3, + gutter: 10pt, + column([Simple without hyphens], "simple", false), + column([Simple with hyphens], "simple", true), + column([Optimized with hyphens], "optimized", true), +) diff --git a/tests/typ/text/microtype.typ b/tests/typ/text/microtype.typ new file mode 100644 index 00000000..add5e501 --- /dev/null +++ b/tests/typ/text/microtype.typ @@ -0,0 +1,35 @@ +// Test micro-typographical shenanigans. + +--- +// Test that overhang is off by default in boxes. +A#box["]B + +--- +// Test justified quotes. +#set par(justify: true) +“A quote that hangs a bit into the margin.” \ + --- somebody + +--- +// Test fancy quotes in the left margin. +#set par(align: right) +»Book quotes are even smarter.« \ +›Book quotes are even smarter.‹ \ + +--- +// Test fancy quotes in the right margin. +#set par(align: left) +«Book quotes are even smarter.» \ +‹Book quotes are even smarter.› \ + +--- +#set par(lang: "ar") +#set text("Noto Sans Arabic") +"المطر هو الحياة" \ +المطر هو الحياة + +--- +// Test that lone punctuation doesn't overhang into the margin. +#set page(margins: 0pt) +#set par(align: right) +: |
