| Crates.io | psf2-font |
| lib.rs | psf2-font |
| version | 0.1.1 |
| created_at | 2025-12-27 17:31:32.77038+00 |
| updated_at | 2025-12-27 18:16:30.796176+00 |
| description | PSF2 (PC Screen Font v2) parser with embedded Terminus Unicode font for no_std environments |
| homepage | |
| repository | https://github.com/artst3in/psf2-font |
| max_upload_size | |
| id | 2007529 |
| size | 24,049 |
A no_std Rust library for parsing PSF2 (PC Screen Font version 2) files with an embedded Terminus Unicode font.
use psf2_font::{load_terminus, Psf2Font};
// Load the embedded Terminus font
let font = load_terminus().expect("Failed to load font");
// Get glyph bitmap for a character
if let Some(glyph) = font.get_glyph('A') {
// glyph is a &[u8] with bitmap data (16 bytes for 8x16)
for byte in glyph {
println!("{:08b}", byte);
}
}
// Check dimensions
let (width, height) = font.dimensions(); // (8, 16)
// Check if font has a character
if font.has_char('♥') {
println!("Font supports hearts!");
}
// Parse custom PSF2 file
let custom_data = include_bytes!("my-font.psf");
let custom_font = Psf2Font::parse(custom_data)?;
PSF2 is the PC Screen Font version 2 format used by Linux for console fonts. It supports:
The embedded Terminus font is licensed under the SIL Open Font License 1.1, allowing:
See Terminus Font Homepage for details.
This library is licensed under the Apache License 2.0.
See LICENSE or http://www.apache.org/licenses/LICENSE-2.0 for details.
This crate builds upon the work of several projects:
Terminus Font: Created by Dimitar Zhekov (SIL OFL 1.1)
Font Source: Powerline Fonts project
PSF2 Parser: Implemented by The Architect & Luna for LunaOS