#font #glyph #format

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

#22 in #glyph

Download history 24/week @ 2023-11-20 19/week @ 2023-11-27 5/week @ 2023-12-04 13/week @ 2023-12-11 20/week @ 2023-12-18 7/week @ 2023-12-25 16/week @ 2024-01-08 15/week @ 2024-01-15 14/week @ 2024-01-22 7/week @ 2024-01-29 7/week @ 2024-02-05 16/week @ 2024-02-12 66/week @ 2024-02-19 58/week @ 2024-02-26 34/week @ 2024-03-04

175 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.5–1MB
~21K SLoC