bdf

Crates.iobdf
lib.rsbdf
version0.6.0
sourcesrc
created_at2015-07-16 17:17:59.664406
updated_at2020-07-20 21:26:20.43893
descriptionBDF format handling.
homepage
repositoryhttps://github.com/meh/rust-bdf
max_upload_size
id2615
size250,207
owners (github:robigalia:owners)

documentation

README

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");
	}
}
Commit count: 95

cargo fmt