functora-egui 0.4.2

shadcn/ui-inspired widget library for egui - buttons, inputs, selects, dialogs, and 70+ more components with light/dark theming
Documentation
//! Loads the Geist font family as the default proportional font.

/// Configures egui to use the Geist font for proportional text.
///
/// Call this once during app setup, e.g. in the `CreationContext` callback:
///
/// ```ignore
/// # struct MyApp;
/// # impl eframe::App for MyApp {
/// #     fn update(&mut self, _: &egui::Context, _: &mut eframe::Frame) {}
/// # }
/// eframe::run_native("app", Default::default(), Box::new(|cc| {
///     functora_egui::setup_fonts(&cc.egui_ctx);
///     Ok(Box::new(MyApp))
/// }));
/// ```
pub fn setup_fonts(ctx: &egui::Context) {
    let mut fonts = egui::FontDefinitions::default();

    let _ = fonts.font_data.insert(
        "Geist-Regular".to_owned(),
        std::sync::Arc::new(egui::FontData::from_static(include_bytes!(
            "../../assets/fonts/Geist-Regular.ttf"
        ))),
    );

    let _ = fonts.font_data.insert(
        "Geist-Bold".to_owned(),
        std::sync::Arc::new(egui::FontData::from_static(include_bytes!(
            "../../assets/fonts/Geist-Bold.ttf"
        ))),
    );

    // Insert Geist as the first proportional font (highest priority)
    fonts
        .families
        .entry(egui::FontFamily::Proportional)
        .or_default()
        .insert(0, "Geist-Regular".to_owned());

    // Add bold variant as well (used in strong/heading text fallback)
    fonts
        .families
        .entry(egui::FontFamily::Proportional)
        .or_default()
        .insert(1, "Geist-Bold".to_owned());

    ctx.set_fonts(fonts);
}