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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
//! Centralized font catalog.
//!
//! Backends should import font bytes from here rather than embedding their own copies.
//! This ensures all backends share the same font set without duplication.
//!
//! # Available families
//!
//! - **Roboto** — default UI font (regular, bold, italic, bold-italic)
//! - **PT Root UI** — variable-weight sans-serif from Paratype (single VF file)
//! - **Symbols Nerd Font Mono** — Powerline (U+E0B0–U+E0B3), Nerd Font PUA, dev icons
//! - **Noto Sans Symbols2** — wide symbol / mathematical coverage
//! - **Noto COLRv1** — color emoji (COLRv1/v0) for vello-gpu and modern renderers
//! - **Noto Emoji** — color-neutral emoji fallback (legacy bitmap-compatible)
// ── Roboto ────────────────────────────────────────────────────────────────────
/// Roboto Regular (400).
pub static ROBOTO_REGULAR: & = include_bytes!;
/// Roboto Bold (700).
pub static ROBOTO_BOLD: & = include_bytes!;
/// Roboto Italic (400 italic).
pub static ROBOTO_ITALIC: & = include_bytes!;
/// Roboto Bold Italic (700 italic).
pub static ROBOTO_BOLD_ITALIC: & = include_bytes!;
// ── PT Root UI ─────────────────────────────────────────────────────────────
//
// Variable font — a single file covers the full weight axis (100–900).
// Pass it to fontdue as-is; rasterisation at any weight works from one binary.
/// PT Root UI Variable Font (covers weight axis 100–900).
pub static PT_ROOT_UI_VF: & = include_bytes!;
// ── JetBrains Mono ───────────────────────────────────────────────────────────
//
// Monospace font with full Unicode box-drawing coverage (U+2500–U+259F).
// Used for terminal-style rendering (PTY output, code blocks, etc.) where
// Roboto's lack of box-drawing glyphs produces tofu boxes.
/// JetBrains Mono Regular — monospace with box-drawing support.
pub static JETBRAINS_MONO_REGULAR: & =
include_bytes!;
/// JetBrains Mono Bold.
pub static JETBRAINS_MONO_BOLD: & =
include_bytes!;
// ── Fallback fonts ────────────────────────────────────────────────────────────
/// Symbols Nerd Font Mono — Powerline separators (U+E0B0–U+E0B3), Nerd Font PUA
/// (U+E000–U+F8FF), dev icons, and wide Unicode symbol coverage.
/// First fallback after the primary family.
pub static SYMBOLS_NERD_FONT_MONO: & =
include_bytes!;
/// Noto Sans Symbols 2 — wide symbol / mathematical coverage.
pub static NOTO_SANS_SYMBOLS2: & =
include_bytes!;
/// Noto COLRv1 — color emoji font using the COLRv1/v0 format.
/// Supported natively by vello-gpu (skrifa 0.40+); other backends fall through
/// to the monochrome outline or skip to the next fallback.
pub static NOTO_COLRV1: & = include_bytes!;
/// Noto Emoji — color-neutral emoji coverage (legacy, works on all backends).
pub static NOTO_EMOJI: & = include_bytes!;
// ── Backend-agnostic font family + CSS parser ────────────────────────────────
//
// All backends share one source of truth for CSS font-string parsing and
// family → bytes resolution. Each backend wraps these bytes in its own loader
// (`fontdue::Font`, `peniko::FontData`, `cosmic_text::fontdb::Source`, …) but
// the family detection logic lives here so new families only need to be added
// once.
/// Logical font family used by all uzor backends.
///
/// - **Roboto** — default UI sans-serif. Four style variants bundled.
/// - **PtRootUi** — variable-weight sans-serif from Paratype (single VF file).
/// Italic is not available — italic requests fall back to regular.
/// - **JetBrainsMono** — monospace with full Unicode box-drawing coverage
/// (U+2500–U+259F). Used for terminal output, code blocks, etc. Only
/// regular + bold variants are bundled; italic requests use regular.
/// Parsed CSS font-shorthand result.
/// Detect whether a (case-insensitive) CSS font string requests PT Root UI.
///
/// Accepted spellings: `"pt root ui"`, `"pt-root-ui"`, `"ptrootui"`.
/// Detect whether a (case-insensitive) CSS font string requests a monospace
/// family.
///
/// Matches the generic `"monospace"` keyword, explicit `"jetbrains mono"` /
/// `"jetbrainsmono"` / `"jb mono"`, and common system monospace fallback
/// names (`consolas`, `courier`, `cascadia`, `fira code`, `fira mono`). All
/// of these resolve to bundled JetBrains Mono which covers the full U+2500
/// box-drawing block needed for terminal emulation.
/// Resolve a CSS family fragment (e.g. the family portion of the CSS font
/// shorthand) to a [`FontFamily`].
///
/// Monospace keywords win over PT Root UI which wins over the default Roboto.
/// Parse a CSS font shorthand string into a [`FontInfo`].
///
/// Recognised tokens (case-insensitive, any order):
/// - `"bold"` — sets `bold = true`
/// - `"italic"` — sets `italic = true`
/// - `"<N>px"` — sets `size = N`
/// - Any other token is accumulated as family text and fed to
/// [`resolve_family`].
///
/// Unrecognised or empty strings produce [`FontInfo::default`] (Roboto 12px).
/// Return the static byte slice for the requested family / style combination.
///
/// - [`FontFamily::Roboto`] has all four style combinations.
/// - [`FontFamily::PtRootUi`] is a variable font — the same bytes are returned
/// for every (bold, italic) combination and backends handle the weight axis
/// themselves.
/// - [`FontFamily::JetBrainsMono`] has regular + bold only; italic requests
/// fall back to the non-italic variant of the requested weight.
/// Convenience wrapper around [`parse_css_font`] that returns only the family
/// resolution result.