typst/tests/typ/text/em.typ

34 lines
505 B
Typst
Raw Normal View History

// Test font-relative sizing.
---
#set text(size: 5pt)
A // 5pt
2023-01-27 11:54:30 +01:00
#[
2022-04-08 15:08:26 +02:00
#set text(size: 2em)
B // 10pt
2023-01-27 11:54:30 +01:00
#[
2022-04-08 15:08:26 +02:00
#set text(size: 1.5em + 1pt)
C // 16pt
2022-04-08 15:08:26 +02:00
#text(size: 2em)[D] // 32pt
E // 16pt
]
F // 10pt
]
G // 5pt
2022-04-08 15:08:26 +02:00
---
// Test using ems in arbitrary places.
#set text(size: 5pt)
#set text(size: 2em)
#set square(fill: red)
#let size = {
let size = 0.25em + 1pt
for _ in range(3) {
size *= 2
}
size - 3pt
}
2023-02-12 18:58:39 +01:00
#stack(dir: ltr, spacing: 1fr, square(size: size), square(size: 25pt))