Bundle Lucide (ISC license) at assets/fonts/lucide.ttf and register it as the egui font family "lucide" via mobile/icons.rs::install (called in EditorApp::new). Icons are drawn as text with icons::font(size) + PUA codepoint constants. Switch the stack headers (grip, maximize/minimize, node⇄instrument), the footer chevron, and the transport play/pause to Lucide glyphs instead of relying on egui's limited built-in emoji-icon-font.
48 lines
1.7 KiB
Rust
48 lines
1.7 KiB
Rust
//! Lucide icon font (ISC license — see `assets/fonts/LICENSE-lucide.txt`).
|
|
#![allow(dead_code)] // a forward-looking icon palette; not all are wired up yet
|
|
//!
|
|
//! The font is embedded and registered as a named egui font family ("lucide"). Icons are drawn as
|
|
//! text using [`font`] for the `FontId`, with the codepoint constants below (Lucide's private-use
|
|
//! area). Run [`install`] once at startup.
|
|
|
|
use std::sync::Arc;
|
|
|
|
use eframe::egui;
|
|
|
|
/// The egui font-family name the Lucide glyphs live under.
|
|
pub const FAMILY: &str = "lucide";
|
|
|
|
/// Embed + register the Lucide icon font. Call once with the egui context at startup.
|
|
pub fn install(ctx: &egui::Context) {
|
|
let mut fonts = egui::FontDefinitions::default();
|
|
fonts.font_data.insert(
|
|
"lucide".to_owned(),
|
|
Arc::new(egui::FontData::from_static(include_bytes!(
|
|
"../../assets/fonts/lucide.ttf"
|
|
))),
|
|
);
|
|
fonts
|
|
.families
|
|
.insert(egui::FontFamily::Name(FAMILY.into()), vec!["lucide".to_owned()]);
|
|
ctx.set_fonts(fonts);
|
|
}
|
|
|
|
/// A `FontId` in the Lucide family at `size`.
|
|
pub fn font(size: f32) -> egui::FontId {
|
|
egui::FontId::new(size, egui::FontFamily::Name(FAMILY.into()))
|
|
}
|
|
|
|
// --- Codepoints (Lucide PUA). Add more as the mobile UI needs them. ---
|
|
pub const MAXIMIZE: &str = "\u{e112}";
|
|
pub const MINIMIZE: &str = "\u{e11a}";
|
|
pub const ARROW_LEFT_RIGHT: &str = "\u{e24a}";
|
|
pub const GRIP_HORIZONTAL: &str = "\u{e0ea}";
|
|
pub const CHEVRONS_UP: &str = "\u{e074}";
|
|
pub const PLAY: &str = "\u{e13c}";
|
|
pub const PAUSE: &str = "\u{e12e}";
|
|
pub const SETTINGS: &str = "\u{e154}";
|
|
pub const SEARCH: &str = "\u{e151}";
|
|
pub const PLUS: &str = "\u{e13d}";
|
|
pub const X: &str = "\u{e1b2}";
|
|
pub const MENU: &str = "\u{e115}";
|