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
//! The inline-icon catalog: every `assets/glyphs/*.svg` as SVG source, keyed by
//! the character it draws.
//!
//! This is the lookup half of the SVG-icon feature; [`crate::icon_text`] is the
//! drawing half. The table itself is generated by `build.rs` at compile time
//! from the glyph SVGs, so an icon is catalogued by existing, with no list here
//! to fall out of step. See `build.rs` for the two transforms it applies (the
//! `#111` ink sentinel, and the viewBox-derived aspect ratio).
//!
//! Why both a font and an SVG catalog: the font is what egui lays out inside
//! ordinary text, and it stays the fallback for every glyph that is drawn as
//! text (toolbar buttons, `ui.label`s not yet converted). The catalog is what
//! lets the same character be drawn as a real image — which is what makes
//! genuine multi-colour icons possible, since a TrueType glyph can only be one
//! colour. The stacked private-use layers in
//! [`crate::panels::toolbar_button`] exist only to work around that limit.
//!
//! Three icons already take that route — the bug (U+1F41E), the book
//! (U+1F4DA) and the pencil (U+270D). Each was composed from the very layers
//! `toolbar_button` stacks by hand, in the same palette, so they are the same
//! artwork expressed once instead of assembled at paint time. Their glyph SVGs
//! mark the ink layer `brep:font-outline="1"`, so the TTF is byte-for-byte what
//! it was and a text use of those characters still renders exactly as before —
//! the colour is additive, visible only through this catalog.
// The generated `pub static ICONS: &[Icon]`, sorted by codepoint.
include!;
/// One catalogued icon: the SVG source for a character, plus what the renderer
/// needs to place and colour it.
/// The icon for `ch`, or `None` if the catalog has none — in which case the
/// character stays ordinary text and the font draws it.
/// Whether `ch` has an icon. Cheaper to read at a call site than `lookup().is_some()`.
/// The catalogued artwork for a label that is exactly one character.
///
/// This is the test every icon-drawing site makes — toolbar buttons, tree rows,
/// palette rows — so they all agree on what is an icon. `None` for a
/// multi-character label (a composite, not an icon) and for an uncatalogued
/// character; both are drawn as ordinary text.
///
/// MONOCHROME artwork is included. It used to be excluded, on the grounds that
/// the icon font already drew it in the live text colour for free — but that
/// exclusion was the last thing keeping a font in the binary. Callers tint a
/// `mono` icon to their text colour (it is white in the catalog, so a multiply
/// lands it exactly) and leave a colour one alone.
// BREP private tests: 4d18c45d7a290280