mirror of
https://github.com/typst/typst
synced 2025-05-18 02:55:28 +08:00
Adds top-edge and bottom-edge parameters to the font function. These define how the box around a word is computed. The possible values are: - ascender - cap-height (default top edge) - x-height - baseline (default bottom edge) - descender The defaults are chosen so that it's easy to create good-looking designs with vertical alignment. Since they are much tighter than what most other software uses by default, the default leading had to be increased to 50% of the font size and paragraph spacing to 100% of the font size. The values cap-height and x-height fall back to ascender in case they are zero because this value may occur in fonts that don't have glyphs with cap- or x-height (like Twitter Color Emoji). Since cap-height is the default top edge, doing no fallback would break things badly. Removes softness in favor of a simple boolean for pages and a more finegread u8 for spacing. This is needed to make paragraph spacing consume line spacing created by hard line breaks.
26 lines
437 B
XML
26 lines
437 B
XML
// Test the `h` and `v` functions.
|
|
|
|
---
|
|
// Ends paragraphs.
|
|
Tightly #v(0pt) packed
|
|
|
|
// Eating up soft spacing.
|
|
Inv #h(0pt) isible
|
|
|
|
// Multiple spacings in a row.
|
|
Add #h(10pt) #h(10pt) up
|
|
|
|
// Relative to font size.
|
|
Relative #h(100%) spacing
|
|
|
|
// Missing spacing.
|
|
// Error: 12 missing argument: spacing
|
|
Totally #h() ignored
|
|
|
|
// Swapped axes.
|
|
#page(main-dir: rtl, cross-dir: ttb, height: 80pt)[
|
|
1 #h(1cm) 2
|
|
|
|
3 #v(1cm) 4 #v(-1cm) 5
|
|
]
|