Crates.io | psf |
lib.rs | psf |
version | 0.2.0 |
source | src |
created_at | 2020-10-17 21:09:26.350415 |
updated_at | 2020-10-20 16:35:09.824884 |
description | Allow to read psf fonts, including (optionally) zipped ones |
homepage | |
repository | https://github.com/zaczkows/psf |
max_upload_size | |
id | 301646 |
size | 15,683 |
Reads psf (console) font files with optional support for automatic unzipping.
Decoding of the psf format was possible thanks to the nafe tool.
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.