14 releases

0.6.0 Jul 20, 2020
0.5.5 Aug 26, 2016
0.5.4 Feb 22, 2016
0.5.3 Oct 29, 2015
0.5.2 Jul 19, 2015

#27 in #glyph

Download history 17/week @ 2024-01-11 14/week @ 2024-01-18 11/week @ 2024-01-25 5/week @ 2024-02-01 11/week @ 2024-02-08 41/week @ 2024-02-15 55/week @ 2024-02-22 49/week @ 2024-02-29 50/week @ 2024-03-07 48/week @ 2024-03-14 60/week @ 2024-03-21 48/week @ 2024-03-28 51/week @ 2024-04-04 38/week @ 2024-04-11 41/week @ 2024-04-18 37/week @ 2024-04-25

176 downloads per month
Used in 2 crates

WTFPL license

44KB
1.5K SLoC

bdf

Build Status

BDF handling library.

[dependencies]
bdf = "*"

Example

This example will draw a given glyph in the given font.

extern crate bdf;

use std::env;
use std::process::exit;
use std::char;

fn main() {
	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");
	}
}

lib.rs:

BDF font handler.

Dependencies

~0.4–1MB
~21K SLoC