psf 0.2.0

Allow to read psf fonts, including (optionally) zipped ones
Documentation
  • Coverage
  • 100%
    18 out of 18 items documented1 out of 14 items with examples
  • Size
  • Source code size: 16.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.89 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • zaczkows/psf
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • zaczkows

psf

Reads psf (console) font files with optional support for automatic unzipping.

Decoding of the psf format was possible thanks to the nafe tool.

How to use

use psf::Font;

let the_font = Font::new("<path>");
if let Ok(font) = the_font {
    let c = font.get_char('X');
    if let Some(c) = c {
        println!("{:-<1$}", "", c.width() + 2);
        for h in 0..c.height() {
           print!("|");
           for w in 0..c.width() {
               let what = if c.get(w, h).unwrap() != 0 { "X" } else { " " };
               print!("{}", what);
           }
           println!("|");
       }
       println!("{:-<1$}", "", c.width() + 2);
    }
}

This is actually what method Font::print_char() is doing.