can1357/oh-my-pi · error
bundled Silver.ttf must parse
Error message
bundled Silver.ttf must parse
What it means
The snapcompact renderer uses a TTF font (Silver.ttf) embedded in the binary at compile time. parse_ttf calls .expect() on font parsing, so if the embedded bytes fail to parse as a valid TTF face the process panics with this message. Per the module's contract, the blob is compile-time embedded, so this indicates build/packaging corruption rather than bad user input.
Source
Thrown at crates/pi-natives/src/snapcompact.rs:196
};
let Ok(enc) = u32::from_str_radix(cp.trim(), 16) else {
continue;
};
let bits = bits.trim();
if bits.len() != 16 {
continue;
}
let rows: Vec<u8> = (0..8)
.map(|i| u8::from_str_radix(&bits[i * 2..i * 2 + 2], 16).unwrap_or(0))
.collect();
glyphs.insert(enc, Glyph { w: 8, h: 8, xoff: 0, yoff: -1, rows });
}
Font { glyphs, ascent: 7, cell_w: 8, cell_h: 8 }
}
fn parse_ttf(data: &'static [u8], px: f32, cell_w: usize, cell_h: usize) -> TtfFont {
let face =
TtfFace::from_bytes(data, FontSettings::default()).expect("bundled Silver.ttf must parse");
let supported = face.chars().keys().copied().collect();
let ascent = face
.horizontal_line_metrics(px)
.map_or(px * 0.8, |metrics| metrics.ascent);
TtfFont { face, supported, px, ascent, cell_w, cell_h }
}
enum RenderFont<'a> {
Bitmap(&'a Font),
Ttf(&'a TtfFont),
}
impl RenderFont<'_> {
const fn cell_w(&self) -> usize {
match self {
Self::Bitmap(font) => font.cell_w,
Self::Ttf(font) => font.cell_w,
}View on GitHub (pinned to 9690622007)
Solutions
- Rebuild the native module from a clean checkout (the embedded font is parsed at first use, validated by the build)
- Verify the binary's integrity (checksum) — re-download or reinstall if corrupted
- If you replaced the bundled font, ensure it is a valid TTF parseable with default FontSettings
- Report to maintainers if a stock build panics — this is a build/packaging bug
Defensive patterns
Strategy: try-catch
Try / catch
try {
render();
} catch (err) {
if (String(err?.message).includes('bundled Silver.ttf must parse')) {
// fall back to a non-native/ASCII renderer
} else { throw err; }
} Prevention
- Install binaries from official channels and verify checksums
- Never patch/replace embedded font assets in distributed binaries
- Rebuild cleanly if you build from source
When it happens
Trigger: Calling any snapcompact rendering API that lazily initializes the font when the embedded Silver.ttf bytes fail to parse — broken build, bad bundling/embedding step, or binary corruption in transit.
Common situations: Custom/patched builds where the font asset was swapped or truncated; binary post-processing (strip/packers) corrupting embedded data; running a binary from a failed or divergent build pipeline.
Related errors
- utoken: zstd decode failed
- native task `{tag}` panicked: {message}
- modified change requires peer root
- native spelling thread stopped
- spelling range start is too large
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/810a99361478c561.
Report an issue: GitHub.