Skip to main content

Crate psf

Crate psf 

Source
Expand description

Reads psf (console) fonts. Exposes very simple interface for displaying the glyphs.

Exposing of the glyph data is simple and easy 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() { "X" } else { " " };
               print!("{}", what);
           }
           println!("|");
       }
       println!("{:-<1$}", "", c.width() + 2);
    }
}

Structs§

Font
Stores information about specific loaded font, including number of available characters, and each character width and height.
Glyph
Store information about specific glyph.

Enums§

Error
Simple error type.