Skip to main content

max / shop

Bundle IosevkaTerm Nerd Font Mono as the default Vendored assets/IosevkaTermNerdFontMono-Regular.ttf (~13 MB, OFL) and include_bytes!'d into the shop binary. Removes the DejaVu Sans Mono system-path dependency and gives starship, yazi, helix, nushell their nerd-font icons on any Wayland compositor without a font install step. IosevkaTerm is Iosevka's terminal-tuned variant (narrower cells than default Iosevka) and the Mono cut is what our cell-aligned renderer wants (all glyphs at a single advance, wide chars still 1-cell). Cell dimensions re-tuned for IosevkaTerm at 14 px logical: advance 8.0, height 17.0. May want fine-tuning after eyeball; happy to derive from font metrics via a Shaper::advance_for helper once we care. Binary grows by ~13 MB. Acceptable for a terminal (Alacritty ~10 MB, Ghostty ~30 MB); Iosevka's glyph count is what dominates. LFS or a fetch-at-build script is a follow-up if size matters.
Co-Authored-By
Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-23 20:23 UTC
Signed with PGP, not checked
Commit: 41f4608eb27a2f1735472223cc60e28ab6da066d
Parent: cdc3c1d
2 files changed, +8 insertions, -5 deletions
@@ -32,9 +32,13 @@
32 32 use wayland_client::protocol::{wl_output, wl_seat, wl_surface};
33 33
34 34 const INITIAL: (u32, u32) = (960, 540);
35 - const FONT_PATH: &str = "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf";
35 + /// IosevkaTerm Nerd Font Mono, terminal-optimized variant of Iosevka with
36 + /// nerd-font glyphs baked in. Bundled so starship, yazi, helix and friends
37 + /// get their icons without a system font install. ~13 MB in the binary.
38 + const FONT_BYTES: &[u8] =
39 + include_bytes!("../../../assets/IosevkaTermNerdFontMono-Regular.ttf");
36 40 const FONT_PX: f32 = 14.0;
37 - const CELL_ADVANCE: f32 = 8.5;
41 + const CELL_ADVANCE: f32 = 8.0;
38 42 const CELL_HEIGHT: f32 = 17.0;
39 43 const PAD_X: f32 = 10.0;
40 44 const PAD_Y: f32 = 6.0;
@@ -60,8 +64,7 @@
60 64 )
61 65 .init();
62 66
63 - let font_data = std::fs::read(FONT_PATH)
64 - .map_err(|e| anyhow::anyhow!("read font {FONT_PATH}: {e}"))?;
67 + let font_data: Vec<u8> = FONT_BYTES.to_vec();
65 68
66 69 let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/bash".into());
67 70 let cols_initial = grid_cols(INITIAL.0);
@@ -163,7 +166,7 @@
163 166 pty,
164 167 grid,
165 168 parser,
166 - font_data: std::fs::read(FONT_PATH)?,
169 + font_data: FONT_BYTES.to_vec(),
167 170 scale: 1,
168 171 keyboard: None,
169 172 modifiers: Modifiers::default(),
Binary file