typst/tests/typ/expand.typ
Laurenz 57ca9628c1 Better space coalescing logic 🌧
This creates a smaller state machine helper type for softness coalescing, which does not own the resulting nodes. While this creates a bit more duplication in stack and par builder, it makes it a lot easier to integrate additional logic into the paragraph builder.

Furthermore:
- Line breaks are now "hard", that is, not coalesced with each other.
- Text nodes with equal style are now merged allowing for example `f{}i` to form a ligature.
2021-03-27 21:52:39 +01:00

15 lines
354 B
Typst

// Test fit/fill expansion.
---
#let right(body) = align(right, body)
#let pad(body) = pad(left: 10pt, right: 10pt, body)
// Top-level paragraph fills page, boxed paragraph only when width is fixed.
L #right[R] \
#rect(width: 50pt)[L #right[R]] \
#rect[L #right[R]]
// Pad inherits expansion behaviour.
#pad[PL #right[PR]] \
#rect(pad[PL #right[PR]])