diff options
| author | Matt Fellenz <matt@felle.nz> | 2024-04-30 05:18:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-30 12:18:19 +0000 |
| commit | 97de0a0595d28e29d944112ab6e06700d9c9d73d (patch) | |
| tree | 220ffef576722553b311526258e23070b8a8ce95 /tests | |
| parent | 0bb45b335fb8b34af9ce33e1684e58c046ee5e45 (diff) | |
Various text layout config improvements (#3787)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/costs-hyphenation-avoid.png | bin | 0 -> 1642 bytes | |||
| -rw-r--r-- | tests/ref/costs-runt-allow.png | bin | 0 -> 607 bytes | |||
| -rw-r--r-- | tests/ref/costs-runt-avoid.png | bin | 0 -> 1265 bytes | |||
| -rw-r--r-- | tests/ref/costs-widow-orphan.png | bin | 0 -> 2676 bytes | |||
| -rw-r--r-- | tests/suite/layout/inline/hyphenate.typ | 56 |
5 files changed, 56 insertions, 0 deletions
diff --git a/tests/ref/costs-hyphenation-avoid.png b/tests/ref/costs-hyphenation-avoid.png Binary files differnew file mode 100644 index 00000000..8efaef63 --- /dev/null +++ b/tests/ref/costs-hyphenation-avoid.png diff --git a/tests/ref/costs-runt-allow.png b/tests/ref/costs-runt-allow.png Binary files differnew file mode 100644 index 00000000..31a348ff --- /dev/null +++ b/tests/ref/costs-runt-allow.png diff --git a/tests/ref/costs-runt-avoid.png b/tests/ref/costs-runt-avoid.png Binary files differnew file mode 100644 index 00000000..e45de59e --- /dev/null +++ b/tests/ref/costs-runt-avoid.png diff --git a/tests/ref/costs-widow-orphan.png b/tests/ref/costs-widow-orphan.png Binary files differnew file mode 100644 index 00000000..30e459de --- /dev/null +++ b/tests/ref/costs-widow-orphan.png diff --git a/tests/suite/layout/inline/hyphenate.typ b/tests/suite/layout/inline/hyphenate.typ index aaabe816..bcad4d93 100644 --- a/tests/suite/layout/inline/hyphenate.typ +++ b/tests/suite/layout/inline/hyphenate.typ @@ -49,3 +49,59 @@ It's a #emph[Tree]beard. #set page(width: 60pt) #set text(hyphenate: true) #h(6pt) networks, the rest. + +--- costs-widow-orphan --- +#set page(height: 60pt) + +#let sample = lorem(12) + +#sample +#pagebreak() +#set text(costs: (widow: 0%, orphan: 0%)) +#sample + +--- costs-runt-avoid --- +#set par(justify: true) + +#let sample = [please avoid runts in this text.] + +#sample +#pagebreak() +#set text(costs: (runt: 10000%)) +#sample + +--- costs-runt-allow --- +#set par(justify: true) +#set text(size: 6pt) + +#let sample = [a a a a a a a a a a a a a a a a a a a a a a a a a] + +#sample +#pagebreak() +#set text(costs: (runt: 0%)) +#sample + +--- costs-hyphenation-avoid --- +#set par(justify: true) + +#let sample = [we've increased the hyphenation cost.] + +#sample +#pagebreak() +#set text(costs: (hyphenation: 10000%)) +#sample + +--- costs-invalid-type --- +// Error: 18-37 expected ratio, found auto +#set text(costs: (hyphenation: auto)) + +--- costs-invalid-key --- +// Error: 18-52 unexpected key "invalid-key", valid keys are "hyphenation", "runt", "widow", and "orphan" +#set text(costs: (hyphenation: 1%, invalid-key: 3%)) + +--- costs-access --- +#set text(costs: (hyphenation: 1%, runt: 2%)) +#set text(costs: (widow: 3%)) +#context { + assert.eq(text.costs, (hyphenation: 1%, runt: 2%, widow: 3%, orphan: 100%)) +} |
