Add Lucide icon font for the mobile UI

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.
This commit is contained in:
Skyler Lehmkuhl
2026-06-30 01:02:03 -04:00
parent 597697d0a6
commit 76e7963f03
7 changed files with 125 additions and 18 deletions
@@ -0,0 +1,47 @@
//! 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}";
@@ -17,6 +17,7 @@ use lightningbeam_core::pane::PaneType;
use crate::panes::NodePath;
use crate::RenderContext;
pub mod icons;
mod stack;
mod surface;
mod transport;
@@ -18,7 +18,7 @@
use eframe::egui;
use super::{slot_path, MobileState, StackDrag, StackPane, STACK};
use super::{icons, slot_path, MobileState, StackDrag, StackPane, STACK};
use crate::RenderContext;
const N: usize = STACK.len();
@@ -242,33 +242,35 @@ fn draw_header(ui: &egui::Ui, hr: egui::Rect, sp: StackPane, show_instruments: b
p.rect_filled(hr, 0.0, C_HEADER);
p.hline(hr.x_range(), hr.bottom(), egui::Stroke::new(1.0, C_LINE));
let cy = hr.center().y;
// Grip dots on the left.
for i in 0..2 {
let x = hr.left() + 11.0 + i as f32 * 4.0;
p.circle_filled(egui::pos2(x, cy), 1.5, C_DIM);
}
// Grip glyph on the left (Lucide).
p.text(
egui::pos2(hr.left() + 26.0, cy),
egui::pos2(hr.left() + 15.0, cy),
egui::Align2::CENTER_CENTER,
icons::GRIP_HORIZONTAL,
icons::font(16.0),
C_DIM,
);
p.text(
egui::pos2(hr.left() + 32.0, cy),
egui::Align2::LEFT_CENTER,
sp.label(show_instruments),
egui::FontId::proportional(15.0),
C_BRIGHT,
);
// Right-side buttons: fullscreen / restore rightmost, Node/Instrument toggle just left of it.
// These glyphs are covered by egui's bundled emoji-icon-font (⛶ ▣ ⇄).
p.text(
egui::pos2(hr.right() - BTN_W * 0.5, cy),
egui::Align2::CENTER_CENTER,
if fullscreen { "▣" } else { "⛶" },
egui::FontId::proportional(18.0),
if fullscreen { icons::MINIMIZE } else { icons::MAXIMIZE },
icons::font(17.0),
C_DIM,
);
if sp == StackPane::NodeInstrument {
p.text(
egui::pos2(hr.right() - BTN_W * 1.5, cy),
egui::Align2::CENTER_CENTER,
"⇄",
egui::FontId::proportional(17.0),
icons::ARROW_LEFT_RIGHT,
icons::font(17.0),
C_AMBER,
);
}
@@ -279,13 +281,23 @@ fn draw_footer(ui: &egui::Ui, fr: egui::Rect, at_end: bool) {
p.rect_filled(fr, 0.0, C_HEADER);
p.hline(fr.x_range(), fr.top(), egui::Stroke::new(1.0, C_LINE));
let col = if at_end { C_LINE } else { C_DIM };
p.text(
fr.center(),
egui::Align2::CENTER_CENTER,
"▲ pull up for more",
let cy = fr.center().y;
let galley = p.layout_no_wrap(
"pull up for more".to_string(),
egui::FontId::proportional(11.0),
col,
);
let total_w = 22.0 + galley.size().x;
let start_x = fr.center().x - total_w * 0.5;
p.text(
egui::pos2(start_x + 8.0, cy),
egui::Align2::CENTER_CENTER,
icons::CHEVRONS_UP,
icons::font(14.0),
col,
);
let gy = cy - galley.size().y * 0.5;
p.galley(egui::pos2(start_x + 22.0, gy), galley, col);
}
fn handle_key(h: Handle) -> (usize, usize) {
@@ -3,6 +3,7 @@
use eframe::egui;
use super::icons;
use crate::panes::SharedPaneState;
const C_PANEL: egui::Color32 = egui::Color32::from_rgb(0x1f, 0x24, 0x2c);
@@ -24,12 +25,12 @@ pub fn render(ui: &mut egui::Ui, rect: egui::Rect, shared: &mut SharedPaneState)
let btn_rect = egui::Rect::from_center_size(btn_center, egui::vec2(btn_r * 2.0, btn_r * 2.0));
let btn_resp = ui.interact(btn_rect, ui.id().with("mobile_transport_play"), egui::Sense::click());
painter.circle_filled(btn_center, btn_r, C_AMBER);
let glyph = if *shared.is_playing { "⏸" } else { "▶" };
let glyph = if *shared.is_playing { icons::PAUSE } else { icons::PLAY };
painter.text(
btn_center,
egui::Align2::CENTER_CENTER,
glyph,
egui::FontId::proportional(16.0),
icons::font(16.0),
C_DARK,
);
if btn_resp.clicked() {