#font #bdf

bdf

BDF format handling

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

#59 in #font

Download history 27/week @ 2022-03-09 54/week @ 2022-03-16 50/week @ 2022-03-23 12/week @ 2022-03-30 13/week @ 2022-04-06 13/week @ 2022-04-13 13/week @ 2022-04-20 52/week @ 2022-04-27 193/week @ 2022-05-04 222/week @ 2022-05-11 68/week @ 2022-05-18 73/week @ 2022-05-25 140/week @ 2022-06-01 66/week @ 2022-06-08 16/week @ 2022-06-15 36/week @ 2022-06-22

266 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

~365–790KB
~18K SLoC