simple-pcf 0.1.1

A simple library for parsing PCF bitmap font files.
Documentation
  • Coverage
  • 64.71%
    11 out of 17 items documented2 out of 7 items with examples
  • Size
  • Source code size: 7.92 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 529.35 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Jayshua/simple-pcf
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Jayshua

A simple parser for the PC Screen Font file format used to store bitmap fonts, most notably for use in the Linux kernel's built-in console.

Cozette is a good sample PCF font if you're looking for one.

This crate is no_std, no_alloc, and should never panic.

Example

let data: &[u8] = &std::fs::read("cozette.psf").unwrap();
let pcf = simple_pcf::Pcf::parse(data).unwrap();

for glyph_index in b'a' as usize ..= b'z' as usize {
	for (index, pixel_on) in pcf.get_glyph_pixels(glyph_index).unwrap().enumerate() {
		if index % pcf.glyph_width == 0 {
			println!("");
		}

		if pixel_on {
			print!("@");
		} else {
			print!(" ");
		}
	}
}