1use std::borrow::Cow;
9
10use gpui::App;
11
12pub mod combobox;
13pub mod control_bar;
14pub mod date;
15pub mod floating;
16pub mod focus;
17pub mod hover_card;
18pub mod icons;
19pub mod input;
20pub mod list;
21pub mod loaders;
22pub mod menu;
23pub mod menubar;
24pub mod pagination;
25pub mod palette;
26pub mod popover;
27pub mod scroll;
28pub mod stack;
29pub mod stats;
30pub mod surface;
31pub mod table;
32pub mod titlebar;
33pub mod tooltip;
34pub mod tree;
35pub mod widgets;
36
37#[cfg(feature = "geist-sans")]
42static FONT_GEIST: &[u8] = include_bytes!("../assets/fonts/Geist.ttf");
43#[cfg(feature = "geist-mono")]
44static FONT_GEIST_MONO: &[u8] = include_bytes!("../assets/fonts/GeistMono.ttf");
45#[cfg(feature = "geist-weights")]
54static FONT_GEIST_MEDIUM: &[u8] = include_bytes!("../assets/fonts/Geist-Medium.ttf");
55#[cfg(feature = "geist-weights")]
56static FONT_GEIST_SEMIBOLD: &[u8] = include_bytes!("../assets/fonts/Geist-SemiBold.ttf");
57#[cfg(feature = "geist-weights")]
58static FONT_GEIST_BOLD: &[u8] = include_bytes!("../assets/fonts/Geist-Bold.ttf");
59
60pub fn register_fonts(cx: &App) -> gpui::Result<()> {
67 #[allow(unused_mut, reason = "every face below is behind a feature")]
68 let mut fonts: Vec<Cow<'static, [u8]>> = Vec::new();
69 #[cfg(feature = "geist-sans")]
70 fonts.push(Cow::Borrowed(FONT_GEIST));
71 #[cfg(feature = "geist-mono")]
72 fonts.push(Cow::Borrowed(FONT_GEIST_MONO));
73 #[cfg(feature = "geist-weights")]
74 fonts.extend([
75 Cow::Borrowed(FONT_GEIST_MEDIUM),
76 Cow::Borrowed(FONT_GEIST_SEMIBOLD),
77 Cow::Borrowed(FONT_GEIST_BOLD),
78 ]);
79 cx.text_system().add_fonts(fonts)
80}