Crates.io | bdf2 |
lib.rs | bdf2 |
version | |
source | src |
created_at | 2024-12-08 05:39:48.871667 |
updated_at | 2024-12-08 05:39:48.871667 |
description | BDF format handling. |
homepage | |
repository | https://github.com/meh/rust-bdf |
max_upload_size | |
id | 1476072 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
BDF font handler
This crate allows you to read and write BDF fonts in Rust.
This example will draw a given glyph in your terminal using the given font.
use std::char;
use std::env;
use std::process::exit;
let font = bdf::open(env::args().nth(1).expect("missing font file")).unwrap();
let codepoint = char::from_u32(
env::args()
.nth(2)
.expect("missing codepoint")
.parse()
.unwrap(),
)
.expect("invalid codepoint");
let glyph = font.glyphs().get(&codepoint).unwrap_or_else(|| exit(1));
for y in 0..glyph.height() {
for x in 0..glyph.width() {
if glyph.get(x, y) {
print!("██");
} else {
print!(" ");
}
}
print!("\n");
}