summaryrefslogtreecommitdiff
path: root/tests/typ/library/font.typ
blob: 7f13e8a67cf971b7cded350476ce0ca94bdcff9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Test configuring font properties.

#font("PT Sans", 10pt)

// Set same font size in three different ways.
#font(20pt)[A]
#font(200%)[A]
#font(15pt + 50%)[A]

// Do nothing.
#font[Normal]

// Set style (is available).
#font(style: italic)[Italic]

// Set weight (is available).
#font(weight: bold)[Bold]

// Set stretch (not available, matching closest).
#font(stretch: ultra-condensed)[Condensed]

// Error: 7-12 unexpected argument
#font(false)

// Error: 3:14-3:18 expected font style, found font weight
// Error: 2:28-2:34 expected font weight, found string
// Error: 1:43-1:44 expected font family or array of font families, found integer
#font(style: bold, weight: "thin", serif: 0)

// Warning: 15-19 should be between 100 and 900
#font(weight: 2700)

// Error: 7-27 unexpected argument
#font(something: "invalid")

---
// Test font fallback and class definitions.

// Source Sans Pro + Segoe UI Emoji.
Emoji: 🏀

// CMU Serif + Noto Emoji.
#font("CMU Serif", "Noto Emoji")[
    Emoji: 🏀
]

// Class definitions.
#font(serif: ("CMU Serif", "Latin Modern Math", "Noto Emoji"))
#font(serif)[
    Math: ∫ α + β ➗ 3
]

// Class definition reused.
#font(sans-serif: "Noto Emoji")
#font(sans-serif: ("Archivo", sans-serif))
New sans-serif. 🚀